Skip to content

clap_generate fish: ArgEnum completions not working on toplevel command #2729

@ModProg

Description

@ModProg

Rust Version

rustc 1.54.0 (a178d0322 2021-07-26)

Clap Version

master

Minimal reproducible code

use clap::{ArgEnum, Clap, IntoApp};
use clap_generate::generators;

fn main() {
    clap_generate::generate::<generators::Fish, _>(
        &mut App::into_app(),
        "clap-issue",
        &mut std::io::stdout(),
    );
}

#[derive(Clap)]
struct App {
    #[clap(arg_enum)]
    arg: A,
}


#[derive(ArgEnum)]
enum A {
    A,
    B,
}

Steps to reproduce the bug with the above code

cargo run

Actual Behaviour

complete -c clap-issue -s h -l help -d 'Print help information'
complete -c clap-issue -s V -l version -d 'Print version information'

Expected Behaviour

complete -c clap-issue -s h -l help -d 'Print help information'
complete -c clap-issue -s V -l version -d 'Print version information'
complete -c clap-issue -r -f -a "a b"

Additional Context

No response

Debug Output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-completionArea: completion generatorC-bugCategory: bugE-easyCall for participation: Experience needed to fix: Easy / not much

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions