From a634c22ae0840016c1a9d6f89f768500f7adbf97 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 13 Apr 2017 23:55:49 +0200 Subject: [PATCH] Add hidden 'options' command to list all opts --- src/cmds/restic/cmd_options.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/cmds/restic/cmd_options.go diff --git a/src/cmds/restic/cmd_options.go b/src/cmds/restic/cmd_options.go new file mode 100644 index 000000000..ba78941b0 --- /dev/null +++ b/src/cmds/restic/cmd_options.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "restic/options" + + "github.com/spf13/cobra" +) + +var optionsCmd = &cobra.Command{ + Use: "options", + Short: "print list of extended options", + Long: ` +The "options" command prints a list of extended options. +`, + Hidden: true, + Run: func(cmd *cobra.Command, args []string) { + fmt.Printf("All Extended Options:\n") + for _, opt := range options.List() { + fmt.Printf(" %-15s %s\n", opt.Namespace+"."+opt.Name, opt.Text) + } + }, +} + +func init() { + cmdRoot.AddCommand(optionsCmd) +}