WIP: Rewrite bpm utils in go #1

Draft
EnumDev wants to merge 8 commits from go_rewrite into master
Showing only changes of commit 57a58a18a7 - Show all commits

View File

@ -31,6 +31,9 @@ func main() {
os.Exit(1) os.Exit(1)
} }
// run checks
runChecks()
// Show summary // Show summary
showSummary() showSummary()
@ -68,6 +71,20 @@ func help() {
fmt.Println(" -g=<true/false> | Create git repository (Defaults to true)") 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() { func showSummary() {
absPath, err := filepath.Abs(*directory) absPath, err := filepath.Abs(*directory)
if err != nil { if err != nil {