diff --git a/src/bpm-setup/main.go b/src/bpm-setup/main.go index 6a44a54..e68bb80 100644 --- a/src/bpm-setup/main.go +++ b/src/bpm-setup/main.go @@ -1,7 +1,48 @@ package main -import "fmt" +import ( + "flag" + "fmt" + "os" +) + +var directory = flag.String("D", "", "Path to package directory") +var name = flag.String("n", "", "Set the package name (Defaults to \"package-name\")") +var description = flag.String("d", "Default Package Description", "Set the description (Defaults to \"package-description\")") +var version = flag.String("v", "1.0", "Set the package version (Defaults to \"1.0\")") +var url = flag.String("u", "", "Set the package URL (Optional)") +var license = flag.String("l", "", "Set the package licenses (Optional)") +var template = flag.String("t", "source.default", "Set the package template (Defaults to \"source.default\")") +var git = flag.String("g", "", "Create git repository (Defaults to true)") func main() { - fmt.Println("bpm-setup") + // Setup flags + setupFlags() + + // Show command help if no directory name is given + if *directory == "" { + help() + os.Exit(1) + } +} + +func setupFlags() { + flag.Usage = help + flag.Parse() + if *name == "" { + *name = *directory + } +} + +func help() { + fmt.Println("Usage: bpm-setup ") + fmt.Println("Options:") + fmt.Println(" -D= | Path to package directory") + fmt.Println(" -n= | Set the package name (Defaults to \"package-name\")") + fmt.Println(" -d= | Set the package description (Defaults to \"Default package description\")") + fmt.Println(" -v= | Set the package version (Defaults to \"1.0\")") + fmt.Println(" -u= | Set the package URL (Optional)") + fmt.Println(" -l= | Set the package licenses (Optional)") + fmt.Println(" -t=