Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: Add flag groups to make help output more readable #935

Open
blanquicet opened this issue Sep 9, 2022 · 1 comment
Open

cli: Add flag groups to make help output more readable #935

blanquicet opened this issue Sep 9, 2022 · 1 comment
Labels
area/ig `ig` tool area/kubectl-gadget lifecycle/staleproof Avoid this issue / PR being marked as stale by the bot.

Comments

@blanquicet
Copy link
Member

Current situation

When running kubectl-gadget <cat> <gadget> --help the list of flags is quite long and it is not easy to distinguish which flags are specific for that gadget and what are general.

For instance, the following is the output of the bind trace gadget, but it is not easy to identify that --pid, --ports and --ingore-errors are specific for this gadget. In addition, Global Flags is too generic, it could be something like Kubernetes Flags?

$ kubectl-gadget trace bind --help
Trace the kernel functions performing socket binding

Usage:
  kubectl-gadget trace bind [flags]

Flags:
  -A, --all-namespaces         Show data from pods in all namespaces
  -c, --containername string   Show only data from containers with that name
  -h, --help                   help for bind
  -i, --ignore-errors          Show only events where the bind succeeded (default true)
      --node string            Show only data from pods running in that node
  -o, --output string          Output format (columns, json, custom-columns). (default "columns")
      --pid int32              Show only bind events generated by this particular PID
  -p, --podname string         Show only data from pods with that name
  -P, --ports uints            Trace only bind events involving these ports (default [])
  -l, --selector string        Labels selector to filter on. Only '=' is supported (e.g. key1=value1,key2=value2).
      --timeout int            Number of seconds that the gadget will run for
      --verbose                Print additional information

Global Flags:
      --as string                      Username to impersonate for the operation
      --as-group stringArray           Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --cache-dir string               Default cache directory (default "/home/jose/.kube/cache")
     ...

Ideal future situation

For instance, the flags could be divided into groups like this:

$ kubectl-gadget trace bind --help
Trace the kernel functions performing socket binding

Usage:
kubectl-gadget trace bind [flags]

Gadget Filtering Flags:
  -i, --ignore-errors          Show only events where the bind succeeded (default true)
      --pid int32              Show only bind events generated by this particular PID
  -P, --ports uints            Trace only bind events involving these ports (default [])

Gadget General Flags:
  -h, --help                   help for bind
  -o, --output string          Output format (columns, json, custom-columns). (default "columns")
      --timeout int            Number of seconds that the gadget will run for
      --verbose                Print additional information

Kubernetes Filtering Flags:
  -A, --all-namespaces         Show data from pods in all namespaces
  -c, --containername string   Show only data from containers with that name
      --node string            Show only data from pods running in that node
  -p, --podname string         Show only data from pods with that name
  -l, --selector string        Labels selector to filter on. Only '=' is supported (e.g. key1=value1,key2=value2).

Kubernetes Configuration Flags:
      --as string                      Username to impersonate for the operation
      --as-group stringArray           Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --cache-dir string               Default cache directory (default "/home/jose/.kube/cache")
      ...

Notice it is just an example. This issue aims to start the discussion about how they could be divided and how to do that.

Implementation details:

This feature doesn't exist yet in cobra. However, the discussion was already opened, and a proposal was already made.

Copy link

github-actions bot commented Mar 7, 2024

This issue has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.

@github-actions github-actions bot added the lifecycle/stale Marked to be closed in next 14 days because of inactivity. label Mar 7, 2024
@mauriciovasquezbernal mauriciovasquezbernal added lifecycle/staleproof Avoid this issue / PR being marked as stale by the bot. and removed lifecycle/stale Marked to be closed in next 14 days because of inactivity. labels Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ig `ig` tool area/kubectl-gadget lifecycle/staleproof Avoid this issue / PR being marked as stale by the bot.
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants