diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2018-01-15 07:39:49 +0100 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2018-01-15 07:39:49 +0100 |
commit | 62eef384330f652edd17732240ae0d82685c0914 (patch) | |
tree | 1ebf60a5baada7e5bd32c44ed0bafbe264958ca9 /storagecmd.go | |
parent | fc37a9d8e4e240a8fbf297919490c6df7e676d63 (diff) | |
download | petrific-62eef384330f652edd17732240ae0d82685c0914.tar.gz petrific-62eef384330f652edd17732240ae0d82685c0914.tar.bz2 petrific-62eef384330f652edd17732240ae0d82685c0914.zip |
Add command to restore index of a cloud storage
Diffstat (limited to 'storagecmd.go')
-rw-r--r-- | storagecmd.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/storagecmd.go b/storagecmd.go new file mode 100644 index 0000000..d2b603a --- /dev/null +++ b/storagecmd.go @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "os" +) + +func StorageCmd(env *Env, args []string) int { + cmds := env.Store.Subcmds() + + if len(args) == 0 { + if len(cmds) == 0 { + fmt.Fprintln(os.Stderr, "No storage subcommands available") + return 2 + } + + fmt.Fprintln(os.Stderr, "Availabe storage subcommands:") + for name := range cmds { + fmt.Fprintln(os.Stderr, " "+name) + } + return 2 + } + + cmd, ok := cmds[args[0]] + if !ok { + fmt.Fprintf(os.Stderr, "Unknown storage subcommand %s\n", args[0]) + } + + return cmd(args[1:], env.Log, env.Conf) +} |