New creates a new list command.
(vp *viper.Viper)
| 21 | |
| 22 | // New creates a new list command. |
| 23 | func New(vp *viper.Viper) *cobra.Command { |
| 24 | listCmd := &cobra.Command{ |
| 25 | Use: "list", |
| 26 | Short: "List Hubble objects", |
| 27 | } |
| 28 | |
| 29 | // add config.ServerFlags to the help template as these flags are used by |
| 30 | // this command |
| 31 | template.RegisterFlagSets(listCmd, config.ServerFlags) |
| 32 | |
| 33 | listCmd.AddCommand( |
| 34 | newNodeCommand(vp), |
| 35 | newNamespacesCommand(vp), |
| 36 | ) |
| 37 | return listCmd |
| 38 | } |
| 39 | |
| 40 | func jsonOutput(buf io.Writer, v any) error { |
| 41 | bs, err := json.MarshalIndent(v, "", " ") |
no test coverage detected