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

Default help and completion command descriptions are inconsistent #1458

Closed
brianstrauch opened this issue Jul 18, 2021 · 5 comments · Fixed by #1455
Closed

Default help and completion command descriptions are inconsistent #1458

brianstrauch opened this issue Jul 18, 2021 · 5 comments · Fixed by #1455

Comments

@brianstrauch
Copy link

brianstrauch commented Jul 18, 2021

As of v1.2.0, there are two commands that are included by default in every Cobra CLI. Their formatting is inconsistent, which is incredibly sloppy, especially considering that their descriptions can't be changed; to my knowledge these commands can only be hidden.

First, one Short description is uppercased, and one is lowercased. Recommendation: Make them both uppercase.

Available Commands:
  completion  generate the autocompletion script for the specified shell
  help        Help about any command

Second, one Long description has an extra leading newline, and the other does not. Recommendation: Remove the extra newline.

$ cmd completion -h

Generate the autocompletion script for spotify for the specified shell.
See each sub-command's help for details on how to use the generated script.

...
$ cmd help -h
Help provides help for any command in the application.
Simply type cmd help [path to command] for full details.

...

In conclusion, it looks like the new completion command did not even attempt to maintain consistent formatting. A good long term solution would be to allow users to edit these descriptions to match their preferred style.

@marckhouzam
Copy link
Collaborator

This is my fault. The inconsistency comes from the fact that I based the command on helm's completion command which formats it's command texts differently.

1- #1455 fixes the capitalization
2- for the extra empty line, it would be worth suggesting it in #1455 or posting another PR
3- I was thinking it may be a good idea to make the default completion commands easily accessible so that some of its fields could be overridden

@jxsl13
Copy link

jxsl13 commented Aug 12, 2021

is it possible to remove those parenthesis around command completion descriptions or replace them with your own description prefix/suffix?

@marckhouzam
Copy link
Collaborator

is it possible to remove those parenthesis around command completion descriptions or replace them with your own description prefix/suffix?

Currently no, but it wouldn't be difficulty to make the format configurable for bash v2 and PowerShell. Note that for zsh and fish the description format is handled by the shell.

@github-actions
Copy link

This issue is being marked as stale due to a long period of inactivity

@invidian
Copy link

invidian commented Nov 2, 2021

Not stale as we have #1455.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants