Skip to content

Conversation

@wking
Copy link
Contributor

@wking wking commented Oct 12, 2016

So you can describe what the application is for without requiring users to drill down into a particular command.

If this idea sounds usefull, I can add a test-case to this PR.

So you can describe what the application is for without requiring
users to drill down into a particular command.
@jszwedko
Copy link
Contributor

Hi @wking,

This was the intention of the Usage field -- do you have an example use case that might better show the distinction you are making here?

Thank you!

@wking
Copy link
Contributor Author

wking commented Oct 19, 2016

On Tue, Oct 18, 2016 at 08:28:11PM -0700, Jesse Szwedko wrote:

This was the intention of the Usage field -- do you have an
example use case that might better show the distinction you are
making here?

CommandHelpTemplate (vs. AppHelpTemplate) has separate USAGE and
DESCRIPTION sections. I'm just proposing App allow the same
distinction. And man(1) has 1:

Conventional section names include NAME, SYNOPSIS, CONFIGURATION,
DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUE, ERRORS,
ENVIRONMENT, FILES, VERSIONS, CONFORMING TO, NOTES, BUGS, EXAMPLE,
AUTHORS, and SEE ALSO.

Help generated by this package uses “USAGE” instead of “SYNOPSIS”, but
clearly distinguishing between invocation templates and plain text
discriptions is a fairly standard thing.

One benefit of the distinction is that you will be able to put plain
text in App.Description while still relying on the auto-generated
USAGE entries which would have been clobbered had you set
App.UsageText.

@jszwedko
Copy link
Contributor

@wking aha, I see! I missed that Command already allows for this. Do you mind adding a test for this? Otherwise I think it looks great.

wking added 2 commits October 22, 2016 15:58
This code initially landed with lots of space:

  '{name}  <{email}> '

or:

  '{name} '

in 3d71833 (app, help: add support for multiple authors, 2015-01-31).
The doubled space between the name and email was removed in c6592bb
(app, help: add backwards compatibility for Authors, 2015-02-21), but
a trailing space remained in both the email and email-less cases.
This commit removes that trailing space.
Most of the changes here remove trailing whitespace, but I also add
code to select "AUTHOR" or "AUTHORS" as appropriate instead of the
previous "AUTHOR(S)".  The template for listing with an entry per line
is:

   {{range $index, $entry := pipeline}}{{if $index}}
   {{end}}{{$entry}}{{end}}

That range syntax is discussed in [1].

Also add a unit test, which tests both these whitespace changes and
also the earlier App.Description addition.

[1]: https://golang.org/pkg/text/template/#hdr-Variables
@wking
Copy link
Contributor Author

wking commented Oct 22, 2016

Test added (along with some whitespace fixups in AppHelpTemplate and Author.String) with c4a46a73c2bce5.

@jszwedko
Copy link
Contributor

This looks great, thank you for adding the tests @wking

@jszwedko jszwedko merged commit f614c17 into urfave:master Oct 26, 2016
wking added a commit to wking/ocitools-v2 that referenced this pull request Oct 26, 2016
This just landed via [1] (hence the bump to an untagged commit).
Generated with:

  $ godep update github.com/urfave/cli
  $ git add -A Godeps

[1]: urfave/cli#543

Signed-off-by: W. Trevor King <[email protected]>
@wking wking deleted the app-description branch November 2, 2016 16:50
wking added a commit to wking/ocitools-v2 that referenced this pull request Nov 22, 2016
This just landed via [1] (hence the bump to an untagged commit).
Generated with:

  $ godep update github.com/urfave/cli
  $ git add -A Godeps

[1]: urfave/cli#543

Signed-off-by: W. Trevor King <[email protected]>
wking added a commit to wking/ocitools-v2 that referenced this pull request Nov 22, 2016
This landed via [1] which was released with v1.19.0.  Bump to the most
recent release to get the .1 bugfixes too [2].  Generated with:

  $ godep update github.com/urfave/cli
  $ git add -A Godeps

[1]: urfave/cli#543
[2]: https://github.com/urfave/cli/blob/v1.19.1/CHANGELOG.md#1191---2016-11-21

Signed-off-by: W. Trevor King <[email protected]>
wking added a commit to wking/ocitools-v2 that referenced this pull request Nov 23, 2016
This landed via [1] which was released with v1.19.0.  Bump to the most
recent release to get the .1 bugfixes too [2].  Generated with:

  $ godep update github.com/urfave/cli
  godep: WARNING: Godep workspaces (./Godeps/_workspace) are deprecated and support for them will be removed when go1.8 is released.
  godep: WARNING: Go version (go1.7) & $GO15VENDOREXPERIMENT= wants to enable the vendor experiment, but disabling because a Godep workspace (Godeps/_workspace) exists
  $ git add -A Godeps

[1]: urfave/cli#543
[2]: https://github.com/urfave/cli/blob/v1.19.1/CHANGELOG.md#1191---2016-11-21

Signed-off-by: W. Trevor King <[email protected]>
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.

2 participants