Refactoring Output types

This commit is contained in:
Mike Farah
2024-02-24 14:58:11 +11:00
parent 8a538394a5
commit 571caa696a
9 changed files with 91 additions and 60 deletions
+2 -1
View File
@@ -97,7 +97,8 @@ yq -P -oy sample.json
panic(err)
}
rootCmd.PersistentFlags().StringVarP(&outputFormat, "output-format", "o", "auto", "[auto|a|yaml|y|json|j|props|p|xml|x|tsv|t|csv|c] output format type.")
rootCmd.PersistentFlags().StringVarP(&outputFormat, "output-format", "o", "auto", fmt.Sprintf("[auto|a|%v] output format type.", yqlib.GetAvailableOutputFormatString()))
if err = rootCmd.RegisterFlagCompletionFunc("output-format", cobra.FixedCompletions([]string{"auto", "yaml", "json", "props", "xml", "tsv", "csv"}, cobra.ShellCompDirectiveNoFileComp)); err != nil {
panic(err)
}