Skip to content

Commit

Permalink
improved description of cmd line help for all commands
Browse files Browse the repository at this point in the history
  • Loading branch information
NimbleArchitect committed Mar 17, 2022
1 parent d046b7e commit cb40e55
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 20 deletions.
16 changes: 12 additions & 4 deletions cmd/plugin/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@ import (
// auto updated version via gorelaser
var version = "0.0.0"

var rootShort = "View pod information at the container level"

var rootDescription = ` Ice lets you view configuration and settings of the containers that run inside pods.
Suggestions and improvements can be made by raising an issue here:
https://github.com/NimbleArchitect/kubectl-ice
`

func RootCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "kubectl-ice",
Short: "view container settings",
Long: `ice lets you view configuration settings of containers inside pods.
you can run ice through kubectl with: kubectl ice [command]`,
Use: "kubectl-ice",
Short: rootShort,
Long: fmt.Sprintf("%s\n\n%s", rootShort, rootDescription),
SilenceErrors: true,
SilenceUsage: true,
Version: version,
Expand Down
6 changes: 5 additions & 1 deletion pkg/plugin/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import (

var commandsShort = "Retrieves the command line and any arguments specified at the container level"

var commandsDescription = `.`
var commandsDescription = ` Prints command and arguments used to start each container (if specified), single pods and
containers can be selected by name. If no name is specified the container commands of all pods
in the current namespace are shown.
The T column in the table output denotes S for Standard and I for init containers`

var commandsExample = ` # List containers command info from pods
%[1]s command
Expand Down
8 changes: 6 additions & 2 deletions pkg/plugin/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
)

var imageShort = "list the image name and pull status for each container"
var imageShort = "List the image name and pull status for each container"

var imageDescription = `.`
var imageDescription = ` Print the the image used for running containers in a pod including the pull policy, single pods
and containers can be selected by name. If no name is specified the image details of all pods in
the current namespace are shown.
The T column in the table output denotes S for Standard and I for init containers`

var imageExample = ` # List containers image info from pods
%[1]s image
Expand Down
5 changes: 3 additions & 2 deletions pkg/plugin/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
)

var ipShort = "list ip addresses of all pods in the namespace listed"
var ipShort = "List ip addresses of all pods in the namespace listed"

var ipDescription = `.`
var ipDescription = ` Prints the known IP addresses of the specified pod(s). if no pod is specified the IP address of
all pods in the current namespace are shown.`

var ipExample = ` # List IP address of pods
%[1]s ip
Expand Down
8 changes: 6 additions & 2 deletions pkg/plugin/ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
)

var portsShort = "shows ports exposed by the containers in a pod"
var portsShort = "Shows ports exposed by the containers in a pod"

var portsDescription = `.`
var portsDescription = ` Print a details of service ports exposed by containers in a pod. Details include the container
name, port number and protocol type. Port name and host port are only show if avaliable. If no
name is specified the container port details of all pods in the current namespace are shown.
The T column in the table output denotes S for Standard and I for init containers`

var portsExample = ` # List containers port info from pods
%[1]s ports
Expand Down
7 changes: 5 additions & 2 deletions pkg/plugin/probes.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
)

var probesShort = "hows details of configured startup, readiness and liveness probes of each container"
var probesShort = "Shows details of configured startup, readiness and liveness probes of each container"

var probesDescription = `.`
var probesDescription = ` Prints details of the currently configured startup, liveness and rediness probes for each
container. Details like the delay timeout and action are printed along with the configured probe
type. If no name is specified the container probe details of all pods in the current namespace
are shown.`

var probesExample = ` # List containers probe info from pods
%[1]s probes
Expand Down
9 changes: 7 additions & 2 deletions pkg/plugin/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ import (

// returns a string replacing %[1] with the resourse type r
func resourceShort(r string) string {
return fmt.Sprintf("return %[1]s requests size, limits and usage of each container", r)
return fmt.Sprintf("Show configured %[1]s size, limit and %% usage of each container", r)
}

// returns a string replacing %[1] with the resourse type r
func resourceDescription(r string) string {
return fmt.Sprintf("Shows current %[1]s usage ", r)
return fmt.Sprintf(` Prints the current %[1]s usage along with configured requests and limits. The calculated %% fields
serve as an easy way to see how close you are to the configured sizes. By specifying the -r
flag you can see raw unfiltered values. If no name is specified the container %[1]s details
of all pods in the current namespace are shown.
The T column in the table output denotes S for Standard and I for init containers`, r)
}

// returns a string replacing %[2] with the resourse type r
Expand Down
7 changes: 5 additions & 2 deletions pkg/plugin/restarts.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
)

var restartsShort = "show restart counts for each container in a named pod"
var restartsShort = "Show restart counts for each container in a named pod"

var restartsDescription = `.`
var restartsDescription = ` Prints container name and restart count for individual containers. If no name is specified the
container restart counts of all pods in the current namespace are shown.
The T column in the table output denotes S for Standard and I for init containers`

var restartsExample = ` # List individual container restart count from pods
%[1]s restarts
Expand Down
9 changes: 7 additions & 2 deletions pkg/plugin/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ import (
"k8s.io/cli-runtime/pkg/genericclioptions"
)

var statusShort = "list status of each container in a pod"
var statusShort = "List status of each container in a pod"

var statusDescription = `.`
var statusDescription = ` Prints container status information from pods, current and previous exit code, reason and signal
are shown slong with current ready and running state. Pods and containers can also be selected
by name. If no name is specified the container state of all pods in the current namespace is
shown.
The T column in the table output denotes S for Standard and I for init containers`

var statusExample = ` # List individual container status from pods
%[1]s status
Expand Down
5 changes: 4 additions & 1 deletion pkg/plugin/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import (

var volumesShort = "Display container volumes and mount points"

var volumesDescription = `.`
var volumesDescription = ` Prints configured volume information at the container level, volume type, backing information,
read-write state and mount point are all avaliable, volume size is only available if found in
the pod configuration. If no name is specified the volume information for all pods in the
current namespace are shown.`

var volumesExample = ` # List volumes from containers inside pods from current namespace
%[1]s volumes
Expand Down

0 comments on commit cb40e55

Please sign in to comment.