diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2017-09-14 07:42:50 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2017-09-26 21:35:41 +0200 |
commit | b2742dc28d1ff9001cd784455bbdf9cf29539c30 (patch) | |
tree | 2cac9dff572edbfc05588c33cce76a3dbb406d15 /main.go | |
parent | 9ddda1c317dbeaab1380e46ebf48eba9566a90e2 (diff) | |
download | petrific-b2742dc28d1ff9001cd784455bbdf9cf29539c30.tar.gz petrific-b2742dc28d1ff9001cd784455bbdf9cf29539c30.tar.bz2 petrific-b2742dc28d1ff9001cd784455bbdf9cf29539c30.zip |
Implement remaining subcommands
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -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 -} |