#6537·clap

bash: filename completion splits paths with spaces unless ValueHint::FilePath

Author: MegaManSecCreated Sep 27, 2026Updated Sep 27, 2026
LabelsC-bugS-triage

Please complete the following tasks

Rust Version

1.98

Clap Version

4.6.11

Minimal reproducible code

use clap::{Arg, Command, ValueHint};
use clap_complete::{generate, shells::Bash};

fn main() {
    let mut cmd = Command::new("app")
        .arg(Arg::new("path").long("path").value_hint(ValueHint::AnyPath));
    generate(Bash, &mut cmd, "app", &mut std::io::stdout());
}

Steps to reproduce the bug with the above code

Then run touch 'foo bar.txt', source <(cargo run), and then type app --path f and press tab twice.

Actual Behaviour

It suggests foo and bar.txt

Expected Behaviour

Suggest 'foo bar.txt'.

Additional Context

No response

Debug Output

No response