We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
rustc 1.23.0 (766bd11c8 2018-01-01)
2.29.0
There shouldn't be redundant code in the generated Zsh completion code.
There is some redundant code when there are no sub-commands.
Generated from the sample:
#compdef clap-test _clap-test() { typeset -A opt_args local ret=1 local context curcontext="$curcontext" state line _arguments -s -S -C \ '--completions[]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ && ret=0 } (( $+functions[_clap-test_commands] )) || _clap-test_commands() { local commands; commands=( ) _describe -t commands 'clap-test commands' commands "$@" } (( $+functions[_clap-test_commands] )) || _clap-test_commands() { local commands; commands=( ) _describe -t commands 'clap-test commands' commands "$@" } _clap-test "$@"
Notice the double _clap-test_commands part.
_clap-test_commands
cargo run -- --completions
extern crate clap; use std::io; use clap::{App, Arg, Shell}; fn build_cli() -> App<'static, 'static> { App::new("clap-test") .arg(Arg::with_name("completions") .long("completions")) } fn main() { let matches = build_cli().get_matches(); if matches.is_present("completions") { build_cli().gen_completions_to("clap-test", Shell::Zsh, &mut io::stdout()) } }
clap-debug.txt
The text was updated successfully, but these errors were encountered:
@segevfiner since you're already on a roll for these completions PRs, do you want to take a swing at this one? 😄
Sorry, something went wrong.
I probaby will 😉
fix(completions/zsh.zsh): Remove redundant code from output
659400c
Fixes clap-rs#1142
0e185b9
No branches or pull requests
Rust Version
rustc 1.23.0 (766bd11c8 2018-01-01)
Affected Version of clap
2.29.0
Expected Behavior Summary
There shouldn't be redundant code in the generated Zsh completion code.
Actual Behavior Summary
There is some redundant code when there are no sub-commands.
Generated from the sample:
Notice the double
_clap-test_commands
part.Steps to Reproduce the issue
cargo run -- --completions
.Sample Code or Link to Sample Code
Debug output
clap-debug.txt
The text was updated successfully, but these errors were encountered: