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

Improve indentation of help #940

Closed
colin-kiegel opened this issue Feb 4, 2017 · 4 comments
Closed

Improve indentation of help #940

colin-kiegel opened this issue Feb 4, 2017 · 4 comments

Comments

@colin-kiegel
Copy link

I find the indentation of command like rustup override very confusing

$ rustup override
rustup-override 
Modify directory toolchain overrides

USAGE:
    rustup override [SUBCOMMAND]

FLAGS:
    -h, --help    Prints help information

SUBCOMMANDS:
    list     List directory toolchain overrides
    set      Set the override toolchain for a directory
    unset    Remove the override toolchain for a directory
    help     Prints this message or the help of the given subcommand(s)


Overrides configure rustup to use a specific toolchain when
running in a specific directory.

Directories can be assigned their own Rust toolchain with
`rustup override`. When a directory has an override then
any time `rustc` or `cargo` is run inside that directory,
or one of its child directories, the override toolchain
will be invoked.

To pin to a specific nightly:

    rustup override set nightly-2014-12-18

Or a specific stable release:

    rustup override set 1.0.0
$ _

At first glance it looks roughly like this

$ rustup override
      ... something indented
a lot of unindented text. a lot of text. a lot of text.
a lot of unindented text. a lot of text. a lot of text.
      ... something indented again
$ _

I find that extremely unreadable due to the mix of indented and unindented chunks.
I suggest to adopt the structure of a manpage, i.e. everything is indented except for headlines, which are uppercase.

The example above could look like this

$ rustup override
NAME:
    rustup-override

DESCRIPTION:
    Modify directory toolchain overrides

USAGE:
    rustup override [SUBCOMMAND]

FLAGS:
    -h, --help    Prints help information

SUBCOMMANDS:
    list     List directory toolchain overrides
    set      Set the override toolchain for a directory
    unset    Remove the override toolchain for a directory
    help     Prints this message or the help of the given subcommand(s)

DISCUSSION:
    Overrides configure rustup to use a specific toolchain when
    running in a specific directory.

    Directories can be assigned their own Rust toolchain with
    `rustup override`. When a directory has an override then
    any time `rustc` or `cargo` is run inside that directory,
    or one of its child directories, the override toolchain
    will be invoked.

    To pin to a specific nightly:

        rustup override set nightly-2014-12-18

    Or a specific stable release:

        rustup override set 1.0.0
$ _

=> Much better IMO. Now I can immediately see what belongs where. :-)
What do you think about this suggestion?

@brson
Copy link
Contributor

brson commented Mar 17, 2017

Good idea. Depends on the capabilities of clap. Patches welcome.

@brson brson changed the title indentation of help Improve indentation of help Mar 17, 2017
@kirillbobyrev
Copy link

I agree that this would be more readable.

@kbknapp any chance you would like to adopt such structure and improve output readability in clap? If so, I'd be willing to help.

@rap2hpoutre
Copy link
Contributor

@brson I checked clap docs, and did not found this sort of capability (there is only after_help which is already used). What do you think about just editing src/rustup-cli/help.rs and indent (with a DISCUSSION: title)? (anyway I'm not sure, maybe it's too quick and dirty). I could send a PR for this if you think it's OK.

@kbknapp
Copy link
Contributor

kbknapp commented Mar 29, 2017

I missed this issue somehow, apologies. clap doesn't support this per-se but this should work fine:

.after_help("\
DISCUSSION:
    Overrides configure rustup to use a specific toolchain when
    running in a specific directory.

    Directories can be assigned their own Rust toolchain with
    `rustup override`. When a directory has an override then
    any time `rustc` or `cargo` is run inside that directory,
    or one of its child directories, the override toolchain
    will be invoked.

    To pin to a specific nightly:

        rustup override set nightly-2014-12-18

    Or a specific stable release:

        rustup override set 1.0.0")

babbageclunk added a commit to babbageclunk/rustup.rs that referenced this issue Mar 30, 2017
bors added a commit that referenced this issue Apr 2, 2017
Indent help text

Add a DISCUSSION heading to each item and indent (and rewrap) the help text.

Fixes #940.
nodakai pushed a commit to nodakai/rustup.rs that referenced this issue Apr 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants