Clap 3: help format

Hi,

With the new clap I'm having this kind of help output:

    ...
    -v, --verbose
            Verbose output

    -V, --version
            Print version information

    -w, --overwrite
            Silently remove existing destination directory (not recommended)

    -x, --sort-lex
            Sort files lexicographically

    -y, --dry-run
            Without actually copying the files (trumps -w, too)
    ...

No big deal, yet I'd prefer the old two-column way, which is much more compact and suitable for my application. I checked AppSettings. Unfortunately, I can't see anything relevant. Is it really so?

1 Like

Clap makes a distinction between two different help texts, long_help() and help(), and two different requests for them, --help / multiline, and -h / single-line. Having just tried a couple things, it seems that it uses this multi-line format for --help if any of your options have long_help, and uses the single-line format if none of them do.

About help I've got all defaults. The help option isn't mentioned in the source code. long_help() never used. Source runs like this:

        ...
        .arg(
            Arg::new("v")
                .short('v')
                .long("verbose")
                .help("Verbose output"),
        )
        .arg(
            Arg::new("d")
                .short('d')
                .long("drop-tracknumber")
                .help("Do not set track numbers"),
        )
        ...

-h or --help makes no difference.

UPD

Yes, the docs make me think I should have one-line help, but I have what I have.

Looking at the code I believe it might also be checking the length of the help strings and use the long format if there are longer strings, but I haven’t experimented at all with it.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.