PackageManager just because
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.2 KiB

package main
import (
"flag"
"fmt"
"PackageManager/Client/Database"
"PackageManager/Client/Filesystem"
"PackageManager/Client/Package"
"PackageManager/Color"
)
func main() {
var (
updateFilesytemFlag bool
updateFilesytemFlagLong bool
createPackageFlag bool
createPackageFlagLong bool
e error
)
e = Database.InitDB()
if e != nil {
panic(e)
}
// Initialise flags
flag.BoolVar(&updateFilesytemFlag, "Uf", false, "Update filesystem database")
flag.BoolVar(&updateFilesytemFlagLong, "update-filesystem", false, "Update filesystem database")
flag.BoolVar(&createPackageFlag, "Cp", false, "Create package")
flag.BoolVar(&createPackageFlagLong, "create-package", false, "Create Package")
flag.Parse()
if updateFilesytemFlag || updateFilesytemFlagLong {
e = Filesystem.UpdateFilesystemHash()
if e != nil {
panic(e)
}
return
}
if createPackageFlag || createPackageFlagLong {
e = Package.CreatePackage()
if e != nil {
panic(e)
}
return
}
flag.Usage()
fmt.Println(Color.Fatal("Nothing to do"))
//e := Archive.TarGzip("/tmp/test", "/tmp/test.tar.gz")
//e := Archive.UntarGzip("/tmp/test.tar.gz", "/tmp/test")
//fmt.Println(e)
}