aboutsummaryrefslogtreecommitdiff
path: root/cmd/planr/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/planr/main.go')
-rw-r--r--cmd/planr/main.go30
1 files changed, 19 insertions, 11 deletions
diff --git a/cmd/planr/main.go b/cmd/planr/main.go
index 2243203..e2ed19f 100644
--- a/cmd/planr/main.go
+++ b/cmd/planr/main.go
@@ -80,29 +80,37 @@ func main() {
dieUsage()
}
+ subcommand := flag.Arg(0)
+ subargs := flag.Args()[1:]
+
+ switch subcommand {
+ case "version":
+ fmt.Printf("%s\n", planr.VERSION)
+ os.Exit(0)
+ case "help", "-h", "-help", "--help":
+ printUsage(os.Stdout)
+ os.Exit(0)
+ case "build", "evaluate", "eval", "clean", "config", "list":
+ break
+ default:
+ fmt.Fprintf(os.Stderr, "unrecognized command %s\n", subcommand)
+ dieUsage()
+ }
+
runner := getConfiguredRunner()
cfg := planr.DecodeConfig(runner.ConfigDir())
- subcommand := flag.Arg(0)
- subargs := flag.Args()[1:]
-
switch subcommand {
- case "version":
- fmt.Printf("%s\n", planr.VERSION)
case "build":
sub.Build(runner, subargs, cfg)
case "evaluate", "eval":
sub.Evaluate(runner, subargs, cfg)
+ case "list":
+ sub.List(runner, subargs, cfg)
case "clean":
sub.Clean(runner, subargs)
case "config":
sub.Config(runner, subargs)
- case "help", "-h", "-help", "--help":
- printUsage(os.Stdout)
- default:
- fmt.Fprintf(os.Stderr, "unrecognized command %s\n", subcommand)
- dieUsage()
}
-
}