argh icon indicating copy to clipboard operation
argh copied to clipboard

Garbles help text when subcommand follows a positional argument

Open vi opened this issue 4 years ago • 1 comments

/// ...
#[derive(argh::FromArgs)]
struct Opts {
    #[argh(positional)]
    dbpath: PathBuf,

    #[argh(subcommand)]
    cmd: Cmd,
}

/// Outout entire content of the database to text file, stdout (suitable for migrations)
#[derive(argh::FromArgs)]
#[argh(subcommand, name = "export")]
struct Export {}

/// Import entire content of the database from text file, stdin (suitable for migrations)
#[derive(argh::FromArgs)]
#[argh(subcommand, name = "import")]
struct Import {}

#[derive(argh::FromArgs)]
#[argh(subcommand)]
enum Cmd {
    Export(Export),
    Import(Import),
}
Required positional arguments not provided:
    dbpathOne of the following subcommands must be present:
    help
    export
    import

vi avatar Jan 05 '21 16:01 vi

Also subcommand's help text omits dbpath, as if the subcommand came immediately after the program's name.

vi avatar Jan 10 '21 01:01 vi