Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Update cli usage template for cobra feature parity#1463

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mafredri merged 5 commits intomainfrommafredri/fix-cli-help
May 16, 2022

Conversation

mafredri
Copy link
Member

@mafredrimafredri commentedMay 16, 2022
edited
Loading

This PR updates the custom usage template for feature parity with the default template used in Cobra.

I've restored the custom heading names and colorization.

Changes:

  • We now display Usage properly for subcommands
  • We now display "Global Flags" for all commands
  • We now display "Aliases" for aliased commands
  • Flags moved below Commands as per standard Cobra template

This is partially related to#1233 and#1403, but as suggested by@jsjoeio, split into a separate PR.

Fixes#1423

Example:
image

jsjoeio reacted with hooray emoji
@mafredrimafredri self-assigned thisMay 16, 2022
@mafredrimafredri requested review fromammario,jsjoeio anda teamMay 16, 2022 08:32
Copy link
Member

@deansheatherdeansheather left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

syntax seems fine but if you could quickly tidy up the template that would be nice 👍

Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM as well, just some cleanup 👍

Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM. My bad for missing a few of these cases!

@Emyrk
Copy link
Member

Emyrk commentedMay 16, 2022
edited
Loading

How does the template not have excessive newlines when sections are omitted? Is there something cleaning that up?

The Cobra one has to put conditional blocks on the same line to (what I assume) prevent the extra newlines:https://github.com/spf13/cobra/blob/master/command.go#L502-L525

Copy link
Member

@EmyrkEmyrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ohh it's the{{- got it

mafredri reacted with thumbs up emoji
@mafredrimafredri merged commit6c1ef85 intomainMay 16, 2022
@mafredrimafredri deleted the mafredri/fix-cli-help branchMay 16, 2022 17:01
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@EmyrkEmyrkEmyrk approved these changes

@kylecarbskylecarbskylecarbs approved these changes

@deansheatherdeansheatherdeansheather approved these changes

@ammarioammarioAwaiting requested review from ammario

@jsjoeiojsjoeioAwaiting requested review from jsjoeio

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

coder state pull has useless help
5 participants
@mafredri@Emyrk@johnstcn@kylecarbs@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp