diff --git a/src/bpm-setup/main.go b/src/bpm-setup/main.go index e68bb80..a51f32a 100644 --- a/src/bpm-setup/main.go +++ b/src/bpm-setup/main.go @@ -1,9 +1,15 @@ package main import ( + "bufio" "flag" "fmt" + "log" "os" + "os/exec" + "path" + "path/filepath" + "strings" ) var directory = flag.String("D", "", "Path to package directory") @@ -13,7 +19,7 @@ var version = flag.String("v", "1.0", "Set the package version (Defaults to \"1. 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)") +var git = flag.Bool("g", true, "Create git repository (Defaults to true)") func main() { // Setup flags @@ -24,6 +30,21 @@ func main() { help() os.Exit(1) } + + // Show summary + showSummary() + + // Confirmation prompt + fmt.Printf("Create package directory? [y\\N]: ") + reader := bufio.NewReader(os.Stdin) + text, _ := reader.ReadString('\n') + if strings.TrimSpace(strings.ToLower(text)) != "y" && strings.TrimSpace(strings.ToLower(text)) != "yes" { + fmt.Println("Cancelling package directory creation...") + os.Exit(1) + } + + // Create package directory + createDirectory() } func setupFlags() { @@ -46,3 +67,79 @@ func help() { fmt.Println(" -t=