Skip to content

Commit

Permalink
internal/cli/cmd: use single invocation of (*cobra.Command).AddCommand
Browse files Browse the repository at this point in the history
AddCommand is a variadic function and can take multiple arguments. Do so
in newCmdClusterMesh and newCmdHubble to improve code readblity.

Signed-off-by: Tobias Klauser <[email protected]>
  • Loading branch information
tklauser committed Feb 26, 2021
1 parent 892d604 commit 952ebce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 7 additions & 5 deletions internal/cli/cmd/clustermesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ func newCmdClusterMesh() *cobra.Command {
Long: ``,
}

cmd.AddCommand(newCmdClusterMeshEnable())
cmd.AddCommand(newCmdClusterMeshDisable())
cmd.AddCommand(newCmdClusterMeshConnect())
cmd.AddCommand(newCmdClusterMeshDisconnect())
cmd.AddCommand(newCmdClusterMeshStatus())
cmd.AddCommand(
newCmdClusterMeshEnable(),
newCmdClusterMeshDisable(),
newCmdClusterMeshConnect(),
newCmdClusterMeshDisconnect(),
newCmdClusterMeshStatus(),
)

return cmd
}
Expand Down
6 changes: 4 additions & 2 deletions internal/cli/cmd/hubble.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ func newCmdHubble() *cobra.Command {
Long: ``,
}

cmd.AddCommand(newCmdHubbleEnable())
cmd.AddCommand(newCmdHubbleDisable())
cmd.AddCommand(
newCmdHubbleEnable(),
newCmdHubbleDisable(),
)

return cmd
}
Expand Down

0 comments on commit 952ebce

Please sign in to comment.