now we can see the packages, and the properties of them

This commit is contained in:
2024-06-06 18:54:03 +03:00
parent a71d124066
commit 8a3782e1db
4 changed files with 132 additions and 30 deletions

View File

@@ -1,11 +1,38 @@
package main
import(
"fmt"
"strconv"
)
type packages struct{
name string
version string
extra_command string
tag string
warning bool
Id string
Name string
Version string
ExtraCommand *string
Tag string
Warning bool
Element *elements
}
func ConvertStringsToPackage(strs []string) (packages, error) {
var pkg packages
if len(strs) != 6 {
return pkg, fmt.Errorf("input slice must have exactly 6 elements")
}
warning, err := strconv.ParseBool(strs[5])
if err != nil {
return pkg, fmt.Errorf("error parsing Warning value: %s", err)
}
return packages{
Id: strs[0],
Name: strs[1],
Version: strs[2],
ExtraCommand: &strs[3],
Tag: strs[4],
Warning: warning,
}, nil
}
type elements struct {
Title string