@@ -50,6 +50,9 @@ func InitSubCommands(rootCmd *cobra.Command) {
5050 var includeInitShort string = "include init container(s) in the output, by default init containers are hidden"
5151 var odditiesShort string = "show only the outlier rows that dont fall within the computed range"
5252 var sizeShort string = "allows conversion to the selected size rather then the default megabyte output"
53+ var treeShort string = "Display tree like view instead of the standard list"
54+ var nodetreeShort string = "Displays the tree with the nodes as the root"
55+ var showIPShort string = "Show the pods IP address column"
5356 // var treeShort string = "Display tree like view instead of the standard list"
5457
5558 log := logger {location : "InitSubCommands" }
@@ -75,6 +78,8 @@ func InitSubCommands(rootCmd *cobra.Command) {
7578 },
7679 }
7780 KubernetesConfigFlags .AddFlags (cmdCapabilities .Flags ())
81+ cmdCapabilities .Flags ().BoolP ("tree" , "t" , false , treeShort )
82+ cmdCapabilities .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
7883 addCommonFlags (cmdCapabilities )
7984 rootCmd .AddCommand (cmdCapabilities )
8085
@@ -95,6 +100,8 @@ func InitSubCommands(rootCmd *cobra.Command) {
95100 },
96101 }
97102 KubernetesConfigFlags .AddFlags (cmdCommands .Flags ())
103+ cmdCommands .Flags ().BoolP ("tree" , "t" , false , treeShort )
104+ cmdCommands .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
98105 addCommonFlags (cmdCommands )
99106 rootCmd .AddCommand (cmdCommands )
100107
@@ -117,6 +124,8 @@ func InitSubCommands(rootCmd *cobra.Command) {
117124 cmdCPU .Flags ().BoolP ("include-init" , "i" , false , includeInitShort )
118125 cmdCPU .Flags ().BoolP ("oddities" , "" , false , odditiesShort )
119126 cmdCPU .Flags ().BoolP ("raw" , "r" , false , "show raw values" )
127+ cmdCPU .Flags ().BoolP ("tree" , "t" , false , treeShort )
128+ cmdCPU .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
120129 addCommonFlags (cmdCPU )
121130 rootCmd .AddCommand (cmdCPU )
122131
@@ -138,6 +147,8 @@ func InitSubCommands(rootCmd *cobra.Command) {
138147 }
139148 KubernetesConfigFlags .AddFlags (cmdEnvironment .Flags ())
140149 cmdEnvironment .Flags ().BoolP ("translate" , "" , false , "read the configmap show its values" )
150+ cmdEnvironment .Flags ().BoolP ("tree" , "t" , false , treeShort )
151+ cmdEnvironment .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
141152 addCommonFlags (cmdEnvironment )
142153 rootCmd .AddCommand (cmdEnvironment )
143154
@@ -149,7 +160,7 @@ func InitSubCommands(rootCmd *cobra.Command) {
149160 Example : fmt .Sprintf (ipExample , rootCmd .CommandPath ()),
150161 // SuggestFor: []string{""},
151162 RunE : func (cmd * cobra.Command , args []string ) error {
152- if err := IP (cmd , KubernetesConfigFlags , args ); err != nil {
163+ if err := Ports (cmd , KubernetesConfigFlags , args , true ); err != nil {
153164 return err
154165 }
155166
@@ -178,6 +189,8 @@ func InitSubCommands(rootCmd *cobra.Command) {
178189 }
179190 KubernetesConfigFlags .AddFlags (cmdImage .Flags ())
180191 cmdImage .Flags ().BoolP ("id" , "" , false , "Show running containers id" )
192+ cmdImage .Flags ().BoolP ("tree" , "t" , false , treeShort )
193+ cmdImage .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
181194 addCommonFlags (cmdImage )
182195 rootCmd .AddCommand (cmdImage )
183196
@@ -198,6 +211,8 @@ func InitSubCommands(rootCmd *cobra.Command) {
198211 },
199212 }
200213 KubernetesConfigFlags .AddFlags (cmdLifecycle .Flags ())
214+ cmdLifecycle .Flags ().BoolP ("tree" , "t" , false , treeShort )
215+ cmdLifecycle .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
201216 addCommonFlags (cmdLifecycle )
202217 rootCmd .AddCommand (cmdLifecycle )
203218
@@ -223,6 +238,8 @@ func InitSubCommands(rootCmd *cobra.Command) {
223238 cmdMemory .Flags ().BoolP ("oddities" , "" , false , odditiesShort )
224239 cmdMemory .Flags ().BoolP ("raw" , "r" , false , "show raw values" )
225240 cmdMemory .Flags ().String ("size" , "Mi" , sizeShort )
241+ cmdMemory .Flags ().BoolP ("tree" , "t" , false , treeShort )
242+ cmdMemory .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
226243 addCommonFlags (cmdMemory )
227244 rootCmd .AddCommand (cmdMemory )
228245
@@ -235,14 +252,17 @@ func InitSubCommands(rootCmd *cobra.Command) {
235252 Aliases : []string {"port" , "po" },
236253 // SuggestFor: []string{""},
237254 RunE : func (cmd * cobra.Command , args []string ) error {
238- if err := Ports (cmd , KubernetesConfigFlags , args ); err != nil {
255+ if err := Ports (cmd , KubernetesConfigFlags , args , false ); err != nil {
239256 return err
240257 }
241258
242259 return nil
243260 },
244261 }
245262 KubernetesConfigFlags .AddFlags (cmdPorts .Flags ())
263+ cmdPorts .Flags ().BoolP ("tree" , "t" , false , treeShort )
264+ cmdPorts .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
265+ cmdPorts .Flags ().BoolP ("show-ip" , "" , false , showIPShort )
246266 addCommonFlags (cmdPorts )
247267 rootCmd .AddCommand (cmdPorts )
248268
@@ -263,6 +283,8 @@ func InitSubCommands(rootCmd *cobra.Command) {
263283 },
264284 }
265285 KubernetesConfigFlags .AddFlags (cmdProbes .Flags ())
286+ cmdProbes .Flags ().BoolP ("tree" , "t" , false , treeShort )
287+ cmdProbes .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
266288 addCommonFlags (cmdProbes )
267289 rootCmd .AddCommand (cmdProbes )
268290
@@ -285,6 +307,8 @@ func InitSubCommands(rootCmd *cobra.Command) {
285307 }
286308 KubernetesConfigFlags .AddFlags (cmdRestart .Flags ())
287309 cmdRestart .Flags ().BoolP ("oddities" , "" , false , odditiesShort )
310+ cmdRestart .Flags ().BoolP ("tree" , "t" , false , treeShort )
311+ cmdRestart .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
288312 addCommonFlags (cmdRestart )
289313 rootCmd .AddCommand (cmdRestart )
290314
@@ -306,6 +330,8 @@ func InitSubCommands(rootCmd *cobra.Command) {
306330 }
307331 KubernetesConfigFlags .AddFlags (cmdSecurity .Flags ())
308332 cmdSecurity .Flags ().BoolP ("selinux" , "" , false , "show the SELinux context thats applied to the containers" )
333+ cmdSecurity .Flags ().BoolP ("tree" , "t" , false , treeShort )
334+ cmdSecurity .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
309335 addCommonFlags (cmdSecurity )
310336 rootCmd .AddCommand (cmdSecurity )
311337
@@ -333,6 +359,8 @@ func InitSubCommands(rootCmd *cobra.Command) {
333359 cmdStatus .Flags ().BoolP ("oddities" , "" , false , odditiesShort )
334360 cmdStatus .Flags ().BoolP ("previous" , "p" , false , "Show previous state" )
335361 cmdStatus .Flags ().BoolP ("id" , "" , false , "Show running containers id" )
362+ cmdStatus .Flags ().BoolP ("tree" , "t" , false , treeShort )
363+ cmdStatus .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
336364 // TODO: check if I can add labels for service/replicaset/configmap etc.
337365 addCommonFlags (cmdStatus )
338366 rootCmd .AddCommand (cmdStatus )
@@ -366,6 +394,8 @@ func InitSubCommands(rootCmd *cobra.Command) {
366394 }
367395 KubernetesConfigFlags .AddFlags (cmdVolume .Flags ())
368396 cmdVolume .Flags ().BoolP ("device" , "d" , false , "show raw block device mappings within a container" )
397+ cmdVolume .Flags ().BoolP ("tree" , "t" , false , treeShort )
398+ cmdVolume .Flags ().BoolP ("node-tree" , "" , false , nodetreeShort )
369399 addCommonFlags (cmdVolume )
370400 rootCmd .AddCommand (cmdVolume )
371401
@@ -385,8 +415,6 @@ func addCommonFlags(cmdObj *cobra.Command) {
385415 cmdObj .Flags ().BoolP ("show-node" , "" , false , `Show the node name column` )
386416 cmdObj .Flags ().BoolP ("show-type" , "T" , false , `Show the container type column, where:
387417 I=init container, C=container, E=ephemerial container, P=Pod, D=Deployment, R=ReplicaSet, A=DaemonSet, S=StatefulSet, N=Node` )
388- cmdObj .Flags ().BoolP ("tree" , "t" , false , `Display tree like view instead of the standard list` )
389- cmdObj .Flags ().BoolP ("node-tree" , "" , false , `Displayes the tree with the nodes as the root` )
390418 cmdObj .Flags ().StringP ("node-label" , "" , "" , `Show the selected node label as a column` )
391419 cmdObj .Flags ().StringP ("pod-label" , "" , "" , `Show the selected pod label as a column` )
392420 cmdObj .Flags ().StringP ("annotation" , "" , "" , `Show the selected annotation as a column` )
0 commit comments