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

Document positional args in help text #43

Merged
merged 15 commits into from
Aug 7, 2018
Merged

Document positional args in help text #43

merged 15 commits into from
Aug 7, 2018

Conversation

zzak
Copy link
Contributor

@zzak zzak commented Aug 5, 2018

Using a combination of the default UsageTemplate from cobra, and a custom function which we've added to cobra template, we can create our own template which will display args in the help text for commands that have annotations (which are documented here as a map[string]string).

This PR was created on top of #40 in hopes that will be merged first, and we can preview it's changes on this branch. Once that PR is merged, we can rebase this one and it should merge cleanly into master.

Demo

Here's the help text for a command without args:

$ go run main.go help namespace

Operate on namespaces


Usage:
  circleci namespace [command]

Available Commands:
  create      create a namespace

Flags:
  -h, --help   help for namespace

Here's the help text for a command with args:

$ go run main.go help namespace create
create a namespace


Usage:
  circleci namespace create NAME VCS-TYPE ORG-NAME [flags]

Args:
  ORG-NAME    The name used for your organization
  VCS-TYPE    Your VCS provider, can be either "github" or "bitbucket"

Flags:
  -h, --help   help for create

@codecov-io
Copy link

Codecov Report

Merging #43 into master will increase coverage by 1.29%.
The diff coverage is 41.58%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #43      +/-   ##
==========================================
+ Coverage   39.17%   40.47%   +1.29%     
==========================================
  Files          13       13              
  Lines         878      877       -1     
==========================================
+ Hits          344      355      +11     
+ Misses        510      498      -12     
  Partials       24       24
Impacted Files Coverage Δ
cmd/build.go 38.94% <ø> (+4.61%) ⬆️
cmd/namespace.go 62.16% <100%> (+4.58%) ⬆️
cmd/update.go 26.31% <17.64%> (-4.84%) ⬇️
cmd/query.go 25.92% <27.27%> (-4.08%) ⬇️
cmd/config.go 43.03% <33.33%> (+1.78%) ⬆️
cmd/orb.go 27.11% <62.5%> (+3.06%) ⬆️
cmd/root.go 73.68% <66.66%> (-0.83%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ed68ed1...263746b. Read the comment docs.

@marcomorain marcomorain merged commit 2469a8d into master Aug 7, 2018
@marcomorain marcomorain deleted the help-args branch August 7, 2018 11:22
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 this pull request may close these issues.

3 participants