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

Less hidden aliases #522

Closed
joshtriplett opened this issue Jun 6, 2016 · 4 comments
Closed

Less hidden aliases #522

joshtriplett opened this issue Jun 6, 2016 · 4 comments
Labels
C-enhancement Category: Raise on the bar on expectations
Milestone

Comments

@joshtriplett
Copy link
Contributor

.alias creates a hidden subcommand. For user convenience, I'd like to create an un-hidden subcommand, shown in help (with a help string like "alias for othercmd").

@kbknapp
Copy link
Member

kbknapp commented Jun 6, 2016

Interesting, I hadn't thought about that, but I like it. It'd be an easy addition. What would you call it? synonym, visible_alias? I'm open to ideas.

@kbknapp kbknapp added C-enhancement Category: Raise on the bar on expectations T: new feature labels Jun 6, 2016
@joshtriplett
Copy link
Contributor Author

I don't think synonym accurately conveys the distinction; if I saw functions for both alias and synonym, I couldn't guess at a glance about the distinction between them.

I'd suggest something explicit, like visible_alias.

@kbknapp kbknapp added this to the 2.6.0 milestone Jun 8, 2016
@kbknapp
Copy link
Member

kbknapp commented Jun 10, 2016

This is implemented with #525

From the commit message:

This commit adds support for visible aliases, which function exactly like aliases except that they
also appear in the help message, using the help string of the aliased subcommand.

i.e.

App::new("myprog")
    .subcommand(SubCommand::with_name("test")
        .about("does testy things")
        .alias("invisible")
        .visible_alias("visible"));

When run with myprog --help, the output is:

myprog

USAGE:
    myprog [FLAGS] [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    help            Prints this message or the help of the given subcommand(s)
    test|visible    does testy things

@kbknapp
Copy link
Member

kbknapp commented Jun 10, 2016

Once #451 is implemented I'll update to 2.6.0 and upload to crates.io. So I'm hoping by tomorrow 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

No branches or pull requests

2 participants