diff --git a/src/bpm-setup/main.go b/src/bpm-setup/main.go index a51f32a..a177035 100644 --- a/src/bpm-setup/main.go +++ b/src/bpm-setup/main.go @@ -31,6 +31,9 @@ func main() { os.Exit(1) } + // run checks + runChecks() + // Show summary showSummary() @@ -68,6 +71,20 @@ func help() { fmt.Println(" -g= | Create git repository (Defaults to true)") } +func runChecks() { + if strings.TrimSpace(*directory) == "" { + log.Fatalf("No directory was specified!") + } + + if strings.TrimSpace(*name) == "" { + log.Fatalf("No directory was specified!") + } + + if stat, err := os.Stat(path.Join("/etc/bpm-utils/", *template)); err != nil || stat.IsDir() { + log.Fatalf("%s is not a valid template file!", *template) + } +} + func showSummary() { absPath, err := filepath.Abs(*directory) if err != nil {