From a845956238e6a41479a7abd59f5c39e71f3f85f4 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Thu, 3 Aug 2017 08:08:53 +0200 Subject: Implement write-dir --- main.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'main.go') 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") -- cgit v1.2.3-54-g00ecf