From b2742dc28d1ff9001cd784455bbdf9cf29539c30 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Thu, 14 Sep 2017 07:42:50 +0200 Subject: Implement remaining subcommands --- main.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index b0f3f6b..36d469f 100644 --- a/main.go +++ b/main.go @@ -11,11 +11,12 @@ import ( type subcmd func(args []string) int var subcmds = map[string]subcmd{ - "write-dir": WriteDir, - "restore-dir": RestoreDir, - "take-snapshot": notImplementedYet, - "create-snapshot": notImplementedYet, - "list-snapshots": notImplementedYet, + "write-dir": WriteDir, + "restore-dir": RestoreDir, + "take-snapshot": TakeSnapshot, + "create-snapshot": CreateSnapshot, + "list-snapshots": ListSnapshots, + "restore-snapshot": RestoreSnapshot, } func subcmdUsage(name string, usage string, flags *flag.FlagSet) func() { @@ -28,6 +29,12 @@ func subcmdUsage(name string, usage string, flags *flag.FlagSet) func() { } } +func subcmdErrout(name string) func(error) { + return func(err error) { + fmt.Fprintf(os.Stderr, "%s: %s\n", name, err) + } +} + // Global flags var ( flagConfPath = flag.String("config", "", "Use this config file instead of the default") @@ -116,8 +123,3 @@ func loadConfig() bool { objectstore = s return true } - -func notImplementedYet(_ []string) int { - fmt.Fprintln(os.Stderr, "Not implemented yet") - return 1 -} -- cgit v1.2.3-54-g00ecf