diff --git a/Makefile b/Makefile index 448c196..742457c 100644 --- a/Makefile +++ b/Makefile @@ -32,3 +32,4 @@ install: ## build blackbean. clean: ## Remove test report. @rm -f *.out + diff --git a/cmd/snapshot.go b/cmd/snapshot.go index e2367ee..de7861d 100644 --- a/cmd/snapshot.go +++ b/cmd/snapshot.go @@ -155,7 +155,7 @@ func restoreSnapshot(cli *elasticsearch.Client, out io.Writer) *cobra.Command { } ) f := command.Flags() - f.StringVar(&snapshots, "snapshot", "_all", "to get specific snapshot") + f.StringVar(&snapshots, "snapshot", "", "to get specific snapshot") err := command.RegisterFlagCompletionFunc("snapshot", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { if len(args) == 1 { return so.getRepoAllSnapshotsForFlag(args[0]), cobra.ShellCompDirectiveNoFileComp @@ -171,6 +171,7 @@ func restoreSnapshot(cli *elasticsearch.Client, out io.Writer) *cobra.Command { _ = command.MarkFlagRequired("index") _ = command.MarkFlagRequired("rename_pattern") _ = command.MarkFlagRequired("rename_replacement") + _ = command.MarkFlagRequired("snapshot") return command } diff --git a/pkg/util/decoder.go b/pkg/util/decoder.go index 8ec6a01..0f98750 100644 --- a/pkg/util/decoder.go +++ b/pkg/util/decoder.go @@ -59,17 +59,6 @@ func Unmarshal(data []byte, v interface{}) error { } } -//// ToJSON converts a single YAML document into a JSON document -//// or returns an error. If the document appears to be JSON the -//// YAML decoding path is not used (so that error messages are -//// JSON specific). -//func ToJSON(data []byte) ([]byte, error) { -// if hasJSONPrefix(data) { -// return data, nil -// } -// return yaml.YAMLToJSON(data) -//} - // YAMLToJSONDecoder decodes YAML documents from an io.Reader by // separating individual documents. It first converts the YAML // body to JSON, then unmarshals the JSON.