diff options
author | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-03 18:13:49 -0500 |
---|---|---|
committer | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-03 18:13:49 -0500 |
commit | 38912d85394604fe9cc238ef6eb9f6e75ceb38f9 (patch) | |
tree | 861fc3af5d44ef8fbad738638f498c6e63bd1747 /cmd/planr/sub/config.go | |
parent | aff7b69cab2ac1d09b47f28c6fa653febd8595ea (diff) | |
download | deb-planr-38912d85394604fe9cc238ef6eb9f6e75ceb38f9.tar.xz deb-planr-38912d85394604fe9cc238ef6eb9f6e75ceb38f9.zip |
Add config command to retrieve configuration values and clean command to clean build files
Diffstat (limited to 'cmd/planr/sub/config.go')
-rw-r--r-- | cmd/planr/sub/config.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cmd/planr/sub/config.go b/cmd/planr/sub/config.go new file mode 100644 index 0000000..ee372c8 --- /dev/null +++ b/cmd/planr/sub/config.go @@ -0,0 +1,28 @@ +package sub + +import ( + "golang.flu0r1ne.net/planr" + "fmt" + "os" +) + + +func Config(runner planr.Runner, params []string) { + if len(params) != 1 { + fmt.Fprintf(os.Stderr, "Usage: planr config <parameter>\n") + os.Exit(1) + } + + key := params[0] + + switch key { + case "builddir": + fmt.Printf("%s\n", runner.BuildDir()) + case "configdir": + fmt.Printf("%s\n", runner.ConfigDir()) + case "srcdir": + fmt.Printf("%s\n", runner.SrcDir()) + default: + fmt.Fprintf(os.Stderr, "\"%s\" not found in configuration\n", key) + } +} |