Add checks to bpm-setup

This commit is contained in:
2025-04-08 13:43:55 +03:00
parent 23b5f0eee1
commit 57a58a18a7
+17
View File
@@ -31,6 +31,9 @@ func main() {
os.Exit(1)
}
// run checks
runChecks()
// Show summary
showSummary()
@@ -68,6 +71,20 @@ func help() {
fmt.Println(" -g=<true/false> | 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 {