File completions from a positional always show while completing a flag with a custom impl
ozwaldorf opened this issue · 5 comments
ozwaldorf commented
With a flag parser like so:
https://github.com/ozwaldorf/lutgen-rs/blob/b510e80f0c48d8807a20812b6fc2a9971297d8e4/src/bin.rs#L83-L96
pub fn flag_parser() -> impl Parser<Self> {
long("palette")
.short('p')
.argument::<String>("PALETTE")
.help(Self::HELP)
.complete(|v| {
DynamicPalette::suggestions(v)
.into_iter()
.map(|(_, name)| (name, None))
.collect()
})
.parse(|s| DynamicPalette::from_str(&s))
}
And a positional parser that uses complete shell:
https://github.com/ozwaldorf/lutgen-rs/blob/b510e80f0c48d8807a20812b6fc2a9971297d8e4/src/bin.rs#L537-L545
/// Images to correct, using the generated or provided hald clut.
#[bpaf(
positional("IMAGES"),
non_strict,
guard(|v| v.exists(), "No such file or directory"),
complete_shell(ShellComp::File { mask: Some(IMAGE_GLOB) }),
some("At least one image is needed to apply"),
)]
input: Vec<PathBuf>,
Completions for the input positional always show, even when flag (palette) completions should only be shown:
● lutgen apply docs/example-image.jpg -p <TAB>
PALETTE <--- palette completions
directory <--- file completions
benches/ docs/ palettes/ result@ src/ target/
ozwaldorf commented
I think #337 fixes it, started reviving it already. Hopefully soon.
Awesome, looking forward to testing the changes
ozwaldorf commented
pacak commented
Oh noes! I forgor to release!!!! 💀