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

Bash completion no longer completes arg possible_values #3697

Closed
2 tasks done
vincentdephily opened this issue May 6, 2022 · 1 comment · Fixed by #3698
Closed
2 tasks done

Bash completion no longer completes arg possible_values #3697

vincentdephily opened this issue May 6, 2022 · 1 comment · Fixed by #3698
Labels
C-bug Category: Updating dependencies

Comments

@vincentdephily
Copy link

Please complete the following tasks

Rust Version

1.60.0

Clap Version

3.1.16 (clap) 3.1.3 (clap_complete)

Minimal reproducible code

use clap::*;
use clap_complete::*;

fn main() {
    let mut cli = App::new("foo").arg(Arg::new("foo").long("foo").possible_values(&["bar", "baz"]));
    generate(Shell::Bash, &mut cli, "foo", &mut std::io::stdout());
}

Steps to reproduce the bug with the above code

cargo run | rg -C1 COMPREPLY

Actual Behaviour

                --foo)
                    COMPREPLY=($(compgen -W "" -- "${cur}"))
                    return 0

Expected Behaviour

                --foo)
                    COMPREPLY=($(compgen -W "bar baz" -- "${cur}"))
                    return 0

Additional Context

This is a regression introduced in clap_complete 3.1.1. Versions 3.1.0 and earlier (including 2.x series I'm currently upgrading from) are fine.

Debug Output

No response

@vincentdephily vincentdephily added the C-bug Category: Updating dependencies label May 6, 2022
epage added a commit to epage/clap that referenced this issue May 6, 2022
In a refactor for clap-rs#3503, one of the checks for `is_hide_set` got flipped
and we are completing hidden `PossibleValue`s rather than visible.

Fixes clap-rs#3697
vincentdephily added a commit to vincentdephily/emlop that referenced this issue May 6, 2022
* The API changes are a mixed bag but look good overall
* Had to swap the failure exit codes (as clap now `exit(1)` instead of 2)
  Keeping the old codes is possible, but doesn't seem worth the added complexity
  See clap-rs/clap#3426
* Stumbled upon one shell completion regression, so pining an old clap_complete version for now
  See clap-rs/clap#3697
* Subcommand completion no longer erroneously include `-V` and `--version`
* Help and diagnostic outputs seem a bit nicer
@epage
Copy link
Member

epage commented May 6, 2022

Fix released in v3.1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Updating dependencies
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants