@@ -299,6 +299,7 @@ func newCommand(c Command, run interface{}, subCommands []*cobra.Command, mods .
299299 quiet , _ := cmd .Flags ().GetBool ("quiet" )
300300 verbose , _ := cmd .Flags ().GetBool ("verbose" )
301301 filter , _ := cmd .Flags ().GetString ("filter" )
302+ fields , _ := cmd .Flags ().GetString ("fields" )
302303 var filters = make (map [string ]string )
303304 if filter != "" {
304305 t := strings .Split (filter , " " )
@@ -320,7 +321,11 @@ func newCommand(c Command, run interface{}, subCommands []*cobra.Command, mods .
320321 allResult := []map [string ]string {}
321322
322323 for _ , i := range s {
323- item := listItem (i , filters , quiet , nil , verbose , map [string ]string {})
324+ var fs []string
325+ if fields != "" {
326+ fs = strings .Split (fields , "," )
327+ }
328+ item := listItem (i , filters , quiet , fs , verbose , map [string ]string {})
324329 if len (item ) == 0 {
325330 continue
326331 }
@@ -491,7 +496,7 @@ func listItem(i interface{}, filters map[string]string, quiet bool, fields []str
491496
492497 if len (fields ) > 0 {
493498 for _ , ff := range fields {
494- if ff == tag {
499+ if ff == tag || strings . ToUpper ( ff ) == tag || strings . ToLower ( ff ) == tag {
495500 res [tag ] = fmt .Sprintf ("%v" , f .Interface ())
496501 continue
497502 }
0 commit comments