fix #85: add --auto-headers and --custom-headers (#86)

This commit is contained in:
T.v.Dein
2025-10-10 13:08:16 +02:00
committed by GitHub
parent 4ce6c30f54
commit 8bdb3db105
7 changed files with 134 additions and 7 deletions

View File

@@ -59,6 +59,7 @@ func Execute() {
ShowCompletion string
modeflag cfg.Modeflag
sortmode cfg.Sortmode
headers string
)
var rootCmd = &cobra.Command{
@@ -91,6 +92,7 @@ func Execute() {
conf.CheckEnv()
conf.PrepareModeFlags(modeflag)
conf.PrepareSortFlags(sortmode)
conf.PrepareCustomHeaders(headers)
wrapE(conf.PrepareFilters())
@@ -137,6 +139,10 @@ func Execute() {
"Output field separator (' ' for ascii table, ',' for CSV)")
rootCmd.PersistentFlags().BoolVarP(&conf.InputJSON, "json", "j", false,
"JSON input mode")
rootCmd.PersistentFlags().BoolVarP(&conf.AutoHeaders, "auto-headers", "", false,
"Generate headers automatically")
rootCmd.PersistentFlags().StringVarP(&headers, "custom-headers", "", "",
"Custom headers")
// sort options
rootCmd.PersistentFlags().StringVarP(&conf.SortByColumn, "sort-by", "k", "",