aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/main.go b/main.go
index c753a01..9057231 100644
--- a/main.go
+++ b/main.go
@@ -11,13 +11,23 @@ import (
type subcmd func(args []string) int
var subcmds = map[string]subcmd{
- "write-dir": notImplementedYet,
+ "write-dir": WriteDir,
"restore-dir": notImplementedYet,
"take-snapshot": notImplementedYet,
"create-snapshot": notImplementedYet,
"list-snapshots": notImplementedYet,
}
+func subcmdUsage(name string, usage string, flags *flag.FlagSet) func() {
+ return func() {
+ fmt.Fprintf(os.Stderr, "Usage: %s %s %s\n", os.Args[0], name, usage)
+ if flags != nil {
+ fmt.Fprintln(os.Stderr, "\nFlags:")
+ flags.PrintDefaults()
+ }
+ }
+}
+
// Global flags
var (
flagConfPath = flag.String("config", "", "Use this config file instead of the default")