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

add {before/after}_help_{short/long} to App struct #1903

Closed
2 tasks done
jeffka11 opened this issue May 3, 2020 · 1 comment · Fixed by #2008
Closed
2 tasks done

add {before/after}_help_{short/long} to App struct #1903

jeffka11 opened this issue May 3, 2020 · 1 comment · Fixed by #2008
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc...
Milestone

Comments

@jeffka11
Copy link

jeffka11 commented May 3, 2020

Make sure you completed the following tasks

Describe your use case

I'm looking to use the help menu to replace creating a separate man page. To not bombard users with info, I'd like to include detailed information when they use the long --help flag for sections that need more detail. As a random example of more detail, if you "man curl", you'll see sections at the end explaining error codes that you wouldn't see with "curl --help" and I think {before/after}help{short/long} would provide that location.

Describe the solution you'd like

let myapp = App::new("My App")
    .after_help("footer message")  // this already exists
    .before_help("header message")  // this already exists

    .after_help_short("a concise footer")  // proposal, could be redundant with after_help
    .after_help_long("a much longer footer")  // proposal
    .before_help_short("a short header")  // proposal, could be redundant with before_help
    .before_help_long("a verbose header")  // proposal

Alternatives, if applicable

make man pages or a hook into cargo doc from clap, although I think the suggested solution is easier.

@kbknapp
Copy link
Member

kbknapp commented May 4, 2020

I think this would be implemented as {after,before}_help_long and allow the current {before,after}_help serve as the short so that we don't have redundant APIs. This also would go along with the short somewhat being the default in clap as with all other settings that where both a long and short co-exist.

@pksunkara pksunkara added this to the 3.1 milestone May 5, 2020
@CreepySkeleton CreepySkeleton added A-help Area: documentation, including docs.rs, readme, examples, etc... D: easy labels Jun 30, 2020
Blaxar added a commit to Blaxar/clap that referenced this issue Jul 11, 2020
bors bot added a commit that referenced this issue Jul 19, 2020
2008: feat: Added {before/after}_help_long to App struct, closed #1903 r=pksunkara a=Blaxar



Co-authored-by: Blaxar Waldarax <[email protected]>
@bors bors bot closed this as completed in 748aea3 Jul 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc...
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants