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

Wrong fish completion is generated if the help description of the value has the comma #4153

Closed
2 tasks done
sorairolake opened this issue Aug 31, 2022 · 0 comments · Fixed by #4174
Closed
2 tasks done
Labels
A-completion Area: completion generator C-bug Category: Updating dependencies E-easy Call for participation: Experience needed to fix: Easy / not much

Comments

@sorairolake
Copy link

sorairolake commented Aug 31, 2022

Please complete the following tasks

Rust Version

1.63.0

Clap Version

3.2.18

Minimal reproducible code

use std::io;

use clap::{CommandFactory, Parser, ValueEnum};
use clap_complete::Shell;

#[derive(Parser)]
struct Opt {
    /// Help message.
    #[clap(long, value_enum)]
    arg: Value,
}

#[derive(Clone, ValueEnum)]
pub enum Value {
    /// Alice and Bob.
    Foo,

    /// Carol, a third participant.
    Bar,
}

fn main() {
    clap_complete::generate(Shell::Fish, &mut Opt::command(), "test", &mut io::stdout());
}

Steps to reproduce the bug with the above code

cargo run

Actual Behaviour

The following completions are generated:

complete -c test -l arg -d 'Help message' -r -f -a "{foo        Alice and Bob,bar       Carol, a third participant}"
complete -c test -s h -l help -d 'Print help information'

Expected Behaviour

The comma in the help description should be escaped:

complete -c test -l arg -d 'Help message' -r -f -a "{foo        Alice and Bob,bar       Carol\, a third participant}"
complete -c test -s h -l help -d 'Print help information'

Additional Context

  • clap_complete: 3.2.4

Debug Output

No response

@sorairolake sorairolake added the C-bug Category: Updating dependencies label Aug 31, 2022
@epage epage added A-completion Area: completion generator E-easy Call for participation: Experience needed to fix: Easy / not much labels Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion Area: completion generator C-bug Category: Updating dependencies E-easy Call for participation: Experience needed to fix: Easy / not much
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants