From fa955312300dd4d958496ddfffd21b89cae3d27c Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 28 Jul 2023 12:48:36 -0500 Subject: [PATCH 1/9] test(complete): Make room for alt completion styles --- .../snapshots/home/{ => static}/test/bash/.bashrc | 0 .../home/{ => static}/test/elvish/elvish/rc.elv | 0 .../{ => static}/test/fish/fish/completions/test.fish | 0 .../home/{ => static}/test/fish/fish/config.fish | 0 .../tests/snapshots/home/{ => static}/test/zsh/.zshenv | 0 .../snapshots/home/{ => static}/test/zsh/zsh/_test | 0 clap_complete/tests/testsuite/bash.rs | 4 ++-- clap_complete/tests/testsuite/common.rs | 10 ++++++++-- clap_complete/tests/testsuite/elvish.rs | 4 ++-- clap_complete/tests/testsuite/fish.rs | 4 ++-- clap_complete/tests/testsuite/zsh.rs | 4 ++-- 11 files changed, 16 insertions(+), 10 deletions(-) rename clap_complete/tests/snapshots/home/{ => static}/test/bash/.bashrc (100%) rename clap_complete/tests/snapshots/home/{ => static}/test/elvish/elvish/rc.elv (100%) rename clap_complete/tests/snapshots/home/{ => static}/test/fish/fish/completions/test.fish (100%) rename clap_complete/tests/snapshots/home/{ => static}/test/fish/fish/config.fish (100%) rename clap_complete/tests/snapshots/home/{ => static}/test/zsh/.zshenv (100%) rename clap_complete/tests/snapshots/home/{ => static}/test/zsh/zsh/_test (100%) diff --git a/clap_complete/tests/snapshots/home/test/bash/.bashrc b/clap_complete/tests/snapshots/home/static/test/bash/.bashrc similarity index 100% rename from clap_complete/tests/snapshots/home/test/bash/.bashrc rename to clap_complete/tests/snapshots/home/static/test/bash/.bashrc diff --git a/clap_complete/tests/snapshots/home/test/elvish/elvish/rc.elv b/clap_complete/tests/snapshots/home/static/test/elvish/elvish/rc.elv similarity index 100% rename from clap_complete/tests/snapshots/home/test/elvish/elvish/rc.elv rename to clap_complete/tests/snapshots/home/static/test/elvish/elvish/rc.elv diff --git a/clap_complete/tests/snapshots/home/test/fish/fish/completions/test.fish b/clap_complete/tests/snapshots/home/static/test/fish/fish/completions/test.fish similarity index 100% rename from clap_complete/tests/snapshots/home/test/fish/fish/completions/test.fish rename to clap_complete/tests/snapshots/home/static/test/fish/fish/completions/test.fish diff --git a/clap_complete/tests/snapshots/home/test/fish/fish/config.fish b/clap_complete/tests/snapshots/home/static/test/fish/fish/config.fish similarity index 100% rename from clap_complete/tests/snapshots/home/test/fish/fish/config.fish rename to clap_complete/tests/snapshots/home/static/test/fish/fish/config.fish diff --git a/clap_complete/tests/snapshots/home/test/zsh/.zshenv b/clap_complete/tests/snapshots/home/static/test/zsh/.zshenv similarity index 100% rename from clap_complete/tests/snapshots/home/test/zsh/.zshenv rename to clap_complete/tests/snapshots/home/static/test/zsh/.zshenv diff --git a/clap_complete/tests/snapshots/home/test/zsh/zsh/_test b/clap_complete/tests/snapshots/home/static/test/zsh/zsh/_test similarity index 100% rename from clap_complete/tests/snapshots/home/test/zsh/zsh/_test rename to clap_complete/tests/snapshots/home/static/test/zsh/zsh/_test diff --git a/clap_complete/tests/testsuite/bash.rs b/clap_complete/tests/testsuite/bash.rs index 38b05ea9..d28542a7 100644 --- a/clap_complete/tests/testsuite/bash.rs +++ b/clap_complete/tests/testsuite/bash.rs @@ -145,7 +145,7 @@ fn register_completion() { return; } - common::register_example("test", completest::Shell::Bash); + common::register_example("static", "test", completest::Shell::Bash); } #[test] @@ -156,7 +156,7 @@ fn complete() { } let term = completest::Term::new(); - let mut runtime = common::load_runtime("test", completest::Shell::Bash); + let mut runtime = common::load_runtime("static", "test", completest::Shell::Bash); let input = "test \t\t"; let expected = r#"% diff --git a/clap_complete/tests/testsuite/common.rs b/clap_complete/tests/testsuite/common.rs index c0cfad12..a26a5464 100644 --- a/clap_complete/tests/testsuite/common.rs +++ b/clap_complete/tests/testsuite/common.rs @@ -296,13 +296,14 @@ pub fn assert_matches_path( .matches_path(expected_path, buf); } -pub fn register_example(name: &str, shell: completest::Shell) { +pub fn register_example(context: &str, name: &str, shell: completest::Shell) { let scratch = snapbox::path::PathFixture::mutable_temp().unwrap(); let scratch_path = scratch.path().unwrap(); let shell_name = shell.name(); let home = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) .join("tests/snapshots/home") + .join(context) .join(name) .join(shell_name); println!("Compiling"); @@ -334,10 +335,15 @@ pub fn register_example(name: &str, shell: completest::Shell) { scratch.close().unwrap(); } -pub fn load_runtime(name: &str, shell: completest::Shell) -> Box { +pub fn load_runtime( + context: &str, + name: &str, + shell: completest::Shell, +) -> Box { let shell_name = shell.name(); let home = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) .join("tests/snapshots/home") + .join(context) .join(name) .join(shell_name); let scratch = snapbox::path::PathFixture::mutable_temp() diff --git a/clap_complete/tests/testsuite/elvish.rs b/clap_complete/tests/testsuite/elvish.rs index 788189f9..ab7b113a 100644 --- a/clap_complete/tests/testsuite/elvish.rs +++ b/clap_complete/tests/testsuite/elvish.rs @@ -127,7 +127,7 @@ fn register_completion() { return; } - common::register_example("test", completest::Shell::Elvish); + common::register_example("static", "test", completest::Shell::Elvish); } #[test] @@ -138,7 +138,7 @@ fn complete() { } let term = completest::Term::new(); - let mut runtime = common::load_runtime("test", completest::Shell::Elvish); + let mut runtime = common::load_runtime("static", "test", completest::Shell::Elvish); let input = "test \t"; let expected = r#"% test --generate diff --git a/clap_complete/tests/testsuite/fish.rs b/clap_complete/tests/testsuite/fish.rs index 7e1b598d..7af5c869 100644 --- a/clap_complete/tests/testsuite/fish.rs +++ b/clap_complete/tests/testsuite/fish.rs @@ -127,7 +127,7 @@ fn register_completion() { return; } - common::register_example("test", completest::Shell::Fish); + common::register_example("static", "test", completest::Shell::Fish); } #[test] @@ -138,7 +138,7 @@ fn complete() { } let term = completest::Term::new(); - let mut runtime = common::load_runtime("test", completest::Shell::Fish); + let mut runtime = common::load_runtime("static", "test", completest::Shell::Fish); let input = "test \t"; let expected = r#"% test diff --git a/clap_complete/tests/testsuite/zsh.rs b/clap_complete/tests/testsuite/zsh.rs index b226025e..837c7b52 100644 --- a/clap_complete/tests/testsuite/zsh.rs +++ b/clap_complete/tests/testsuite/zsh.rs @@ -127,7 +127,7 @@ fn register_completion() { return; } - common::register_example("test", completest::Shell::Zsh); + common::register_example("static", "test", completest::Shell::Zsh); } #[test] @@ -138,7 +138,7 @@ fn complete() { } let term = completest::Term::new(); - let mut runtime = common::load_runtime("test", completest::Shell::Zsh); + let mut runtime = common::load_runtime("static", "test", completest::Shell::Zsh); let input = "test \t"; let expected = r#"% test From dac33b686bbf9960646853b14e19fef87ed32f66 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 28 Jul 2023 12:52:44 -0500 Subject: [PATCH 2/9] test(complete): Only limit by command when needed --- clap_complete/tests/testsuite/bash.rs | 4 ---- clap_complete/tests/testsuite/elvish.rs | 4 ---- clap_complete/tests/testsuite/fish.rs | 4 ---- clap_complete/tests/testsuite/zsh.rs | 4 ---- 4 files changed, 16 deletions(-) diff --git a/clap_complete/tests/testsuite/bash.rs b/clap_complete/tests/testsuite/bash.rs index d28542a7..51e2ebf2 100644 --- a/clap_complete/tests/testsuite/bash.rs +++ b/clap_complete/tests/testsuite/bash.rs @@ -141,10 +141,6 @@ fn subcommand_last() { #[test] #[cfg(unix)] fn register_completion() { - if !common::has_command("bash") { - return; - } - common::register_example("static", "test", completest::Shell::Bash); } diff --git a/clap_complete/tests/testsuite/elvish.rs b/clap_complete/tests/testsuite/elvish.rs index ab7b113a..5b24d57b 100644 --- a/clap_complete/tests/testsuite/elvish.rs +++ b/clap_complete/tests/testsuite/elvish.rs @@ -123,10 +123,6 @@ fn subcommand_last() { #[test] #[cfg(unix)] fn register_completion() { - if !common::has_command("elvish") { - return; - } - common::register_example("static", "test", completest::Shell::Elvish); } diff --git a/clap_complete/tests/testsuite/fish.rs b/clap_complete/tests/testsuite/fish.rs index 7af5c869..6575c92a 100644 --- a/clap_complete/tests/testsuite/fish.rs +++ b/clap_complete/tests/testsuite/fish.rs @@ -123,10 +123,6 @@ fn subcommand_last() { #[test] #[cfg(unix)] fn register_completion() { - if !common::has_command("fish") { - return; - } - common::register_example("static", "test", completest::Shell::Fish); } diff --git a/clap_complete/tests/testsuite/zsh.rs b/clap_complete/tests/testsuite/zsh.rs index 837c7b52..e33b22a5 100644 --- a/clap_complete/tests/testsuite/zsh.rs +++ b/clap_complete/tests/testsuite/zsh.rs @@ -123,10 +123,6 @@ fn subcommand_last() { #[test] #[cfg(unix)] fn register_completion() { - if !common::has_command("zsh") { - return; - } - common::register_example("static", "test", completest::Shell::Zsh); } From 9a6208c795f69de7011d068de432434edb5b088e Mon Sep 17 00:00:00 2001 From: Roland Fredenhagen Date: Fri, 28 Jul 2023 18:10:04 +0700 Subject: [PATCH 3/9] test(complete): Allow E2E dynamic completion tests --- clap_complete/examples/test.rs | 23 ++++++++-- .../snapshots/home/static/test/bash/.bashrc | 46 ++++++++++++++++++- .../home/static/test/elvish/elvish/rc.elv | 13 ++++++ .../test/fish/fish/completions/test.fish | 23 ++++++---- .../snapshots/home/static/test/zsh/zsh/_test | 30 +++++++++++- clap_complete/tests/testsuite/bash.rs | 4 +- clap_complete/tests/testsuite/common.rs | 28 ++++++++--- clap_complete/tests/testsuite/elvish.rs | 1 + clap_complete/tests/testsuite/fish.rs | 4 +- clap_complete/tests/testsuite/zsh.rs | 5 +- 10 files changed, 150 insertions(+), 27 deletions(-) diff --git a/clap_complete/examples/test.rs b/clap_complete/examples/test.rs index 8129fb03..981f8334 100644 --- a/clap_complete/examples/test.rs +++ b/clap_complete/examples/test.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "unstable-dynamic")] +use clap::{FromArgMatches, Subcommand}; use clap_complete::{generate, Generator, Shell}; fn main() { @@ -6,9 +8,18 @@ fn main() { let mut cmd = cli(); eprintln!("Generating completion file for {generator}..."); print_completions(*generator, &mut cmd); - } else { - println!("{:?}", matches); + return; } + + #[cfg(feature = "unstable-dynamic")] + if let Ok(completions) = + clap_complete::dynamic::shells::CompleteCommand::from_arg_matches(&matches) + { + completions.complete(&mut cli()); + return; + }; + + println!("{:?}", matches); } fn print_completions(gen: G, cmd: &mut clap::Command) { @@ -16,7 +27,7 @@ fn print_completions(gen: G, cmd: &mut clap::Command) { } fn cli() -> clap::Command { - clap::Command::new("test") + let cli = clap::Command::new("test") .version("3.0") .propagate_version(true) .args([ @@ -27,6 +38,7 @@ fn cli() -> clap::Command { .help("everywhere"), clap::Arg::new("generate") .long("generate") + .value_name("SHELL") .value_parser(clap::value_parser!(Shell)) .help("generate"), ]) @@ -173,5 +185,8 @@ fn cli() -> clap::Command { .long("email") .value_hint(clap::ValueHint::EmailAddress), ]), - ]) + ]); + #[cfg(feature = "unstable-dynamic")] + let cli = clap_complete::dynamic::shells::CompleteCommand::augment_subcommands(cli); + cli } diff --git a/clap_complete/tests/snapshots/home/static/test/bash/.bashrc b/clap_complete/tests/snapshots/home/static/test/bash/.bashrc index dcb08049..01e95077 100644 --- a/clap_complete/tests/snapshots/home/static/test/bash/.bashrc +++ b/clap_complete/tests/snapshots/home/static/test/bash/.bashrc @@ -20,6 +20,9 @@ _test() { test,alias) cmd="test__alias" ;; + test,complete) + cmd="test__complete" + ;; test,help) cmd="test__help" ;; @@ -44,6 +47,9 @@ _test() { test__help,alias) cmd="test__help__alias" ;; + test__help,complete) + cmd="test__help__complete" + ;; test__help,help) cmd="test__help__help" ;; @@ -153,7 +159,7 @@ _test() { case "${cmd}" in test) - opts="-h -V --global --generate --help --version action quote value pacman last alias hint help" + opts="-h -V --global --generate --help --version action quote value pacman last alias hint complete help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -222,8 +228,30 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; + test__complete) + opts="-h -V --shell --register --global --help --version [COMP_WORDS]..." + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + --shell) + COMPREPLY=($(compgen -W "bash" -- "${cur}")) + return 0 + ;; + --register) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; test__help) - opts="action quote value pacman last alias hint help" + opts="action quote value pacman last alias hint complete help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -264,6 +292,20 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; + test__help__complete) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; test__help__help) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then diff --git a/clap_complete/tests/snapshots/home/static/test/elvish/elvish/rc.elv b/clap_complete/tests/snapshots/home/static/test/elvish/elvish/rc.elv index 7b2e8bac..e464910b 100644 --- a/clap_complete/tests/snapshots/home/static/test/elvish/elvish/rc.elv +++ b/clap_complete/tests/snapshots/home/static/test/elvish/elvish/rc.elv @@ -33,6 +33,7 @@ set edit:completion:arg-completer[test] = {|@words| cand last 'last' cand alias 'alias' cand hint 'hint' + cand complete 'Register shell completions for this program' cand help 'Print this message or the help of the given subcommand(s)' } &'test;action'= { @@ -225,6 +226,15 @@ set edit:completion:arg-completer[test] = {|@words| cand -V 'Print version' cand --version 'Print version' } + &'test;complete'= { + cand --shell 'Specify shell to complete for' + cand --register 'Path to write completion-registration to' + cand --global 'everywhere' + cand -h 'Print help (see more with ''--help'')' + cand --help 'Print help (see more with ''--help'')' + cand -V 'Print version' + cand --version 'Print version' + } &'test;help'= { cand action 'action' cand quote 'quote' @@ -233,6 +243,7 @@ set edit:completion:arg-completer[test] = {|@words| cand last 'last' cand alias 'alias' cand hint 'hint' + cand complete 'Register shell completions for this program' cand help 'Print this message or the help of the given subcommand(s)' } &'test;help;action'= { @@ -273,6 +284,8 @@ set edit:completion:arg-completer[test] = {|@words| } &'test;help;hint'= { } + &'test;help;complete'= { + } &'test;help;help'= { } ] diff --git a/clap_complete/tests/snapshots/home/static/test/fish/fish/completions/test.fish b/clap_complete/tests/snapshots/home/static/test/fish/fish/completions/test.fish index 1059fd8c..a1c5714b 100644 --- a/clap_complete/tests/snapshots/home/static/test/fish/fish/completions/test.fish +++ b/clap_complete/tests/snapshots/home/static/test/fish/fish/completions/test.fish @@ -9,6 +9,7 @@ complete -c test -n "__fish_use_subcommand" -f -a "pacman" complete -c test -n "__fish_use_subcommand" -f -a "last" complete -c test -n "__fish_use_subcommand" -f -a "alias" complete -c test -n "__fish_use_subcommand" -f -a "hint" +complete -c test -n "__fish_use_subcommand" -f -a "complete" -d 'Register shell completions for this program' complete -c test -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' complete -c test -n "__fish_seen_subcommand_from action" -l set -d 'value' -r complete -c test -n "__fish_seen_subcommand_from action" -l choice -d 'enum' -r -f -a "{first ,second }" @@ -103,14 +104,20 @@ complete -c test -n "__fish_seen_subcommand_from hint" -l email -r -f complete -c test -n "__fish_seen_subcommand_from hint" -l global -d 'everywhere' complete -c test -n "__fish_seen_subcommand_from hint" -s h -l help -d 'Print help' complete -c test -n "__fish_seen_subcommand_from hint" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from help" -f -a "action" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from help" -f -a "quote" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from help" -f -a "value" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from help" -f -a "pacman" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from help" -f -a "last" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from help" -f -a "alias" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from help" -f -a "hint" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c test -n "__fish_seen_subcommand_from complete" -l shell -d 'Specify shell to complete for' -r -f -a "{bash }" +complete -c test -n "__fish_seen_subcommand_from complete" -l register -d 'Path to write completion-registration to' -r -F +complete -c test -n "__fish_seen_subcommand_from complete" -l global -d 'everywhere' +complete -c test -n "__fish_seen_subcommand_from complete" -s h -l help -d 'Print help (see more with \'--help\')' +complete -c test -n "__fish_seen_subcommand_from complete" -s V -l version -d 'Print version' +complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "action" +complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "quote" +complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "value" +complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "pacman" +complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "last" +complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "alias" +complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "hint" +complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "complete" -d 'Register shell completions for this program' +complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' complete -c test -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-single-quotes" -d 'Can be \'always\', \'auto\', or \'never\'' complete -c test -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-double-quotes" -d 'Can be "always", "auto", or "never"' complete -c test -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-backticks" -d 'For more information see `echo test`' diff --git a/clap_complete/tests/snapshots/home/static/test/zsh/zsh/_test b/clap_complete/tests/snapshots/home/static/test/zsh/zsh/_test index dff89475..4e156f38 100644 --- a/clap_complete/tests/snapshots/home/static/test/zsh/zsh/_test +++ b/clap_complete/tests/snapshots/home/static/test/zsh/zsh/_test @@ -15,7 +15,7 @@ _test() { local context curcontext="$curcontext" state line _arguments "${_arguments_options[@]}" \ -'--generate=[generate]: :(bash elvish fish powershell zsh)' \ +'--generate=[generate]:SHELL:(bash elvish fish powershell zsh)' \ '--global[everywhere]' \ '-h[Print help]' \ '--help[Print help]' \ @@ -307,6 +307,18 @@ _arguments "${_arguments_options[@]}" \ '*::command_with_args:_cmdambivalent' \ && ret=0 ;; +(complete) +_arguments "${_arguments_options[@]}" \ +'--shell=[Specify shell to complete for]:SHELL:(bash)' \ +'--register=[Path to write completion-registration to]:REGISTER:_files' \ +'--global[everywhere]' \ +'-h[Print help (see more with '\''--help'\'')]' \ +'--help[Print help (see more with '\''--help'\'')]' \ +'-V[Print version]' \ +'--version[Print version]' \ +'*::comp_words:' \ +&& ret=0 +;; (help) _arguments "${_arguments_options[@]}" \ ":: :_test__help_commands" \ @@ -403,6 +415,10 @@ _arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \ && ret=0 ;; +(complete) +_arguments "${_arguments_options[@]}" \ +&& ret=0 +;; (help) _arguments "${_arguments_options[@]}" \ && ret=0 @@ -426,6 +442,7 @@ _test_commands() { 'last:' \ 'alias:' \ 'hint:' \ +'complete:Register shell completions for this program' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'test commands' commands "$@" @@ -540,6 +557,16 @@ _test__quote__help__cmd-single-quotes_commands() { local commands; commands=() _describe -t commands 'test quote help cmd-single-quotes commands' commands "$@" } +(( $+functions[_test__complete_commands] )) || +_test__complete_commands() { + local commands; commands=() + _describe -t commands 'test complete commands' commands "$@" +} +(( $+functions[_test__help__complete_commands] )) || +_test__help__complete_commands() { + local commands; commands=() + _describe -t commands 'test help complete commands' commands "$@" +} (( $+functions[_test__help_commands] )) || _test__help_commands() { local commands; commands=( @@ -550,6 +577,7 @@ _test__help_commands() { 'last:' \ 'alias:' \ 'hint:' \ +'complete:Register shell completions for this program' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'test help commands' commands "$@" diff --git a/clap_complete/tests/testsuite/bash.rs b/clap_complete/tests/testsuite/bash.rs index 51e2ebf2..81c2ea91 100644 --- a/clap_complete/tests/testsuite/bash.rs +++ b/clap_complete/tests/testsuite/bash.rs @@ -156,8 +156,8 @@ fn complete() { let input = "test \t\t"; let expected = r#"% --h --global --help action value last hint --V --generate --version quote pacman alias help"#; +-h --global --help action value last hint help +-V --generate --version quote pacman alias complete"#; let actual = runtime.complete(input, &term).unwrap(); snapbox::assert_eq(expected, actual); } diff --git a/clap_complete/tests/testsuite/common.rs b/clap_complete/tests/testsuite/common.rs index a26a5464..50a58471 100644 --- a/clap_complete/tests/testsuite/common.rs +++ b/clap_complete/tests/testsuite/common.rs @@ -308,9 +308,17 @@ pub fn register_example(context: &str, name: &str, shell: completest::Shell) { .join(shell_name); println!("Compiling"); let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml"); - let bin_path = - snapbox::cmd::compile_example(name, ["--manifest-path", manifest_path.to_str().unwrap()]) - .unwrap(); + let bin_path = snapbox::cmd::compile_example( + name, + [ + "--manifest-path", + manifest_path.to_str().unwrap(), + // Unconditionally include to avoid completion file tests failing based on the how + // `cargo test` is invoked + "--features=unstable-dynamic", + ], + ) + .unwrap(); println!("Compiled"); let bin_root = bin_path.parent().unwrap().to_owned(); @@ -353,9 +361,17 @@ pub fn load_runtime( let home = scratch.path().unwrap().to_owned(); println!("Compiling"); let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml"); - let bin_path = - snapbox::cmd::compile_example(name, ["--manifest-path", manifest_path.to_str().unwrap()]) - .unwrap(); + let bin_path = snapbox::cmd::compile_example( + name, + [ + "--manifest-path", + manifest_path.to_str().unwrap(), + // Unconditionally include to avoid completion file tests failing based on the how + // `cargo test` is invoked + "--features=unstable-dynamic", + ], + ) + .unwrap(); println!("Compiled"); let bin_root = bin_path.parent().unwrap().to_owned(); diff --git a/clap_complete/tests/testsuite/elvish.rs b/clap_complete/tests/testsuite/elvish.rs index 5b24d57b..46be7404 100644 --- a/clap_complete/tests/testsuite/elvish.rs +++ b/clap_complete/tests/testsuite/elvish.rs @@ -146,6 +146,7 @@ fn complete() { -h Print help action action alias alias +complete Register shell completions for this program help Print this message or the help of the given subcommand(s) hint hint last last diff --git a/clap_complete/tests/testsuite/fish.rs b/clap_complete/tests/testsuite/fish.rs index 6575c92a..ed87fc29 100644 --- a/clap_complete/tests/testsuite/fish.rs +++ b/clap_complete/tests/testsuite/fish.rs @@ -138,8 +138,8 @@ fn complete() { let input = "test \t"; let expected = r#"% test -action help (Print this message or the help of the given subcommand(s)) last quote -alias hint pacman value"#; +action complete (Register shell completions for this program) hint pacman value +alias help (Print this message or the help of the given subcommand(s)) last quote"#; let actual = runtime.complete(input, &term).unwrap(); snapbox::assert_eq(expected, actual); } diff --git a/clap_complete/tests/testsuite/zsh.rs b/clap_complete/tests/testsuite/zsh.rs index e33b22a5..c9760aba 100644 --- a/clap_complete/tests/testsuite/zsh.rs +++ b/clap_complete/tests/testsuite/zsh.rs @@ -138,8 +138,9 @@ fn complete() { let input = "test \t"; let expected = r#"% test -help -- Print this message or the help of the given subcommand(s) -pacman action alias value quote hint last --"#; +complete -- Register shell completions for this program +help -- Print this message or the help of the given subcommand(s) +pacman action alias value quote hint last --"#; let actual = runtime.complete(input, &term).unwrap(); snapbox::assert_eq(expected, actual); } From dc953e95d0bdbfa0763a39f386a2406695ed7d81 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 28 Jul 2023 13:28:30 -0500 Subject: [PATCH 4/9] test(complete): Register bash dynamic completions --- .../snapshots/home/dynamic/test/bash/.bashrc | 22 +++++++++++++++++++ clap_complete/tests/testsuite/bash.rs | 6 +++++ clap_complete/tests/testsuite/common.rs | 15 +++++++++---- 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 clap_complete/tests/snapshots/home/dynamic/test/bash/.bashrc diff --git a/clap_complete/tests/snapshots/home/dynamic/test/bash/.bashrc b/clap_complete/tests/snapshots/home/dynamic/test/bash/.bashrc new file mode 100644 index 00000000..cc6c1be0 --- /dev/null +++ b/clap_complete/tests/snapshots/home/dynamic/test/bash/.bashrc @@ -0,0 +1,22 @@ +PS1='% ' +. /etc/bash_completion + +_clap_complete_test() { + export _CLAP_COMPLETE_INDEX=${COMP_CWORD} + export _CLAP_COMPLETE_COMP_TYPE=${COMP_TYPE} + if compopt +o nospace 2> /dev/null; then + export _CLAP_COMPLETE_SPACE=false + else + export _CLAP_COMPLETE_SPACE=true + fi + export _CLAP_COMPLETE_IFS=$'\013' + COMPREPLY=( $("test" complete --shell bash -- "${COMP_WORDS[@]}") ) + if [[ $? != 0 ]]; then + unset COMPREPLY + elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "${COMPREPLY-}" =~ [=/:]$ ]]; then + compopt -o nospace + fi +} +complete -o nospace -o bashdefault -F _clap_complete_test test + + diff --git a/clap_complete/tests/testsuite/bash.rs b/clap_complete/tests/testsuite/bash.rs index 81c2ea91..e2a57839 100644 --- a/clap_complete/tests/testsuite/bash.rs +++ b/clap_complete/tests/testsuite/bash.rs @@ -161,3 +161,9 @@ fn complete() { let actual = runtime.complete(input, &term).unwrap(); snapbox::assert_eq(expected, actual); } + +#[test] +#[cfg(unix)] +fn register_dynamic_completion() { + common::register_example("dynamic", "test", completest::Shell::Bash); +} diff --git a/clap_complete/tests/testsuite/common.rs b/clap_complete/tests/testsuite/common.rs index 50a58471..2d962dbf 100644 --- a/clap_complete/tests/testsuite/common.rs +++ b/clap_complete/tests/testsuite/common.rs @@ -322,10 +322,17 @@ pub fn register_example(context: &str, name: &str, shell: completest::Shell) { println!("Compiled"); let bin_root = bin_path.parent().unwrap().to_owned(); - let registration = std::process::Command::new(&bin_path) - .arg(format!("--generate={shell_name}")) - .output() - .unwrap(); + let mut registration = std::process::Command::new(&bin_path); + match context { + "static" => registration.args([format!("--generate={shell_name}")]), + "dynamic" => registration.args([ + "complete".to_owned(), + "--register=-".to_owned(), + format!("--shell={shell_name}"), + ]), + _ => unreachable!("unsupported context {}", context), + }; + let registration = registration.output().unwrap(); assert!( registration.status.success(), "{}", From 56afdabcc0adb1a0fa6a3b5dcefdb11446a4bb28 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 28 Jul 2023 13:54:02 -0500 Subject: [PATCH 5/9] test(complete): Rename fixture to avoid ambiguity --- .../examples/{test.rs => exhaustive.rs} | 2 +- .../dynamic/{test => exhaustive}/bash/.bashrc | 6 +- .../static/{test => exhaustive}/bash/.bashrc | 284 +++++++-------- .../{test => exhaustive}/elvish/elvish/rc.elv | 98 +++--- .../fish/fish/completions/exhaustive.fish | 128 +++++++ .../fish/fish/config.fish | 0 .../static/{test => exhaustive}/zsh/.zshenv | 0 .../_test => exhaustive/zsh/zsh/_exhaustive} | 328 +++++++++--------- .../test/fish/fish/completions/test.fish | 128 ------- clap_complete/tests/testsuite/bash.rs | 8 +- clap_complete/tests/testsuite/dynamic.rs | 8 +- clap_complete/tests/testsuite/elvish.rs | 8 +- clap_complete/tests/testsuite/fish.rs | 8 +- clap_complete/tests/testsuite/zsh.rs | 8 +- 14 files changed, 507 insertions(+), 507 deletions(-) rename clap_complete/examples/{test.rs => exhaustive.rs} (99%) rename clap_complete/tests/snapshots/home/dynamic/{test => exhaustive}/bash/.bashrc (72%) rename clap_complete/tests/snapshots/home/static/{test => exhaustive}/bash/.bashrc (80%) rename clap_complete/tests/snapshots/home/static/{test => exhaustive}/elvish/elvish/rc.elv (80%) create mode 100644 clap_complete/tests/snapshots/home/static/exhaustive/fish/fish/completions/exhaustive.fish rename clap_complete/tests/snapshots/home/static/{test => exhaustive}/fish/fish/config.fish (100%) rename clap_complete/tests/snapshots/home/static/{test => exhaustive}/zsh/.zshenv (100%) rename clap_complete/tests/snapshots/home/static/{test/zsh/zsh/_test => exhaustive/zsh/zsh/_exhaustive} (55%) delete mode 100644 clap_complete/tests/snapshots/home/static/test/fish/fish/completions/test.fish diff --git a/clap_complete/examples/test.rs b/clap_complete/examples/exhaustive.rs similarity index 99% rename from clap_complete/examples/test.rs rename to clap_complete/examples/exhaustive.rs index 981f8334..838341dd 100644 --- a/clap_complete/examples/test.rs +++ b/clap_complete/examples/exhaustive.rs @@ -27,7 +27,7 @@ fn print_completions(gen: G, cmd: &mut clap::Command) { } fn cli() -> clap::Command { - let cli = clap::Command::new("test") + let cli = clap::Command::new("exhaustive") .version("3.0") .propagate_version(true) .args([ diff --git a/clap_complete/tests/snapshots/home/dynamic/test/bash/.bashrc b/clap_complete/tests/snapshots/home/dynamic/exhaustive/bash/.bashrc similarity index 72% rename from clap_complete/tests/snapshots/home/dynamic/test/bash/.bashrc rename to clap_complete/tests/snapshots/home/dynamic/exhaustive/bash/.bashrc index cc6c1be0..9e8115aa 100644 --- a/clap_complete/tests/snapshots/home/dynamic/test/bash/.bashrc +++ b/clap_complete/tests/snapshots/home/dynamic/exhaustive/bash/.bashrc @@ -1,7 +1,7 @@ PS1='% ' . /etc/bash_completion -_clap_complete_test() { +_clap_complete_exhaustive() { export _CLAP_COMPLETE_INDEX=${COMP_CWORD} export _CLAP_COMPLETE_COMP_TYPE=${COMP_TYPE} if compopt +o nospace 2> /dev/null; then @@ -10,13 +10,13 @@ _clap_complete_test() { export _CLAP_COMPLETE_SPACE=true fi export _CLAP_COMPLETE_IFS=$'\013' - COMPREPLY=( $("test" complete --shell bash -- "${COMP_WORDS[@]}") ) + COMPREPLY=( $("exhaustive" complete --shell bash -- "${COMP_WORDS[@]}") ) if [[ $? != 0 ]]; then unset COMPREPLY elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "${COMPREPLY-}" =~ [=/:]$ ]]; then compopt -o nospace fi } -complete -o nospace -o bashdefault -F _clap_complete_test test +complete -o nospace -o bashdefault -F _clap_complete_exhaustive exhaustive diff --git a/clap_complete/tests/snapshots/home/static/test/bash/.bashrc b/clap_complete/tests/snapshots/home/static/exhaustive/bash/.bashrc similarity index 80% rename from clap_complete/tests/snapshots/home/static/test/bash/.bashrc rename to clap_complete/tests/snapshots/home/static/exhaustive/bash/.bashrc index 01e95077..aafae870 100644 --- a/clap_complete/tests/snapshots/home/static/test/bash/.bashrc +++ b/clap_complete/tests/snapshots/home/static/exhaustive/bash/.bashrc @@ -1,6 +1,6 @@ PS1='% ' . /etc/bash_completion -_test() { +_exhaustive() { local i cur prev opts cmd COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" @@ -12,145 +12,145 @@ _test() { do case "${cmd},${i}" in ",$1") - cmd="test" + cmd="exhaustive" ;; - test,action) - cmd="test__action" + exhaustive,action) + cmd="exhaustive__action" ;; - test,alias) - cmd="test__alias" + exhaustive,alias) + cmd="exhaustive__alias" ;; - test,complete) - cmd="test__complete" + exhaustive,complete) + cmd="exhaustive__complete" ;; - test,help) - cmd="test__help" + exhaustive,help) + cmd="exhaustive__help" ;; - test,hint) - cmd="test__hint" + exhaustive,hint) + cmd="exhaustive__hint" ;; - test,last) - cmd="test__last" + exhaustive,last) + cmd="exhaustive__last" ;; - test,pacman) - cmd="test__pacman" + exhaustive,pacman) + cmd="exhaustive__pacman" ;; - test,quote) - cmd="test__quote" + exhaustive,quote) + cmd="exhaustive__quote" ;; - test,value) - cmd="test__value" + exhaustive,value) + cmd="exhaustive__value" ;; - test__help,action) - cmd="test__help__action" + exhaustive__help,action) + cmd="exhaustive__help__action" ;; - test__help,alias) - cmd="test__help__alias" + exhaustive__help,alias) + cmd="exhaustive__help__alias" ;; - test__help,complete) - cmd="test__help__complete" + exhaustive__help,complete) + cmd="exhaustive__help__complete" ;; - test__help,help) - cmd="test__help__help" + exhaustive__help,help) + cmd="exhaustive__help__help" ;; - test__help,hint) - cmd="test__help__hint" + exhaustive__help,hint) + cmd="exhaustive__help__hint" ;; - test__help,last) - cmd="test__help__last" + exhaustive__help,last) + cmd="exhaustive__help__last" ;; - test__help,pacman) - cmd="test__help__pacman" + exhaustive__help,pacman) + cmd="exhaustive__help__pacman" ;; - test__help,quote) - cmd="test__help__quote" + exhaustive__help,quote) + cmd="exhaustive__help__quote" ;; - test__help,value) - cmd="test__help__value" + exhaustive__help,value) + cmd="exhaustive__help__value" ;; - test__help__pacman,one) - cmd="test__help__pacman__one" + exhaustive__help__pacman,one) + cmd="exhaustive__help__pacman__one" ;; - test__help__pacman,two) - cmd="test__help__pacman__two" + exhaustive__help__pacman,two) + cmd="exhaustive__help__pacman__two" ;; - test__help__quote,cmd-backslash) - cmd="test__help__quote__cmd__backslash" + exhaustive__help__quote,cmd-backslash) + cmd="exhaustive__help__quote__cmd__backslash" ;; - test__help__quote,cmd-backticks) - cmd="test__help__quote__cmd__backticks" + exhaustive__help__quote,cmd-backticks) + cmd="exhaustive__help__quote__cmd__backticks" ;; - test__help__quote,cmd-brackets) - cmd="test__help__quote__cmd__brackets" + exhaustive__help__quote,cmd-brackets) + cmd="exhaustive__help__quote__cmd__brackets" ;; - test__help__quote,cmd-double-quotes) - cmd="test__help__quote__cmd__double__quotes" + exhaustive__help__quote,cmd-double-quotes) + cmd="exhaustive__help__quote__cmd__double__quotes" ;; - test__help__quote,cmd-expansions) - cmd="test__help__quote__cmd__expansions" + exhaustive__help__quote,cmd-expansions) + cmd="exhaustive__help__quote__cmd__expansions" ;; - test__help__quote,cmd-single-quotes) - cmd="test__help__quote__cmd__single__quotes" + exhaustive__help__quote,cmd-single-quotes) + cmd="exhaustive__help__quote__cmd__single__quotes" ;; - test__pacman,help) - cmd="test__pacman__help" + exhaustive__pacman,help) + cmd="exhaustive__pacman__help" ;; - test__pacman,one) - cmd="test__pacman__one" + exhaustive__pacman,one) + cmd="exhaustive__pacman__one" ;; - test__pacman,two) - cmd="test__pacman__two" + exhaustive__pacman,two) + cmd="exhaustive__pacman__two" ;; - test__pacman__help,help) - cmd="test__pacman__help__help" + exhaustive__pacman__help,help) + cmd="exhaustive__pacman__help__help" ;; - test__pacman__help,one) - cmd="test__pacman__help__one" + exhaustive__pacman__help,one) + cmd="exhaustive__pacman__help__one" ;; - test__pacman__help,two) - cmd="test__pacman__help__two" + exhaustive__pacman__help,two) + cmd="exhaustive__pacman__help__two" ;; - test__quote,cmd-backslash) - cmd="test__quote__cmd__backslash" + exhaustive__quote,cmd-backslash) + cmd="exhaustive__quote__cmd__backslash" ;; - test__quote,cmd-backticks) - cmd="test__quote__cmd__backticks" + exhaustive__quote,cmd-backticks) + cmd="exhaustive__quote__cmd__backticks" ;; - test__quote,cmd-brackets) - cmd="test__quote__cmd__brackets" + exhaustive__quote,cmd-brackets) + cmd="exhaustive__quote__cmd__brackets" ;; - test__quote,cmd-double-quotes) - cmd="test__quote__cmd__double__quotes" + exhaustive__quote,cmd-double-quotes) + cmd="exhaustive__quote__cmd__double__quotes" ;; - test__quote,cmd-expansions) - cmd="test__quote__cmd__expansions" + exhaustive__quote,cmd-expansions) + cmd="exhaustive__quote__cmd__expansions" ;; - test__quote,cmd-single-quotes) - cmd="test__quote__cmd__single__quotes" + exhaustive__quote,cmd-single-quotes) + cmd="exhaustive__quote__cmd__single__quotes" ;; - test__quote,help) - cmd="test__quote__help" + exhaustive__quote,help) + cmd="exhaustive__quote__help" ;; - test__quote__help,cmd-backslash) - cmd="test__quote__help__cmd__backslash" + exhaustive__quote__help,cmd-backslash) + cmd="exhaustive__quote__help__cmd__backslash" ;; - test__quote__help,cmd-backticks) - cmd="test__quote__help__cmd__backticks" + exhaustive__quote__help,cmd-backticks) + cmd="exhaustive__quote__help__cmd__backticks" ;; - test__quote__help,cmd-brackets) - cmd="test__quote__help__cmd__brackets" + exhaustive__quote__help,cmd-brackets) + cmd="exhaustive__quote__help__cmd__brackets" ;; - test__quote__help,cmd-double-quotes) - cmd="test__quote__help__cmd__double__quotes" + exhaustive__quote__help,cmd-double-quotes) + cmd="exhaustive__quote__help__cmd__double__quotes" ;; - test__quote__help,cmd-expansions) - cmd="test__quote__help__cmd__expansions" + exhaustive__quote__help,cmd-expansions) + cmd="exhaustive__quote__help__cmd__expansions" ;; - test__quote__help,cmd-single-quotes) - cmd="test__quote__help__cmd__single__quotes" + exhaustive__quote__help,cmd-single-quotes) + cmd="exhaustive__quote__help__cmd__single__quotes" ;; - test__quote__help,help) - cmd="test__quote__help__help" + exhaustive__quote__help,help) + cmd="exhaustive__quote__help__help" ;; *) ;; @@ -158,7 +158,7 @@ _test() { done case "${cmd}" in - test) + exhaustive) opts="-h -V --global --generate --help --version action quote value pacman last alias hint complete help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -176,7 +176,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__action) + exhaustive__action) opts="-h -V --set-true --set --count --choice --global --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -198,7 +198,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__alias) + exhaustive__alias) opts="-F -f -O -o -h -V --flg --flag --opt --option --global --help --version [positional]" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -228,7 +228,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__complete) + exhaustive__complete) opts="-h -V --shell --register --global --help --version [COMP_WORDS]..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -250,7 +250,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help) + exhaustive__help) opts="action quote value pacman last alias hint complete help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -264,7 +264,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__action) + exhaustive__help__action) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -278,7 +278,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__alias) + exhaustive__help__alias) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -292,7 +292,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__complete) + exhaustive__help__complete) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -306,7 +306,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__help) + exhaustive__help__help) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -320,7 +320,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__hint) + exhaustive__help__hint) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -334,7 +334,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__last) + exhaustive__help__last) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -348,7 +348,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__pacman) + exhaustive__help__pacman) opts="one two" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -362,7 +362,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__pacman__one) + exhaustive__help__pacman__one) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -376,7 +376,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__pacman__two) + exhaustive__help__pacman__two) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -390,7 +390,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__quote) + exhaustive__help__quote) opts="cmd-single-quotes cmd-double-quotes cmd-backticks cmd-backslash cmd-brackets cmd-expansions" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -404,7 +404,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__quote__cmd__backslash) + exhaustive__help__quote__cmd__backslash) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -418,7 +418,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__quote__cmd__backticks) + exhaustive__help__quote__cmd__backticks) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -432,7 +432,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__quote__cmd__brackets) + exhaustive__help__quote__cmd__brackets) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -446,7 +446,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__quote__cmd__double__quotes) + exhaustive__help__quote__cmd__double__quotes) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -460,7 +460,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__quote__cmd__expansions) + exhaustive__help__quote__cmd__expansions) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -474,7 +474,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__quote__cmd__single__quotes) + exhaustive__help__quote__cmd__single__quotes) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -488,7 +488,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__help__value) + exhaustive__help__value) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -502,7 +502,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__hint) + exhaustive__hint) opts="-p -f -d -e -c -u -H -h -V --choice --unknown --other --path --file --dir --exe --cmd-name --cmd --user --host --url --email --global --help --version [command_with_args]..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -596,7 +596,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__last) + exhaustive__last) opts="-h -V --global --help --version [first] [free]" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -610,7 +610,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__pacman) + exhaustive__pacman) opts="-h -V --global --help --version one two help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -624,7 +624,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__pacman__help) + exhaustive__pacman__help) opts="one two help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -638,7 +638,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__pacman__help__help) + exhaustive__pacman__help__help) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -652,7 +652,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__pacman__help__one) + exhaustive__pacman__help__one) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -666,7 +666,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__pacman__help__two) + exhaustive__pacman__help__two) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -680,7 +680,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__pacman__one) + exhaustive__pacman__one) opts="-h -V --global --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -694,7 +694,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__pacman__two) + exhaustive__pacman__two) opts="-h -V --global --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -708,7 +708,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote) + exhaustive__quote) opts="-h -V --single-quotes --double-quotes --backticks --backslash --brackets --expansions --global --help --version cmd-single-quotes cmd-double-quotes cmd-backticks cmd-backslash cmd-brackets cmd-expansions help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -722,7 +722,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__cmd__backslash) + exhaustive__quote__cmd__backslash) opts="-h -V --global --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -736,7 +736,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__cmd__backticks) + exhaustive__quote__cmd__backticks) opts="-h -V --global --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -750,7 +750,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__cmd__brackets) + exhaustive__quote__cmd__brackets) opts="-h -V --global --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -764,7 +764,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__cmd__double__quotes) + exhaustive__quote__cmd__double__quotes) opts="-h -V --global --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -778,7 +778,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__cmd__expansions) + exhaustive__quote__cmd__expansions) opts="-h -V --global --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -792,7 +792,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__cmd__single__quotes) + exhaustive__quote__cmd__single__quotes) opts="-h -V --global --help --version" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -806,7 +806,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__help) + exhaustive__quote__help) opts="cmd-single-quotes cmd-double-quotes cmd-backticks cmd-backslash cmd-brackets cmd-expansions help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -820,7 +820,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__help__cmd__backslash) + exhaustive__quote__help__cmd__backslash) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -834,7 +834,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__help__cmd__backticks) + exhaustive__quote__help__cmd__backticks) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -848,7 +848,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__help__cmd__brackets) + exhaustive__quote__help__cmd__brackets) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -862,7 +862,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__help__cmd__double__quotes) + exhaustive__quote__help__cmd__double__quotes) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -876,7 +876,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__help__cmd__expansions) + exhaustive__quote__help__cmd__expansions) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -890,7 +890,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__help__cmd__single__quotes) + exhaustive__quote__help__cmd__single__quotes) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -904,7 +904,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__quote__help__help) + exhaustive__quote__help__help) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -918,7 +918,7 @@ _test() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - test__value) + exhaustive__value) opts="-h -V --delim --tuple --require-eq --global --help --version [term]..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -947,5 +947,5 @@ _test() { esac } -complete -F _test -o nosort -o bashdefault -o default test +complete -F _exhaustive -o nosort -o bashdefault -o default exhaustive diff --git a/clap_complete/tests/snapshots/home/static/test/elvish/elvish/rc.elv b/clap_complete/tests/snapshots/home/static/exhaustive/elvish/elvish/rc.elv similarity index 80% rename from clap_complete/tests/snapshots/home/static/test/elvish/elvish/rc.elv rename to clap_complete/tests/snapshots/home/static/exhaustive/elvish/elvish/rc.elv index e464910b..8c0a4d62 100644 --- a/clap_complete/tests/snapshots/home/static/test/elvish/elvish/rc.elv +++ b/clap_complete/tests/snapshots/home/static/exhaustive/elvish/elvish/rc.elv @@ -4,14 +4,14 @@ set edit:prompt = (constantly "% ") use builtin; use str; -set edit:completion:arg-completer[test] = {|@words| +set edit:completion:arg-completer[exhaustive] = {|@words| fn spaces {|n| builtin:repeat $n ' ' | str:join '' } fn cand {|text desc| edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc } - var command = 'test' + var command = 'exhaustive' for word $words[1..-1] { if (str:has-prefix $word '-') { break @@ -19,7 +19,7 @@ set edit:completion:arg-completer[test] = {|@words| set command = $command';'$word } var completions = [ - &'test'= { + &'exhaustive'= { cand --generate 'generate' cand --global 'everywhere' cand -h 'Print help' @@ -36,7 +36,7 @@ set edit:completion:arg-completer[test] = {|@words| cand complete 'Register shell completions for this program' cand help 'Print this message or the help of the given subcommand(s)' } - &'test;action'= { + &'exhaustive;action'= { cand --set 'value' cand --choice 'enum' cand --set-true 'bool' @@ -47,7 +47,7 @@ set edit:completion:arg-completer[test] = {|@words| cand -V 'Print version' cand --version 'Print version' } - &'test;quote'= { + &'exhaustive;quote'= { cand --single-quotes 'Can be ''always'', ''auto'', or ''never''' cand --double-quotes 'Can be "always", "auto", or "never"' cand --backticks 'For more information see `echo test`' @@ -67,49 +67,49 @@ set edit:completion:arg-completer[test] = {|@words| cand cmd-expansions 'Execute the shell command with $SHELL' cand help 'Print this message or the help of the given subcommand(s)' } - &'test;quote;cmd-single-quotes'= { + &'exhaustive;quote;cmd-single-quotes'= { cand --global 'everywhere' cand -h 'Print help' cand --help 'Print help' cand -V 'Print version' cand --version 'Print version' } - &'test;quote;cmd-double-quotes'= { + &'exhaustive;quote;cmd-double-quotes'= { cand --global 'everywhere' cand -h 'Print help' cand --help 'Print help' cand -V 'Print version' cand --version 'Print version' } - &'test;quote;cmd-backticks'= { + &'exhaustive;quote;cmd-backticks'= { cand --global 'everywhere' cand -h 'Print help' cand --help 'Print help' cand -V 'Print version' cand --version 'Print version' } - &'test;quote;cmd-backslash'= { + &'exhaustive;quote;cmd-backslash'= { cand --global 'everywhere' cand -h 'Print help' cand --help 'Print help' cand -V 'Print version' cand --version 'Print version' } - &'test;quote;cmd-brackets'= { + &'exhaustive;quote;cmd-brackets'= { cand --global 'everywhere' cand -h 'Print help' cand --help 'Print help' cand -V 'Print version' cand --version 'Print version' } - &'test;quote;cmd-expansions'= { + &'exhaustive;quote;cmd-expansions'= { cand --global 'everywhere' cand -h 'Print help' cand --help 'Print help' cand -V 'Print version' cand --version 'Print version' } - &'test;quote;help'= { + &'exhaustive;quote;help'= { cand cmd-single-quotes 'Can be ''always'', ''auto'', or ''never''' cand cmd-double-quotes 'Can be "always", "auto", or "never"' cand cmd-backticks 'For more information see `echo test`' @@ -118,21 +118,21 @@ set edit:completion:arg-completer[test] = {|@words| cand cmd-expansions 'Execute the shell command with $SHELL' cand help 'Print this message or the help of the given subcommand(s)' } - &'test;quote;help;cmd-single-quotes'= { + &'exhaustive;quote;help;cmd-single-quotes'= { } - &'test;quote;help;cmd-double-quotes'= { + &'exhaustive;quote;help;cmd-double-quotes'= { } - &'test;quote;help;cmd-backticks'= { + &'exhaustive;quote;help;cmd-backticks'= { } - &'test;quote;help;cmd-backslash'= { + &'exhaustive;quote;help;cmd-backslash'= { } - &'test;quote;help;cmd-brackets'= { + &'exhaustive;quote;help;cmd-brackets'= { } - &'test;quote;help;cmd-expansions'= { + &'exhaustive;quote;help;cmd-expansions'= { } - &'test;quote;help;help'= { + &'exhaustive;quote;help;help'= { } - &'test;value'= { + &'exhaustive;value'= { cand --delim 'delim' cand --tuple 'tuple' cand --require-eq 'require-eq' @@ -142,7 +142,7 @@ set edit:completion:arg-completer[test] = {|@words| cand -V 'Print version' cand --version 'Print version' } - &'test;pacman'= { + &'exhaustive;pacman'= { cand --global 'everywhere' cand -h 'Print help' cand --help 'Print help' @@ -152,39 +152,39 @@ set edit:completion:arg-completer[test] = {|@words| cand two 'two' cand help 'Print this message or the help of the given subcommand(s)' } - &'test;pacman;one'= { + &'exhaustive;pacman;one'= { cand --global 'everywhere' cand -h 'Print help' cand --help 'Print help' cand -V 'Print version' cand --version 'Print version' } - &'test;pacman;two'= { + &'exhaustive;pacman;two'= { cand --global 'everywhere' cand -h 'Print help' cand --help 'Print help' cand -V 'Print version' cand --version 'Print version' } - &'test;pacman;help'= { + &'exhaustive;pacman;help'= { cand one 'one' cand two 'two' cand help 'Print this message or the help of the given subcommand(s)' } - &'test;pacman;help;one'= { + &'exhaustive;pacman;help;one'= { } - &'test;pacman;help;two'= { + &'exhaustive;pacman;help;two'= { } - &'test;pacman;help;help'= { + &'exhaustive;pacman;help;help'= { } - &'test;last'= { + &'exhaustive;last'= { cand --global 'everywhere' cand -h 'Print help' cand --help 'Print help' cand -V 'Print version' cand --version 'Print version' } - &'test;alias'= { + &'exhaustive;alias'= { cand -o 'cmd option' cand -O 'cmd option' cand --option 'cmd option' @@ -199,7 +199,7 @@ set edit:completion:arg-completer[test] = {|@words| cand -V 'Print version' cand --version 'Print version' } - &'test;hint'= { + &'exhaustive;hint'= { cand --choice 'choice' cand --unknown 'unknown' cand --other 'other' @@ -226,7 +226,7 @@ set edit:completion:arg-completer[test] = {|@words| cand -V 'Print version' cand --version 'Print version' } - &'test;complete'= { + &'exhaustive;complete'= { cand --shell 'Specify shell to complete for' cand --register 'Path to write completion-registration to' cand --global 'everywhere' @@ -235,7 +235,7 @@ set edit:completion:arg-completer[test] = {|@words| cand -V 'Print version' cand --version 'Print version' } - &'test;help'= { + &'exhaustive;help'= { cand action 'action' cand quote 'quote' cand value 'value' @@ -246,9 +246,9 @@ set edit:completion:arg-completer[test] = {|@words| cand complete 'Register shell completions for this program' cand help 'Print this message or the help of the given subcommand(s)' } - &'test;help;action'= { + &'exhaustive;help;action'= { } - &'test;help;quote'= { + &'exhaustive;help;quote'= { cand cmd-single-quotes 'Can be ''always'', ''auto'', or ''never''' cand cmd-double-quotes 'Can be "always", "auto", or "never"' cand cmd-backticks 'For more information see `echo test`' @@ -256,37 +256,37 @@ set edit:completion:arg-completer[test] = {|@words| cand cmd-brackets 'List packages [filter]' cand cmd-expansions 'Execute the shell command with $SHELL' } - &'test;help;quote;cmd-single-quotes'= { + &'exhaustive;help;quote;cmd-single-quotes'= { } - &'test;help;quote;cmd-double-quotes'= { + &'exhaustive;help;quote;cmd-double-quotes'= { } - &'test;help;quote;cmd-backticks'= { + &'exhaustive;help;quote;cmd-backticks'= { } - &'test;help;quote;cmd-backslash'= { + &'exhaustive;help;quote;cmd-backslash'= { } - &'test;help;quote;cmd-brackets'= { + &'exhaustive;help;quote;cmd-brackets'= { } - &'test;help;quote;cmd-expansions'= { + &'exhaustive;help;quote;cmd-expansions'= { } - &'test;help;value'= { + &'exhaustive;help;value'= { } - &'test;help;pacman'= { + &'exhaustive;help;pacman'= { cand one 'one' cand two 'two' } - &'test;help;pacman;one'= { + &'exhaustive;help;pacman;one'= { } - &'test;help;pacman;two'= { + &'exhaustive;help;pacman;two'= { } - &'test;help;last'= { + &'exhaustive;help;last'= { } - &'test;help;alias'= { + &'exhaustive;help;alias'= { } - &'test;help;hint'= { + &'exhaustive;help;hint'= { } - &'test;help;complete'= { + &'exhaustive;help;complete'= { } - &'test;help;help'= { + &'exhaustive;help;help'= { } ] $completions[$command] diff --git a/clap_complete/tests/snapshots/home/static/exhaustive/fish/fish/completions/exhaustive.fish b/clap_complete/tests/snapshots/home/static/exhaustive/fish/fish/completions/exhaustive.fish new file mode 100644 index 00000000..3f232cb1 --- /dev/null +++ b/clap_complete/tests/snapshots/home/static/exhaustive/fish/fish/completions/exhaustive.fish @@ -0,0 +1,128 @@ +complete -c exhaustive -n "__fish_use_subcommand" -l generate -d 'generate' -r -f -a "{bash ,elvish ,fish ,powershell ,zsh }" +complete -c exhaustive -n "__fish_use_subcommand" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_use_subcommand" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_use_subcommand" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_use_subcommand" -f -a "action" +complete -c exhaustive -n "__fish_use_subcommand" -f -a "quote" +complete -c exhaustive -n "__fish_use_subcommand" -f -a "value" +complete -c exhaustive -n "__fish_use_subcommand" -f -a "pacman" +complete -c exhaustive -n "__fish_use_subcommand" -f -a "last" +complete -c exhaustive -n "__fish_use_subcommand" -f -a "alias" +complete -c exhaustive -n "__fish_use_subcommand" -f -a "hint" +complete -c exhaustive -n "__fish_use_subcommand" -f -a "complete" -d 'Register shell completions for this program' +complete -c exhaustive -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c exhaustive -n "__fish_seen_subcommand_from action" -l set -d 'value' -r +complete -c exhaustive -n "__fish_seen_subcommand_from action" -l choice -d 'enum' -r -f -a "{first ,second }" +complete -c exhaustive -n "__fish_seen_subcommand_from action" -l set-true -d 'bool' +complete -c exhaustive -n "__fish_seen_subcommand_from action" -l count -d 'number' +complete -c exhaustive -n "__fish_seen_subcommand_from action" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from action" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from action" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l single-quotes -d 'Can be \'always\', \'auto\', or \'never\'' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l double-quotes -d 'Can be "always", "auto", or "never"' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l backticks -d 'For more information see `echo test`' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l backslash -d 'Avoid \'\\n\'' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l brackets -d 'List packages [filter]' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l expansions -d 'Execute the shell command with $SHELL' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-single-quotes" -d 'Can be \'always\', \'auto\', or \'never\'' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-double-quotes" -d 'Can be "always", "auto", or "never"' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-backticks" -d 'For more information see `echo test`' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-backslash" -d 'Avoid \'\\n\'' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-brackets" -d 'List packages [filter]' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-expansions" -d 'Execute the shell command with $SHELL' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-single-quotes" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-single-quotes" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-single-quotes" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-double-quotes" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-double-quotes" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-double-quotes" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-backticks" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-backticks" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-backticks" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-backslash" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-backslash" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-backslash" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-brackets" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-brackets" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-brackets" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-expansions" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-expansions" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-expansions" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-single-quotes" -d 'Can be \'always\', \'auto\', or \'never\'' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-double-quotes" -d 'Can be "always", "auto", or "never"' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-backticks" -d 'For more information see `echo test`' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-backslash" -d 'Avoid \'\\n\'' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-brackets" -d 'List packages [filter]' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-expansions" -d 'Execute the shell command with $SHELL' +complete -c exhaustive -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c exhaustive -n "__fish_seen_subcommand_from value" -l delim -r +complete -c exhaustive -n "__fish_seen_subcommand_from value" -l tuple -r +complete -c exhaustive -n "__fish_seen_subcommand_from value" -l require-eq -r +complete -c exhaustive -n "__fish_seen_subcommand_from value" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from value" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from value" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -f -a "one" +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -f -a "two" +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from one" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from one" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from one" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from two" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from two" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from two" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -f -a "one" +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -f -a "two" +complete -c exhaustive -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c exhaustive -n "__fish_seen_subcommand_from last" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from last" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from last" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from alias" -s o -s O -l option -l opt -d 'cmd option' -r +complete -c exhaustive -n "__fish_seen_subcommand_from alias" -s f -s F -l flag -l flg -d 'cmd flag' +complete -c exhaustive -n "__fish_seen_subcommand_from alias" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from alias" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from alias" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l choice -r -f -a "{bash ,fish ,zsh }" +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l unknown -r +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l other -r -f +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -s p -l path -r -F +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -s f -l file -r -F +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -s d -l dir -r -f -a "(__fish_complete_directories)" +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -s e -l exe -r -F +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l cmd-name -r -f -a "(__fish_complete_command)" +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -s c -l cmd -r -f -a "(__fish_complete_command)" +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -s u -l user -r -f -a "(__fish_complete_users)" +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -s H -l host -r -f -a "(__fish_print_hostnames)" +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l url -r -f +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l email -r -f +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -s h -l help -d 'Print help' +complete -c exhaustive -n "__fish_seen_subcommand_from hint" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from complete" -l shell -d 'Specify shell to complete for' -r -f -a "{bash }" +complete -c exhaustive -n "__fish_seen_subcommand_from complete" -l register -d 'Path to write completion-registration to' -r -F +complete -c exhaustive -n "__fish_seen_subcommand_from complete" -l global -d 'everywhere' +complete -c exhaustive -n "__fish_seen_subcommand_from complete" -s h -l help -d 'Print help (see more with \'--help\')' +complete -c exhaustive -n "__fish_seen_subcommand_from complete" -s V -l version -d 'Print version' +complete -c exhaustive -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "action" +complete -c exhaustive -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "quote" +complete -c exhaustive -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "value" +complete -c exhaustive -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "pacman" +complete -c exhaustive -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "last" +complete -c exhaustive -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "alias" +complete -c exhaustive -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "hint" +complete -c exhaustive -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "complete" -d 'Register shell completions for this program' +complete -c exhaustive -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c exhaustive -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-single-quotes" -d 'Can be \'always\', \'auto\', or \'never\'' +complete -c exhaustive -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-double-quotes" -d 'Can be "always", "auto", or "never"' +complete -c exhaustive -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-backticks" -d 'For more information see `echo test`' +complete -c exhaustive -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-backslash" -d 'Avoid \'\\n\'' +complete -c exhaustive -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-brackets" -d 'List packages [filter]' +complete -c exhaustive -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-expansions" -d 'Execute the shell command with $SHELL' +complete -c exhaustive -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two" -f -a "one" +complete -c exhaustive -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two" -f -a "two" diff --git a/clap_complete/tests/snapshots/home/static/test/fish/fish/config.fish b/clap_complete/tests/snapshots/home/static/exhaustive/fish/fish/config.fish similarity index 100% rename from clap_complete/tests/snapshots/home/static/test/fish/fish/config.fish rename to clap_complete/tests/snapshots/home/static/exhaustive/fish/fish/config.fish diff --git a/clap_complete/tests/snapshots/home/static/test/zsh/.zshenv b/clap_complete/tests/snapshots/home/static/exhaustive/zsh/.zshenv similarity index 100% rename from clap_complete/tests/snapshots/home/static/test/zsh/.zshenv rename to clap_complete/tests/snapshots/home/static/exhaustive/zsh/.zshenv diff --git a/clap_complete/tests/snapshots/home/static/test/zsh/zsh/_test b/clap_complete/tests/snapshots/home/static/exhaustive/zsh/zsh/_exhaustive similarity index 55% rename from clap_complete/tests/snapshots/home/static/test/zsh/zsh/_test rename to clap_complete/tests/snapshots/home/static/exhaustive/zsh/zsh/_exhaustive index 4e156f38..1fa0a62d 100644 --- a/clap_complete/tests/snapshots/home/static/test/zsh/zsh/_test +++ b/clap_complete/tests/snapshots/home/static/exhaustive/zsh/zsh/_exhaustive @@ -1,8 +1,8 @@ -#compdef test +#compdef exhaustive autoload -U is-at-least -_test() { +_exhaustive() { typeset -A opt_args typeset -a _arguments_options local ret=1 @@ -21,14 +21,14 @@ _test() { '--help[Print help]' \ '-V[Print version]' \ '--version[Print version]' \ -":: :_test_commands" \ -"*::: :->test" \ +":: :_exhaustive_commands" \ +"*::: :->exhaustive" \ && ret=0 case $state in - (test) + (exhaustive) words=($line[1] "${words[@]}") (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:test-command-$line[1]:" + curcontext="${curcontext%:*:*}:exhaustive-command-$line[1]:" case $line[1] in (action) _arguments "${_arguments_options[@]}" \ @@ -56,7 +56,7 @@ _arguments "${_arguments_options[@]}" \ '--help[Print help]' \ '-V[Print version]' \ '--version[Print version]' \ -":: :_test__quote_commands" \ +":: :_exhaustive__quote_commands" \ "*::: :->quote" \ && ret=0 @@ -64,7 +64,7 @@ _arguments "${_arguments_options[@]}" \ (quote) words=($line[1] "${words[@]}") (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:test-quote-command-$line[1]:" + curcontext="${curcontext%:*:*}:exhaustive-quote-command-$line[1]:" case $line[1] in (cmd-single-quotes) _arguments "${_arguments_options[@]}" \ @@ -122,7 +122,7 @@ _arguments "${_arguments_options[@]}" \ ;; (help) _arguments "${_arguments_options[@]}" \ -":: :_test__quote__help_commands" \ +":: :_exhaustive__quote__help_commands" \ "*::: :->help" \ && ret=0 @@ -130,7 +130,7 @@ _arguments "${_arguments_options[@]}" \ (help) words=($line[1] "${words[@]}") (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:test-quote-help-command-$line[1]:" + curcontext="${curcontext%:*:*}:exhaustive-quote-help-command-$line[1]:" case $line[1] in (cmd-single-quotes) _arguments "${_arguments_options[@]}" \ @@ -188,7 +188,7 @@ _arguments "${_arguments_options[@]}" \ '--help[Print help]' \ '-V[Print version]' \ '--version[Print version]' \ -":: :_test__pacman_commands" \ +":: :_exhaustive__pacman_commands" \ "*::: :->pacman" \ && ret=0 @@ -196,7 +196,7 @@ _arguments "${_arguments_options[@]}" \ (pacman) words=($line[1] "${words[@]}") (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:test-pacman-command-$line[1]:" + curcontext="${curcontext%:*:*}:exhaustive-pacman-command-$line[1]:" case $line[1] in (one) _arguments "${_arguments_options[@]}" \ @@ -218,7 +218,7 @@ _arguments "${_arguments_options[@]}" \ ;; (help) _arguments "${_arguments_options[@]}" \ -":: :_test__pacman__help_commands" \ +":: :_exhaustive__pacman__help_commands" \ "*::: :->help" \ && ret=0 @@ -226,7 +226,7 @@ _arguments "${_arguments_options[@]}" \ (help) words=($line[1] "${words[@]}") (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:test-pacman-help-command-$line[1]:" + curcontext="${curcontext%:*:*}:exhaustive-pacman-help-command-$line[1]:" case $line[1] in (one) _arguments "${_arguments_options[@]}" \ @@ -321,7 +321,7 @@ _arguments "${_arguments_options[@]}" \ ;; (help) _arguments "${_arguments_options[@]}" \ -":: :_test__help_commands" \ +":: :_exhaustive__help_commands" \ "*::: :->help" \ && ret=0 @@ -329,7 +329,7 @@ _arguments "${_arguments_options[@]}" \ (help) words=($line[1] "${words[@]}") (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:test-help-command-$line[1]:" + curcontext="${curcontext%:*:*}:exhaustive-help-command-$line[1]:" case $line[1] in (action) _arguments "${_arguments_options[@]}" \ @@ -337,7 +337,7 @@ _arguments "${_arguments_options[@]}" \ ;; (quote) _arguments "${_arguments_options[@]}" \ -":: :_test__help__quote_commands" \ +":: :_exhaustive__help__quote_commands" \ "*::: :->quote" \ && ret=0 @@ -345,7 +345,7 @@ _arguments "${_arguments_options[@]}" \ (quote) words=($line[1] "${words[@]}") (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:test-help-quote-command-$line[1]:" + curcontext="${curcontext%:*:*}:exhaustive-help-quote-command-$line[1]:" case $line[1] in (cmd-single-quotes) _arguments "${_arguments_options[@]}" \ @@ -381,7 +381,7 @@ _arguments "${_arguments_options[@]}" \ ;; (pacman) _arguments "${_arguments_options[@]}" \ -":: :_test__help__pacman_commands" \ +":: :_exhaustive__help__pacman_commands" \ "*::: :->pacman" \ && ret=0 @@ -389,7 +389,7 @@ _arguments "${_arguments_options[@]}" \ (pacman) words=($line[1] "${words[@]}") (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:test-help-pacman-command-$line[1]:" + curcontext="${curcontext%:*:*}:exhaustive-help-pacman-command-$line[1]:" case $line[1] in (one) _arguments "${_arguments_options[@]}" \ @@ -432,8 +432,8 @@ esac esac } -(( $+functions[_test_commands] )) || -_test_commands() { +(( $+functions[_exhaustive_commands] )) || +_exhaustive_commands() { local commands; commands=( 'action:' \ 'quote:' \ @@ -445,130 +445,130 @@ _test_commands() { 'complete:Register shell completions for this program' \ 'help:Print this message or the help of the given subcommand(s)' \ ) - _describe -t commands 'test commands' commands "$@" + _describe -t commands 'exhaustive commands' commands "$@" } -(( $+functions[_test__action_commands] )) || -_test__action_commands() { +(( $+functions[_exhaustive__action_commands] )) || +_exhaustive__action_commands() { local commands; commands=() - _describe -t commands 'test action commands' commands "$@" + _describe -t commands 'exhaustive action commands' commands "$@" } -(( $+functions[_test__help__action_commands] )) || -_test__help__action_commands() { +(( $+functions[_exhaustive__help__action_commands] )) || +_exhaustive__help__action_commands() { local commands; commands=() - _describe -t commands 'test help action commands' commands "$@" + _describe -t commands 'exhaustive help action commands' commands "$@" } -(( $+functions[_test__alias_commands] )) || -_test__alias_commands() { +(( $+functions[_exhaustive__alias_commands] )) || +_exhaustive__alias_commands() { local commands; commands=() - _describe -t commands 'test alias commands' commands "$@" + _describe -t commands 'exhaustive alias commands' commands "$@" } -(( $+functions[_test__help__alias_commands] )) || -_test__help__alias_commands() { +(( $+functions[_exhaustive__help__alias_commands] )) || +_exhaustive__help__alias_commands() { local commands; commands=() - _describe -t commands 'test help alias commands' commands "$@" + _describe -t commands 'exhaustive help alias commands' commands "$@" } -(( $+functions[_test__help__quote__cmd-backslash_commands] )) || -_test__help__quote__cmd-backslash_commands() { +(( $+functions[_exhaustive__help__quote__cmd-backslash_commands] )) || +_exhaustive__help__quote__cmd-backslash_commands() { local commands; commands=() - _describe -t commands 'test help quote cmd-backslash commands' commands "$@" + _describe -t commands 'exhaustive help quote cmd-backslash commands' commands "$@" } -(( $+functions[_test__quote__cmd-backslash_commands] )) || -_test__quote__cmd-backslash_commands() { +(( $+functions[_exhaustive__quote__cmd-backslash_commands] )) || +_exhaustive__quote__cmd-backslash_commands() { local commands; commands=() - _describe -t commands 'test quote cmd-backslash commands' commands "$@" + _describe -t commands 'exhaustive quote cmd-backslash commands' commands "$@" } -(( $+functions[_test__quote__help__cmd-backslash_commands] )) || -_test__quote__help__cmd-backslash_commands() { +(( $+functions[_exhaustive__quote__help__cmd-backslash_commands] )) || +_exhaustive__quote__help__cmd-backslash_commands() { local commands; commands=() - _describe -t commands 'test quote help cmd-backslash commands' commands "$@" + _describe -t commands 'exhaustive quote help cmd-backslash commands' commands "$@" } -(( $+functions[_test__help__quote__cmd-backticks_commands] )) || -_test__help__quote__cmd-backticks_commands() { +(( $+functions[_exhaustive__help__quote__cmd-backticks_commands] )) || +_exhaustive__help__quote__cmd-backticks_commands() { local commands; commands=() - _describe -t commands 'test help quote cmd-backticks commands' commands "$@" + _describe -t commands 'exhaustive help quote cmd-backticks commands' commands "$@" } -(( $+functions[_test__quote__cmd-backticks_commands] )) || -_test__quote__cmd-backticks_commands() { +(( $+functions[_exhaustive__quote__cmd-backticks_commands] )) || +_exhaustive__quote__cmd-backticks_commands() { local commands; commands=() - _describe -t commands 'test quote cmd-backticks commands' commands "$@" + _describe -t commands 'exhaustive quote cmd-backticks commands' commands "$@" } -(( $+functions[_test__quote__help__cmd-backticks_commands] )) || -_test__quote__help__cmd-backticks_commands() { +(( $+functions[_exhaustive__quote__help__cmd-backticks_commands] )) || +_exhaustive__quote__help__cmd-backticks_commands() { local commands; commands=() - _describe -t commands 'test quote help cmd-backticks commands' commands "$@" + _describe -t commands 'exhaustive quote help cmd-backticks commands' commands "$@" } -(( $+functions[_test__help__quote__cmd-brackets_commands] )) || -_test__help__quote__cmd-brackets_commands() { +(( $+functions[_exhaustive__help__quote__cmd-brackets_commands] )) || +_exhaustive__help__quote__cmd-brackets_commands() { local commands; commands=() - _describe -t commands 'test help quote cmd-brackets commands' commands "$@" + _describe -t commands 'exhaustive help quote cmd-brackets commands' commands "$@" } -(( $+functions[_test__quote__cmd-brackets_commands] )) || -_test__quote__cmd-brackets_commands() { +(( $+functions[_exhaustive__quote__cmd-brackets_commands] )) || +_exhaustive__quote__cmd-brackets_commands() { local commands; commands=() - _describe -t commands 'test quote cmd-brackets commands' commands "$@" + _describe -t commands 'exhaustive quote cmd-brackets commands' commands "$@" } -(( $+functions[_test__quote__help__cmd-brackets_commands] )) || -_test__quote__help__cmd-brackets_commands() { +(( $+functions[_exhaustive__quote__help__cmd-brackets_commands] )) || +_exhaustive__quote__help__cmd-brackets_commands() { local commands; commands=() - _describe -t commands 'test quote help cmd-brackets commands' commands "$@" + _describe -t commands 'exhaustive quote help cmd-brackets commands' commands "$@" } -(( $+functions[_test__help__quote__cmd-double-quotes_commands] )) || -_test__help__quote__cmd-double-quotes_commands() { +(( $+functions[_exhaustive__help__quote__cmd-double-quotes_commands] )) || +_exhaustive__help__quote__cmd-double-quotes_commands() { local commands; commands=() - _describe -t commands 'test help quote cmd-double-quotes commands' commands "$@" + _describe -t commands 'exhaustive help quote cmd-double-quotes commands' commands "$@" } -(( $+functions[_test__quote__cmd-double-quotes_commands] )) || -_test__quote__cmd-double-quotes_commands() { +(( $+functions[_exhaustive__quote__cmd-double-quotes_commands] )) || +_exhaustive__quote__cmd-double-quotes_commands() { local commands; commands=() - _describe -t commands 'test quote cmd-double-quotes commands' commands "$@" + _describe -t commands 'exhaustive quote cmd-double-quotes commands' commands "$@" } -(( $+functions[_test__quote__help__cmd-double-quotes_commands] )) || -_test__quote__help__cmd-double-quotes_commands() { +(( $+functions[_exhaustive__quote__help__cmd-double-quotes_commands] )) || +_exhaustive__quote__help__cmd-double-quotes_commands() { local commands; commands=() - _describe -t commands 'test quote help cmd-double-quotes commands' commands "$@" + _describe -t commands 'exhaustive quote help cmd-double-quotes commands' commands "$@" } -(( $+functions[_test__help__quote__cmd-expansions_commands] )) || -_test__help__quote__cmd-expansions_commands() { +(( $+functions[_exhaustive__help__quote__cmd-expansions_commands] )) || +_exhaustive__help__quote__cmd-expansions_commands() { local commands; commands=() - _describe -t commands 'test help quote cmd-expansions commands' commands "$@" + _describe -t commands 'exhaustive help quote cmd-expansions commands' commands "$@" } -(( $+functions[_test__quote__cmd-expansions_commands] )) || -_test__quote__cmd-expansions_commands() { +(( $+functions[_exhaustive__quote__cmd-expansions_commands] )) || +_exhaustive__quote__cmd-expansions_commands() { local commands; commands=() - _describe -t commands 'test quote cmd-expansions commands' commands "$@" + _describe -t commands 'exhaustive quote cmd-expansions commands' commands "$@" } -(( $+functions[_test__quote__help__cmd-expansions_commands] )) || -_test__quote__help__cmd-expansions_commands() { +(( $+functions[_exhaustive__quote__help__cmd-expansions_commands] )) || +_exhaustive__quote__help__cmd-expansions_commands() { local commands; commands=() - _describe -t commands 'test quote help cmd-expansions commands' commands "$@" + _describe -t commands 'exhaustive quote help cmd-expansions commands' commands "$@" } -(( $+functions[_test__help__quote__cmd-single-quotes_commands] )) || -_test__help__quote__cmd-single-quotes_commands() { +(( $+functions[_exhaustive__help__quote__cmd-single-quotes_commands] )) || +_exhaustive__help__quote__cmd-single-quotes_commands() { local commands; commands=() - _describe -t commands 'test help quote cmd-single-quotes commands' commands "$@" + _describe -t commands 'exhaustive help quote cmd-single-quotes commands' commands "$@" } -(( $+functions[_test__quote__cmd-single-quotes_commands] )) || -_test__quote__cmd-single-quotes_commands() { +(( $+functions[_exhaustive__quote__cmd-single-quotes_commands] )) || +_exhaustive__quote__cmd-single-quotes_commands() { local commands; commands=() - _describe -t commands 'test quote cmd-single-quotes commands' commands "$@" + _describe -t commands 'exhaustive quote cmd-single-quotes commands' commands "$@" } -(( $+functions[_test__quote__help__cmd-single-quotes_commands] )) || -_test__quote__help__cmd-single-quotes_commands() { +(( $+functions[_exhaustive__quote__help__cmd-single-quotes_commands] )) || +_exhaustive__quote__help__cmd-single-quotes_commands() { local commands; commands=() - _describe -t commands 'test quote help cmd-single-quotes commands' commands "$@" + _describe -t commands 'exhaustive quote help cmd-single-quotes commands' commands "$@" } -(( $+functions[_test__complete_commands] )) || -_test__complete_commands() { +(( $+functions[_exhaustive__complete_commands] )) || +_exhaustive__complete_commands() { local commands; commands=() - _describe -t commands 'test complete commands' commands "$@" + _describe -t commands 'exhaustive complete commands' commands "$@" } -(( $+functions[_test__help__complete_commands] )) || -_test__help__complete_commands() { +(( $+functions[_exhaustive__help__complete_commands] )) || +_exhaustive__help__complete_commands() { local commands; commands=() - _describe -t commands 'test help complete commands' commands "$@" + _describe -t commands 'exhaustive help complete commands' commands "$@" } -(( $+functions[_test__help_commands] )) || -_test__help_commands() { +(( $+functions[_exhaustive__help_commands] )) || +_exhaustive__help_commands() { local commands; commands=( 'action:' \ 'quote:' \ @@ -580,29 +580,29 @@ _test__help_commands() { 'complete:Register shell completions for this program' \ 'help:Print this message or the help of the given subcommand(s)' \ ) - _describe -t commands 'test help commands' commands "$@" + _describe -t commands 'exhaustive help commands' commands "$@" } -(( $+functions[_test__help__help_commands] )) || -_test__help__help_commands() { +(( $+functions[_exhaustive__help__help_commands] )) || +_exhaustive__help__help_commands() { local commands; commands=() - _describe -t commands 'test help help commands' commands "$@" + _describe -t commands 'exhaustive help help commands' commands "$@" } -(( $+functions[_test__pacman__help_commands] )) || -_test__pacman__help_commands() { +(( $+functions[_exhaustive__pacman__help_commands] )) || +_exhaustive__pacman__help_commands() { local commands; commands=( 'one:' \ 'two:' \ 'help:Print this message or the help of the given subcommand(s)' \ ) - _describe -t commands 'test pacman help commands' commands "$@" + _describe -t commands 'exhaustive pacman help commands' commands "$@" } -(( $+functions[_test__pacman__help__help_commands] )) || -_test__pacman__help__help_commands() { +(( $+functions[_exhaustive__pacman__help__help_commands] )) || +_exhaustive__pacman__help__help_commands() { local commands; commands=() - _describe -t commands 'test pacman help help commands' commands "$@" + _describe -t commands 'exhaustive pacman help help commands' commands "$@" } -(( $+functions[_test__quote__help_commands] )) || -_test__quote__help_commands() { +(( $+functions[_exhaustive__quote__help_commands] )) || +_exhaustive__quote__help_commands() { local commands; commands=( 'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \ 'cmd-double-quotes:Can be "always", "auto", or "never"' \ @@ -612,67 +612,67 @@ _test__quote__help_commands() { 'cmd-expansions:Execute the shell command with \$SHELL' \ 'help:Print this message or the help of the given subcommand(s)' \ ) - _describe -t commands 'test quote help commands' commands "$@" + _describe -t commands 'exhaustive quote help commands' commands "$@" } -(( $+functions[_test__quote__help__help_commands] )) || -_test__quote__help__help_commands() { +(( $+functions[_exhaustive__quote__help__help_commands] )) || +_exhaustive__quote__help__help_commands() { local commands; commands=() - _describe -t commands 'test quote help help commands' commands "$@" + _describe -t commands 'exhaustive quote help help commands' commands "$@" } -(( $+functions[_test__help__hint_commands] )) || -_test__help__hint_commands() { +(( $+functions[_exhaustive__help__hint_commands] )) || +_exhaustive__help__hint_commands() { local commands; commands=() - _describe -t commands 'test help hint commands' commands "$@" + _describe -t commands 'exhaustive help hint commands' commands "$@" } -(( $+functions[_test__hint_commands] )) || -_test__hint_commands() { +(( $+functions[_exhaustive__hint_commands] )) || +_exhaustive__hint_commands() { local commands; commands=() - _describe -t commands 'test hint commands' commands "$@" + _describe -t commands 'exhaustive hint commands' commands "$@" } -(( $+functions[_test__help__last_commands] )) || -_test__help__last_commands() { +(( $+functions[_exhaustive__help__last_commands] )) || +_exhaustive__help__last_commands() { local commands; commands=() - _describe -t commands 'test help last commands' commands "$@" + _describe -t commands 'exhaustive help last commands' commands "$@" } -(( $+functions[_test__last_commands] )) || -_test__last_commands() { +(( $+functions[_exhaustive__last_commands] )) || +_exhaustive__last_commands() { local commands; commands=() - _describe -t commands 'test last commands' commands "$@" + _describe -t commands 'exhaustive last commands' commands "$@" } -(( $+functions[_test__help__pacman__one_commands] )) || -_test__help__pacman__one_commands() { +(( $+functions[_exhaustive__help__pacman__one_commands] )) || +_exhaustive__help__pacman__one_commands() { local commands; commands=() - _describe -t commands 'test help pacman one commands' commands "$@" + _describe -t commands 'exhaustive help pacman one commands' commands "$@" } -(( $+functions[_test__pacman__help__one_commands] )) || -_test__pacman__help__one_commands() { +(( $+functions[_exhaustive__pacman__help__one_commands] )) || +_exhaustive__pacman__help__one_commands() { local commands; commands=() - _describe -t commands 'test pacman help one commands' commands "$@" + _describe -t commands 'exhaustive pacman help one commands' commands "$@" } -(( $+functions[_test__pacman__one_commands] )) || -_test__pacman__one_commands() { +(( $+functions[_exhaustive__pacman__one_commands] )) || +_exhaustive__pacman__one_commands() { local commands; commands=() - _describe -t commands 'test pacman one commands' commands "$@" + _describe -t commands 'exhaustive pacman one commands' commands "$@" } -(( $+functions[_test__help__pacman_commands] )) || -_test__help__pacman_commands() { +(( $+functions[_exhaustive__help__pacman_commands] )) || +_exhaustive__help__pacman_commands() { local commands; commands=( 'one:' \ 'two:' \ ) - _describe -t commands 'test help pacman commands' commands "$@" + _describe -t commands 'exhaustive help pacman commands' commands "$@" } -(( $+functions[_test__pacman_commands] )) || -_test__pacman_commands() { +(( $+functions[_exhaustive__pacman_commands] )) || +_exhaustive__pacman_commands() { local commands; commands=( 'one:' \ 'two:' \ 'help:Print this message or the help of the given subcommand(s)' \ ) - _describe -t commands 'test pacman commands' commands "$@" + _describe -t commands 'exhaustive pacman commands' commands "$@" } -(( $+functions[_test__help__quote_commands] )) || -_test__help__quote_commands() { +(( $+functions[_exhaustive__help__quote_commands] )) || +_exhaustive__help__quote_commands() { local commands; commands=( 'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \ 'cmd-double-quotes:Can be "always", "auto", or "never"' \ @@ -681,10 +681,10 @@ _test__help__quote_commands() { 'cmd-brackets:List packages \[filter\]' \ 'cmd-expansions:Execute the shell command with \$SHELL' \ ) - _describe -t commands 'test help quote commands' commands "$@" + _describe -t commands 'exhaustive help quote commands' commands "$@" } -(( $+functions[_test__quote_commands] )) || -_test__quote_commands() { +(( $+functions[_exhaustive__quote_commands] )) || +_exhaustive__quote_commands() { local commands; commands=( 'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \ 'cmd-double-quotes:Can be "always", "auto", or "never"' \ @@ -694,36 +694,36 @@ _test__quote_commands() { 'cmd-expansions:Execute the shell command with \$SHELL' \ 'help:Print this message or the help of the given subcommand(s)' \ ) - _describe -t commands 'test quote commands' commands "$@" + _describe -t commands 'exhaustive quote commands' commands "$@" } -(( $+functions[_test__help__pacman__two_commands] )) || -_test__help__pacman__two_commands() { +(( $+functions[_exhaustive__help__pacman__two_commands] )) || +_exhaustive__help__pacman__two_commands() { local commands; commands=() - _describe -t commands 'test help pacman two commands' commands "$@" + _describe -t commands 'exhaustive help pacman two commands' commands "$@" } -(( $+functions[_test__pacman__help__two_commands] )) || -_test__pacman__help__two_commands() { +(( $+functions[_exhaustive__pacman__help__two_commands] )) || +_exhaustive__pacman__help__two_commands() { local commands; commands=() - _describe -t commands 'test pacman help two commands' commands "$@" + _describe -t commands 'exhaustive pacman help two commands' commands "$@" } -(( $+functions[_test__pacman__two_commands] )) || -_test__pacman__two_commands() { +(( $+functions[_exhaustive__pacman__two_commands] )) || +_exhaustive__pacman__two_commands() { local commands; commands=() - _describe -t commands 'test pacman two commands' commands "$@" + _describe -t commands 'exhaustive pacman two commands' commands "$@" } -(( $+functions[_test__help__value_commands] )) || -_test__help__value_commands() { +(( $+functions[_exhaustive__help__value_commands] )) || +_exhaustive__help__value_commands() { local commands; commands=() - _describe -t commands 'test help value commands' commands "$@" + _describe -t commands 'exhaustive help value commands' commands "$@" } -(( $+functions[_test__value_commands] )) || -_test__value_commands() { +(( $+functions[_exhaustive__value_commands] )) || +_exhaustive__value_commands() { local commands; commands=() - _describe -t commands 'test value commands' commands "$@" + _describe -t commands 'exhaustive value commands' commands "$@" } -if [ "$funcstack[1]" = "_test" ]; then - _test "$@" +if [ "$funcstack[1]" = "_exhaustive" ]; then + _exhaustive "$@" else - compdef _test test + compdef _exhaustive exhaustive fi diff --git a/clap_complete/tests/snapshots/home/static/test/fish/fish/completions/test.fish b/clap_complete/tests/snapshots/home/static/test/fish/fish/completions/test.fish deleted file mode 100644 index a1c5714b..00000000 --- a/clap_complete/tests/snapshots/home/static/test/fish/fish/completions/test.fish +++ /dev/null @@ -1,128 +0,0 @@ -complete -c test -n "__fish_use_subcommand" -l generate -d 'generate' -r -f -a "{bash ,elvish ,fish ,powershell ,zsh }" -complete -c test -n "__fish_use_subcommand" -l global -d 'everywhere' -complete -c test -n "__fish_use_subcommand" -s h -l help -d 'Print help' -complete -c test -n "__fish_use_subcommand" -s V -l version -d 'Print version' -complete -c test -n "__fish_use_subcommand" -f -a "action" -complete -c test -n "__fish_use_subcommand" -f -a "quote" -complete -c test -n "__fish_use_subcommand" -f -a "value" -complete -c test -n "__fish_use_subcommand" -f -a "pacman" -complete -c test -n "__fish_use_subcommand" -f -a "last" -complete -c test -n "__fish_use_subcommand" -f -a "alias" -complete -c test -n "__fish_use_subcommand" -f -a "hint" -complete -c test -n "__fish_use_subcommand" -f -a "complete" -d 'Register shell completions for this program' -complete -c test -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c test -n "__fish_seen_subcommand_from action" -l set -d 'value' -r -complete -c test -n "__fish_seen_subcommand_from action" -l choice -d 'enum' -r -f -a "{first ,second }" -complete -c test -n "__fish_seen_subcommand_from action" -l set-true -d 'bool' -complete -c test -n "__fish_seen_subcommand_from action" -l count -d 'number' -complete -c test -n "__fish_seen_subcommand_from action" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from action" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from action" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l single-quotes -d 'Can be \'always\', \'auto\', or \'never\'' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l double-quotes -d 'Can be "always", "auto", or "never"' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l backticks -d 'For more information see `echo test`' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l backslash -d 'Avoid \'\\n\'' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l brackets -d 'List packages [filter]' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l expansions -d 'Execute the shell command with $SHELL' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-single-quotes" -d 'Can be \'always\', \'auto\', or \'never\'' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-double-quotes" -d 'Can be "always", "auto", or "never"' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-backticks" -d 'For more information see `echo test`' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-backslash" -d 'Avoid \'\\n\'' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-brackets" -d 'List packages [filter]' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-expansions" -d 'Execute the shell command with $SHELL' -complete -c test -n "__fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-single-quotes" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-single-quotes" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-single-quotes" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-double-quotes" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-double-quotes" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-double-quotes" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-backticks" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-backticks" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-backticks" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-backslash" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-backslash" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-backslash" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-brackets" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-brackets" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-brackets" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-expansions" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-expansions" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from cmd-expansions" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-single-quotes" -d 'Can be \'always\', \'auto\', or \'never\'' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-double-quotes" -d 'Can be "always", "auto", or "never"' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-backticks" -d 'For more information see `echo test`' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-backslash" -d 'Avoid \'\\n\'' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-brackets" -d 'List packages [filter]' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "cmd-expansions" -d 'Execute the shell command with $SHELL' -complete -c test -n "__fish_seen_subcommand_from quote; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c test -n "__fish_seen_subcommand_from value" -l delim -r -complete -c test -n "__fish_seen_subcommand_from value" -l tuple -r -complete -c test -n "__fish_seen_subcommand_from value" -l require-eq -r -complete -c test -n "__fish_seen_subcommand_from value" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from value" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from value" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -f -a "one" -complete -c test -n "__fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -f -a "two" -complete -c test -n "__fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c test -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from one" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from one" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from one" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from two" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from two" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from two" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -f -a "one" -complete -c test -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -f -a "two" -complete -c test -n "__fish_seen_subcommand_from pacman; and __fish_seen_subcommand_from help; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c test -n "__fish_seen_subcommand_from last" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from last" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from last" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from alias" -s o -s O -l option -l opt -d 'cmd option' -r -complete -c test -n "__fish_seen_subcommand_from alias" -s f -s F -l flag -l flg -d 'cmd flag' -complete -c test -n "__fish_seen_subcommand_from alias" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from alias" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from alias" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from hint" -l choice -r -f -a "{bash ,fish ,zsh }" -complete -c test -n "__fish_seen_subcommand_from hint" -l unknown -r -complete -c test -n "__fish_seen_subcommand_from hint" -l other -r -f -complete -c test -n "__fish_seen_subcommand_from hint" -s p -l path -r -F -complete -c test -n "__fish_seen_subcommand_from hint" -s f -l file -r -F -complete -c test -n "__fish_seen_subcommand_from hint" -s d -l dir -r -f -a "(__fish_complete_directories)" -complete -c test -n "__fish_seen_subcommand_from hint" -s e -l exe -r -F -complete -c test -n "__fish_seen_subcommand_from hint" -l cmd-name -r -f -a "(__fish_complete_command)" -complete -c test -n "__fish_seen_subcommand_from hint" -s c -l cmd -r -f -a "(__fish_complete_command)" -complete -c test -n "__fish_seen_subcommand_from hint" -s u -l user -r -f -a "(__fish_complete_users)" -complete -c test -n "__fish_seen_subcommand_from hint" -s H -l host -r -f -a "(__fish_print_hostnames)" -complete -c test -n "__fish_seen_subcommand_from hint" -l url -r -f -complete -c test -n "__fish_seen_subcommand_from hint" -l email -r -f -complete -c test -n "__fish_seen_subcommand_from hint" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from hint" -s h -l help -d 'Print help' -complete -c test -n "__fish_seen_subcommand_from hint" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from complete" -l shell -d 'Specify shell to complete for' -r -f -a "{bash }" -complete -c test -n "__fish_seen_subcommand_from complete" -l register -d 'Path to write completion-registration to' -r -F -complete -c test -n "__fish_seen_subcommand_from complete" -l global -d 'everywhere' -complete -c test -n "__fish_seen_subcommand_from complete" -s h -l help -d 'Print help (see more with \'--help\')' -complete -c test -n "__fish_seen_subcommand_from complete" -s V -l version -d 'Print version' -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "action" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "quote" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "value" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "pacman" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "last" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "alias" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "hint" -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "complete" -d 'Register shell completions for this program' -complete -c test -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from action; and not __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from value; and not __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from last; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from hint; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c test -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-single-quotes" -d 'Can be \'always\', \'auto\', or \'never\'' -complete -c test -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-double-quotes" -d 'Can be "always", "auto", or "never"' -complete -c test -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-backticks" -d 'For more information see `echo test`' -complete -c test -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-backslash" -d 'Avoid \'\\n\'' -complete -c test -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-brackets" -d 'List packages [filter]' -complete -c test -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from quote; and not __fish_seen_subcommand_from cmd-single-quotes; and not __fish_seen_subcommand_from cmd-double-quotes; and not __fish_seen_subcommand_from cmd-backticks; and not __fish_seen_subcommand_from cmd-backslash; and not __fish_seen_subcommand_from cmd-brackets; and not __fish_seen_subcommand_from cmd-expansions" -f -a "cmd-expansions" -d 'Execute the shell command with $SHELL' -complete -c test -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two" -f -a "one" -complete -c test -n "__fish_seen_subcommand_from help; and __fish_seen_subcommand_from pacman; and not __fish_seen_subcommand_from one; and not __fish_seen_subcommand_from two" -f -a "two" diff --git a/clap_complete/tests/testsuite/bash.rs b/clap_complete/tests/testsuite/bash.rs index e2a57839..b9692a42 100644 --- a/clap_complete/tests/testsuite/bash.rs +++ b/clap_complete/tests/testsuite/bash.rs @@ -141,7 +141,7 @@ fn subcommand_last() { #[test] #[cfg(unix)] fn register_completion() { - common::register_example("static", "test", completest::Shell::Bash); + common::register_example("static", "exhaustive", completest::Shell::Bash); } #[test] @@ -152,9 +152,9 @@ fn complete() { } let term = completest::Term::new(); - let mut runtime = common::load_runtime("static", "test", completest::Shell::Bash); + let mut runtime = common::load_runtime("static", "exhaustive", completest::Shell::Bash); - let input = "test \t\t"; + let input = "exhaustive \t\t"; let expected = r#"% -h --global --help action value last hint help -V --generate --version quote pacman alias complete"#; @@ -165,5 +165,5 @@ fn complete() { #[test] #[cfg(unix)] fn register_dynamic_completion() { - common::register_example("dynamic", "test", completest::Shell::Bash); + common::register_example("dynamic", "exhaustive", completest::Shell::Bash); } diff --git a/clap_complete/tests/testsuite/dynamic.rs b/clap_complete/tests/testsuite/dynamic.rs index 40ae27a1..8ab7461d 100644 --- a/clap_complete/tests/testsuite/dynamic.rs +++ b/clap_complete/tests/testsuite/dynamic.rs @@ -2,7 +2,7 @@ #[test] fn suggest_subcommand_subset() { - let name = "test"; + let name = "exhaustive"; let mut cmd = clap::Command::new(name) .subcommand(clap::Command::new("hello-world")) .subcommand(clap::Command::new("hello-moon")) @@ -27,7 +27,7 @@ fn suggest_subcommand_subset() { #[test] fn suggest_long_flag_subset() { - let name = "test"; + let name = "exhaustive"; let mut cmd = clap::Command::new(name) .arg( clap::Arg::new("hello-world") @@ -64,7 +64,7 @@ fn suggest_long_flag_subset() { #[test] fn suggest_possible_value_subset() { - let name = "test"; + let name = "exhaustive"; let mut cmd = clap::Command::new(name).arg(clap::Arg::new("hello-world").value_parser([ "hello-world", "hello-moon", @@ -90,7 +90,7 @@ fn suggest_possible_value_subset() { #[test] fn suggest_additional_short_flags() { - let name = "test"; + let name = "exhaustive"; let mut cmd = clap::Command::new(name) .arg( clap::Arg::new("a") diff --git a/clap_complete/tests/testsuite/elvish.rs b/clap_complete/tests/testsuite/elvish.rs index 46be7404..cf12d082 100644 --- a/clap_complete/tests/testsuite/elvish.rs +++ b/clap_complete/tests/testsuite/elvish.rs @@ -123,7 +123,7 @@ fn subcommand_last() { #[test] #[cfg(unix)] fn register_completion() { - common::register_example("static", "test", completest::Shell::Elvish); + common::register_example("static", "exhaustive", completest::Shell::Elvish); } #[test] @@ -134,10 +134,10 @@ fn complete() { } let term = completest::Term::new(); - let mut runtime = common::load_runtime("static", "test", completest::Shell::Elvish); + let mut runtime = common::load_runtime("static", "exhaustive", completest::Shell::Elvish); - let input = "test \t"; - let expected = r#"% test --generate + let input = "exhaustive \t"; + let expected = r#"% exhaustive --generate --generate generate --global everywhere --help Print help diff --git a/clap_complete/tests/testsuite/fish.rs b/clap_complete/tests/testsuite/fish.rs index ed87fc29..104919ba 100644 --- a/clap_complete/tests/testsuite/fish.rs +++ b/clap_complete/tests/testsuite/fish.rs @@ -123,7 +123,7 @@ fn subcommand_last() { #[test] #[cfg(unix)] fn register_completion() { - common::register_example("static", "test", completest::Shell::Fish); + common::register_example("static", "exhaustive", completest::Shell::Fish); } #[test] @@ -134,10 +134,10 @@ fn complete() { } let term = completest::Term::new(); - let mut runtime = common::load_runtime("static", "test", completest::Shell::Fish); + let mut runtime = common::load_runtime("static", "exhaustive", completest::Shell::Fish); - let input = "test \t"; - let expected = r#"% test + let input = "exhaustive \t"; + let expected = r#"% exhaustive action complete (Register shell completions for this program) hint pacman value alias help (Print this message or the help of the given subcommand(s)) last quote"#; let actual = runtime.complete(input, &term).unwrap(); diff --git a/clap_complete/tests/testsuite/zsh.rs b/clap_complete/tests/testsuite/zsh.rs index c9760aba..d6b51ab0 100644 --- a/clap_complete/tests/testsuite/zsh.rs +++ b/clap_complete/tests/testsuite/zsh.rs @@ -123,7 +123,7 @@ fn subcommand_last() { #[test] #[cfg(unix)] fn register_completion() { - common::register_example("static", "test", completest::Shell::Zsh); + common::register_example("static", "exhaustive", completest::Shell::Zsh); } #[test] @@ -134,10 +134,10 @@ fn complete() { } let term = completest::Term::new(); - let mut runtime = common::load_runtime("static", "test", completest::Shell::Zsh); + let mut runtime = common::load_runtime("static", "exhaustive", completest::Shell::Zsh); - let input = "test \t"; - let expected = r#"% test + let input = "exhaustive \t"; + let expected = r#"% exhaustive complete -- Register shell completions for this program help -- Print this message or the help of the given subcommand(s) pacman action alias value quote hint last --"#; From 12e1877627a8ef8b98f048b81225876a7220317b Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 28 Jul 2023 14:10:15 -0500 Subject: [PATCH 6/9] fix(complete): Fix bash dynamic completions --- clap_complete/src/dynamic/shells/bash.rs | 6 ++---- .../tests/snapshots/home/dynamic/exhaustive/bash/.bashrc | 2 +- clap_complete/tests/snapshots/register_minimal.bash | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/clap_complete/src/dynamic/shells/bash.rs b/clap_complete/src/dynamic/shells/bash.rs index e6276eb0..ebc43c69 100644 --- a/clap_complete/src/dynamic/shells/bash.rs +++ b/clap_complete/src/dynamic/shells/bash.rs @@ -27,6 +27,7 @@ impl crate::dynamic::Completer for Bash { let script = r#" _clap_complete_NAME() { + export IFS=$'\013' export _CLAP_COMPLETE_INDEX=${COMP_CWORD} export _CLAP_COMPLETE_COMP_TYPE=${COMP_TYPE} if compopt +o nospace 2> /dev/null; then @@ -34,7 +35,6 @@ _clap_complete_NAME() { else export _CLAP_COMPLETE_SPACE=true fi - export _CLAP_COMPLETE_IFS=$'\013' COMPREPLY=( $("COMPLETER" complete --shell bash -- "${COMP_WORDS[@]}") ) if [[ $? != 0 ]]; then unset COMPREPLY @@ -70,9 +70,7 @@ complete -o nospace -o bashdefault -F _clap_complete_NAME BIN let _space: Option = std::env::var("_CLAP_COMPLETE_SPACE") .ok() .and_then(|i| i.parse().ok()); - let ifs: Option = std::env::var("_CLAP_COMPLETE_IFS") - .ok() - .and_then(|i| i.parse().ok()); + let ifs: Option = std::env::var("IFS").ok().and_then(|i| i.parse().ok()); let completions = crate::dynamic::complete(cmd, args, index, current_dir)?; for (i, completion) in completions.iter().enumerate() { diff --git a/clap_complete/tests/snapshots/home/dynamic/exhaustive/bash/.bashrc b/clap_complete/tests/snapshots/home/dynamic/exhaustive/bash/.bashrc index 9e8115aa..a1b28384 100644 --- a/clap_complete/tests/snapshots/home/dynamic/exhaustive/bash/.bashrc +++ b/clap_complete/tests/snapshots/home/dynamic/exhaustive/bash/.bashrc @@ -2,6 +2,7 @@ PS1='% ' . /etc/bash_completion _clap_complete_exhaustive() { + export IFS=$'\013' export _CLAP_COMPLETE_INDEX=${COMP_CWORD} export _CLAP_COMPLETE_COMP_TYPE=${COMP_TYPE} if compopt +o nospace 2> /dev/null; then @@ -9,7 +10,6 @@ _clap_complete_exhaustive() { else export _CLAP_COMPLETE_SPACE=true fi - export _CLAP_COMPLETE_IFS=$'\013' COMPREPLY=( $("exhaustive" complete --shell bash -- "${COMP_WORDS[@]}") ) if [[ $? != 0 ]]; then unset COMPREPLY diff --git a/clap_complete/tests/snapshots/register_minimal.bash b/clap_complete/tests/snapshots/register_minimal.bash index 3779a382..24ae5784 100644 --- a/clap_complete/tests/snapshots/register_minimal.bash +++ b/clap_complete/tests/snapshots/register_minimal.bash @@ -1,5 +1,6 @@ _clap_complete_my_app() { + export IFS=$'/013' export _CLAP_COMPLETE_INDEX=${COMP_CWORD} export _CLAP_COMPLETE_COMP_TYPE=${COMP_TYPE} if compopt +o nospace 2> /dev/null; then @@ -7,7 +8,6 @@ _clap_complete_my_app() { else export _CLAP_COMPLETE_SPACE=true fi - export _CLAP_COMPLETE_IFS=$'/013' COMPREPLY=( $("my-app" complete --shell bash -- "${COMP_WORDS[@]}") ) if [[ $? != 0 ]]; then unset COMPREPLY From edabdf72b59b7372f5367d4b0b0cee959cce9ea2 Mon Sep 17 00:00:00 2001 From: Roland Fredenhagen Date: Fri, 28 Jul 2023 19:18:49 +0700 Subject: [PATCH 7/9] fix(complete): Only return imidiate child subcommands --- clap_complete/src/dynamic/completer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clap_complete/src/dynamic/completer.rs b/clap_complete/src/dynamic/completer.rs index 4fadf2f6..2089f153 100644 --- a/clap_complete/src/dynamic/completer.rs +++ b/clap_complete/src/dynamic/completer.rs @@ -270,7 +270,7 @@ fn complete_subcommand(value: &str, cmd: &clap::Command) -> Vec { value ); - let mut scs = crate::generator::utils::all_subcommands(cmd) + let mut scs = crate::generator::utils::subcommands(cmd) .into_iter() .filter(|x| x.0.starts_with(value)) .map(|x| OsString::from(&x.0)) From 0669994bbcb7252a97e98c8d37408726bd9db05f Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 28 Jul 2023 14:18:13 -0500 Subject: [PATCH 8/9] style: Make clippy happy --- clap_complete/examples/exhaustive.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/clap_complete/examples/exhaustive.rs b/clap_complete/examples/exhaustive.rs index 838341dd..9ebdde62 100644 --- a/clap_complete/examples/exhaustive.rs +++ b/clap_complete/examples/exhaustive.rs @@ -26,6 +26,7 @@ fn print_completions(gen: G, cmd: &mut clap::Command) { generate(gen, cmd, cmd.get_name().to_string(), &mut std::io::stdout()); } +#[allow(clippy::let_and_return)] fn cli() -> clap::Command { let cli = clap::Command::new("exhaustive") .version("3.0") From a59c175396ebf72d6546d4681e1ff4c8871a152d Mon Sep 17 00:00:00 2001 From: Roland Fredenhagen Date: Fri, 28 Jul 2023 19:11:21 +0700 Subject: [PATCH 9/9] fix(complete): Return leading dash on short args --- clap_complete/src/dynamic/completer.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clap_complete/src/dynamic/completer.rs b/clap_complete/src/dynamic/completer.rs index 2089f153..327e557e 100644 --- a/clap_complete/src/dynamic/completer.rs +++ b/clap_complete/src/dynamic/completer.rs @@ -133,12 +133,17 @@ fn complete_arg( } if arg.is_empty() || arg.is_stdio() || arg.is_short() { + let dash_or_arg = if arg.is_empty() { + "-".into() + } else { + arg.to_value_os().to_string_lossy() + }; // HACK: Assuming knowledge of is_stdio completions.extend( crate::generator::utils::shorts_and_visible_aliases(cmd) .into_iter() // HACK: Need better `OsStr` manipulation - .map(|f| format!("{}{}", arg.to_value_os().to_string_lossy(), f).into()), + .map(|f| format!("{}{}", dash_or_arg, f).into()), ); } }