murarth / gumdrop

Rust option parser with custom derive support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Display positional arguments in 'usage' line.

nms-scribe opened this issue · comments

Right now, I have the following struct:

#[derive(Options)]
struct Arguments {

    /// print help message
    help: bool,    

    #[options(free,required)]
    /// The file to extract data from
    source: PathBuf,

    #[options(free,required)]
    /// The file to insert the data into
    target: PathBuf,
}

When I call the program with '--help', I get the following usage:

Usage: clitool [OPTIONS]

Positional arguments:
  source      The file to extract data from
  target      The file to insert the data into

Optional arguments:
  -h, --help  print help message

In almost every other command line tool on my system, that first line of Usage would be something like: Usage: clitool [OPTIONS] SOURCE TARGET.

Right now I have to duplicate the code from parse_args_or_exit in order to add this.

It would be nice if gumdrop did this automatically, or at least allowed me to customize the usage line.