Merge pull request #5049 from epage/dyn

test(complete): Unblock E2E dynamic completion tests
This commit is contained in:
Ed Page 2023-07-28 15:15:43 -05:00 committed by GitHub
commit a3d93f485f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 681 additions and 529 deletions

View file

@ -1,3 +1,5 @@
#[cfg(feature = "unstable-dynamic")]
use clap::{FromArgMatches, Subcommand};
use clap_complete::{generate, Generator, Shell}; use clap_complete::{generate, Generator, Shell};
fn main() { fn main() {
@ -6,17 +8,27 @@ fn main() {
let mut cmd = cli(); let mut cmd = cli();
eprintln!("Generating completion file for {generator}..."); eprintln!("Generating completion file for {generator}...");
print_completions(*generator, &mut cmd); print_completions(*generator, &mut cmd);
} else { return;
println!("{:?}", matches);
} }
#[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<G: Generator>(gen: G, cmd: &mut clap::Command) { fn print_completions<G: Generator>(gen: G, cmd: &mut clap::Command) {
generate(gen, cmd, cmd.get_name().to_string(), &mut std::io::stdout()); generate(gen, cmd, cmd.get_name().to_string(), &mut std::io::stdout());
} }
#[allow(clippy::let_and_return)]
fn cli() -> clap::Command { fn cli() -> clap::Command {
clap::Command::new("test") let cli = clap::Command::new("exhaustive")
.version("3.0") .version("3.0")
.propagate_version(true) .propagate_version(true)
.args([ .args([
@ -27,6 +39,7 @@ fn cli() -> clap::Command {
.help("everywhere"), .help("everywhere"),
clap::Arg::new("generate") clap::Arg::new("generate")
.long("generate") .long("generate")
.value_name("SHELL")
.value_parser(clap::value_parser!(Shell)) .value_parser(clap::value_parser!(Shell))
.help("generate"), .help("generate"),
]) ])
@ -173,5 +186,8 @@ fn cli() -> clap::Command {
.long("email") .long("email")
.value_hint(clap::ValueHint::EmailAddress), .value_hint(clap::ValueHint::EmailAddress),
]), ]),
]) ]);
#[cfg(feature = "unstable-dynamic")]
let cli = clap_complete::dynamic::shells::CompleteCommand::augment_subcommands(cli);
cli
} }

View file

@ -133,12 +133,17 @@ fn complete_arg(
} }
if arg.is_empty() || arg.is_stdio() || arg.is_short() { 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 // HACK: Assuming knowledge of is_stdio
completions.extend( completions.extend(
crate::generator::utils::shorts_and_visible_aliases(cmd) crate::generator::utils::shorts_and_visible_aliases(cmd)
.into_iter() .into_iter()
// HACK: Need better `OsStr` manipulation // 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()),
); );
} }
} }
@ -270,7 +275,7 @@ fn complete_subcommand(value: &str, cmd: &clap::Command) -> Vec<OsString> {
value value
); );
let mut scs = crate::generator::utils::all_subcommands(cmd) let mut scs = crate::generator::utils::subcommands(cmd)
.into_iter() .into_iter()
.filter(|x| x.0.starts_with(value)) .filter(|x| x.0.starts_with(value))
.map(|x| OsString::from(&x.0)) .map(|x| OsString::from(&x.0))

View file

@ -27,6 +27,7 @@ impl crate::dynamic::Completer for Bash {
let script = r#" let script = r#"
_clap_complete_NAME() { _clap_complete_NAME() {
export IFS=$'\013'
export _CLAP_COMPLETE_INDEX=${COMP_CWORD} export _CLAP_COMPLETE_INDEX=${COMP_CWORD}
export _CLAP_COMPLETE_COMP_TYPE=${COMP_TYPE} export _CLAP_COMPLETE_COMP_TYPE=${COMP_TYPE}
if compopt +o nospace 2> /dev/null; then if compopt +o nospace 2> /dev/null; then
@ -34,7 +35,6 @@ _clap_complete_NAME() {
else else
export _CLAP_COMPLETE_SPACE=true export _CLAP_COMPLETE_SPACE=true
fi fi
export _CLAP_COMPLETE_IFS=$'\013'
COMPREPLY=( $("COMPLETER" complete --shell bash -- "${COMP_WORDS[@]}") ) COMPREPLY=( $("COMPLETER" complete --shell bash -- "${COMP_WORDS[@]}") )
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
unset COMPREPLY unset COMPREPLY
@ -70,9 +70,7 @@ complete -o nospace -o bashdefault -F _clap_complete_NAME BIN
let _space: Option<bool> = std::env::var("_CLAP_COMPLETE_SPACE") let _space: Option<bool> = std::env::var("_CLAP_COMPLETE_SPACE")
.ok() .ok()
.and_then(|i| i.parse().ok()); .and_then(|i| i.parse().ok());
let ifs: Option<String> = std::env::var("_CLAP_COMPLETE_IFS") let ifs: Option<String> = std::env::var("IFS").ok().and_then(|i| i.parse().ok());
.ok()
.and_then(|i| i.parse().ok());
let completions = crate::dynamic::complete(cmd, args, index, current_dir)?; let completions = crate::dynamic::complete(cmd, args, index, current_dir)?;
for (i, completion) in completions.iter().enumerate() { for (i, completion) in completions.iter().enumerate() {

View file

@ -0,0 +1,22 @@
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
export _CLAP_COMPLETE_SPACE=false
else
export _CLAP_COMPLETE_SPACE=true
fi
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_exhaustive exhaustive

View file

@ -1,6 +1,6 @@
PS1='% ' PS1='% '
. /etc/bash_completion . /etc/bash_completion
_test() { _exhaustive() {
local i cur prev opts cmd local i cur prev opts cmd
COMPREPLY=() COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
@ -12,139 +12,145 @@ _test() {
do do
case "${cmd},${i}" in case "${cmd},${i}" in
",$1") ",$1")
cmd="test" cmd="exhaustive"
;; ;;
test,action) exhaustive,action)
cmd="test__action" cmd="exhaustive__action"
;; ;;
test,alias) exhaustive,alias)
cmd="test__alias" cmd="exhaustive__alias"
;; ;;
test,help) exhaustive,complete)
cmd="test__help" cmd="exhaustive__complete"
;; ;;
test,hint) exhaustive,help)
cmd="test__hint" cmd="exhaustive__help"
;; ;;
test,last) exhaustive,hint)
cmd="test__last" cmd="exhaustive__hint"
;; ;;
test,pacman) exhaustive,last)
cmd="test__pacman" cmd="exhaustive__last"
;; ;;
test,quote) exhaustive,pacman)
cmd="test__quote" cmd="exhaustive__pacman"
;; ;;
test,value) exhaustive,quote)
cmd="test__value" cmd="exhaustive__quote"
;; ;;
test__help,action) exhaustive,value)
cmd="test__help__action" cmd="exhaustive__value"
;; ;;
test__help,alias) exhaustive__help,action)
cmd="test__help__alias" cmd="exhaustive__help__action"
;; ;;
test__help,help) exhaustive__help,alias)
cmd="test__help__help" cmd="exhaustive__help__alias"
;; ;;
test__help,hint) exhaustive__help,complete)
cmd="test__help__hint" cmd="exhaustive__help__complete"
;; ;;
test__help,last) exhaustive__help,help)
cmd="test__help__last" cmd="exhaustive__help__help"
;; ;;
test__help,pacman) exhaustive__help,hint)
cmd="test__help__pacman" cmd="exhaustive__help__hint"
;; ;;
test__help,quote) exhaustive__help,last)
cmd="test__help__quote" cmd="exhaustive__help__last"
;; ;;
test__help,value) exhaustive__help,pacman)
cmd="test__help__value" cmd="exhaustive__help__pacman"
;; ;;
test__help__pacman,one) exhaustive__help,quote)
cmd="test__help__pacman__one" cmd="exhaustive__help__quote"
;; ;;
test__help__pacman,two) exhaustive__help,value)
cmd="test__help__pacman__two" cmd="exhaustive__help__value"
;; ;;
test__help__quote,cmd-backslash) exhaustive__help__pacman,one)
cmd="test__help__quote__cmd__backslash" cmd="exhaustive__help__pacman__one"
;; ;;
test__help__quote,cmd-backticks) exhaustive__help__pacman,two)
cmd="test__help__quote__cmd__backticks" cmd="exhaustive__help__pacman__two"
;; ;;
test__help__quote,cmd-brackets) exhaustive__help__quote,cmd-backslash)
cmd="test__help__quote__cmd__brackets" cmd="exhaustive__help__quote__cmd__backslash"
;; ;;
test__help__quote,cmd-double-quotes) exhaustive__help__quote,cmd-backticks)
cmd="test__help__quote__cmd__double__quotes" cmd="exhaustive__help__quote__cmd__backticks"
;; ;;
test__help__quote,cmd-expansions) exhaustive__help__quote,cmd-brackets)
cmd="test__help__quote__cmd__expansions" cmd="exhaustive__help__quote__cmd__brackets"
;; ;;
test__help__quote,cmd-single-quotes) exhaustive__help__quote,cmd-double-quotes)
cmd="test__help__quote__cmd__single__quotes" cmd="exhaustive__help__quote__cmd__double__quotes"
;; ;;
test__pacman,help) exhaustive__help__quote,cmd-expansions)
cmd="test__pacman__help" cmd="exhaustive__help__quote__cmd__expansions"
;; ;;
test__pacman,one) exhaustive__help__quote,cmd-single-quotes)
cmd="test__pacman__one" cmd="exhaustive__help__quote__cmd__single__quotes"
;; ;;
test__pacman,two) exhaustive__pacman,help)
cmd="test__pacman__two" cmd="exhaustive__pacman__help"
;; ;;
test__pacman__help,help) exhaustive__pacman,one)
cmd="test__pacman__help__help" cmd="exhaustive__pacman__one"
;; ;;
test__pacman__help,one) exhaustive__pacman,two)
cmd="test__pacman__help__one" cmd="exhaustive__pacman__two"
;; ;;
test__pacman__help,two) exhaustive__pacman__help,help)
cmd="test__pacman__help__two" cmd="exhaustive__pacman__help__help"
;; ;;
test__quote,cmd-backslash) exhaustive__pacman__help,one)
cmd="test__quote__cmd__backslash" cmd="exhaustive__pacman__help__one"
;; ;;
test__quote,cmd-backticks) exhaustive__pacman__help,two)
cmd="test__quote__cmd__backticks" cmd="exhaustive__pacman__help__two"
;; ;;
test__quote,cmd-brackets) exhaustive__quote,cmd-backslash)
cmd="test__quote__cmd__brackets" cmd="exhaustive__quote__cmd__backslash"
;; ;;
test__quote,cmd-double-quotes) exhaustive__quote,cmd-backticks)
cmd="test__quote__cmd__double__quotes" cmd="exhaustive__quote__cmd__backticks"
;; ;;
test__quote,cmd-expansions) exhaustive__quote,cmd-brackets)
cmd="test__quote__cmd__expansions" cmd="exhaustive__quote__cmd__brackets"
;; ;;
test__quote,cmd-single-quotes) exhaustive__quote,cmd-double-quotes)
cmd="test__quote__cmd__single__quotes" cmd="exhaustive__quote__cmd__double__quotes"
;; ;;
test__quote,help) exhaustive__quote,cmd-expansions)
cmd="test__quote__help" cmd="exhaustive__quote__cmd__expansions"
;; ;;
test__quote__help,cmd-backslash) exhaustive__quote,cmd-single-quotes)
cmd="test__quote__help__cmd__backslash" cmd="exhaustive__quote__cmd__single__quotes"
;; ;;
test__quote__help,cmd-backticks) exhaustive__quote,help)
cmd="test__quote__help__cmd__backticks" cmd="exhaustive__quote__help"
;; ;;
test__quote__help,cmd-brackets) exhaustive__quote__help,cmd-backslash)
cmd="test__quote__help__cmd__brackets" cmd="exhaustive__quote__help__cmd__backslash"
;; ;;
test__quote__help,cmd-double-quotes) exhaustive__quote__help,cmd-backticks)
cmd="test__quote__help__cmd__double__quotes" cmd="exhaustive__quote__help__cmd__backticks"
;; ;;
test__quote__help,cmd-expansions) exhaustive__quote__help,cmd-brackets)
cmd="test__quote__help__cmd__expansions" cmd="exhaustive__quote__help__cmd__brackets"
;; ;;
test__quote__help,cmd-single-quotes) exhaustive__quote__help,cmd-double-quotes)
cmd="test__quote__help__cmd__single__quotes" cmd="exhaustive__quote__help__cmd__double__quotes"
;; ;;
test__quote__help,help) exhaustive__quote__help,cmd-expansions)
cmd="test__quote__help__help" cmd="exhaustive__quote__help__cmd__expansions"
;;
exhaustive__quote__help,cmd-single-quotes)
cmd="exhaustive__quote__help__cmd__single__quotes"
;;
exhaustive__quote__help,help)
cmd="exhaustive__quote__help__help"
;; ;;
*) *)
;; ;;
@ -152,8 +158,8 @@ _test() {
done done
case "${cmd}" in case "${cmd}" in
test) exhaustive)
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 if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
@ -170,7 +176,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__action) exhaustive__action)
opts="-h -V --set-true --set --count --choice --global --help --version" opts="-h -V --set-true --set --count --choice --global --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -192,7 +198,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__alias) exhaustive__alias)
opts="-F -f -O -o -h -V --flg --flag --opt --option --global --help --version [positional]" opts="-F -f -O -o -h -V --flg --flag --opt --option --global --help --version [positional]"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -222,8 +228,30 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help) exhaustive__complete)
opts="action quote value pacman last alias hint help" 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
;;
exhaustive__help)
opts="action quote value pacman last alias hint complete help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
@ -236,7 +264,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__action) exhaustive__help__action)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -250,7 +278,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__alias) exhaustive__help__alias)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -264,7 +292,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__help) exhaustive__help__complete)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -278,7 +306,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__hint) exhaustive__help__help)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -292,7 +320,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__last) exhaustive__help__hint)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -306,7 +334,21 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__pacman) exhaustive__help__last)
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
;;
exhaustive__help__pacman)
opts="one two" opts="one two"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -320,7 +362,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__pacman__one) exhaustive__help__pacman__one)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -334,7 +376,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__pacman__two) exhaustive__help__pacman__two)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -348,7 +390,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__quote) exhaustive__help__quote)
opts="cmd-single-quotes cmd-double-quotes cmd-backticks cmd-backslash cmd-brackets cmd-expansions" opts="cmd-single-quotes cmd-double-quotes cmd-backticks cmd-backslash cmd-brackets cmd-expansions"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -362,7 +404,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__quote__cmd__backslash) exhaustive__help__quote__cmd__backslash)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -376,7 +418,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__quote__cmd__backticks) exhaustive__help__quote__cmd__backticks)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -390,7 +432,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__quote__cmd__brackets) exhaustive__help__quote__cmd__brackets)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -404,7 +446,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__quote__cmd__double__quotes) exhaustive__help__quote__cmd__double__quotes)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -418,7 +460,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__quote__cmd__expansions) exhaustive__help__quote__cmd__expansions)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -432,7 +474,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__quote__cmd__single__quotes) exhaustive__help__quote__cmd__single__quotes)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -446,7 +488,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__help__value) exhaustive__help__value)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -460,7 +502,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 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]..." 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 if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -554,7 +596,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__last) exhaustive__last)
opts="-h -V --global --help --version [first] [free]" opts="-h -V --global --help --version [first] [free]"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -568,7 +610,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__pacman) exhaustive__pacman)
opts="-h -V --global --help --version one two help" opts="-h -V --global --help --version one two help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -582,7 +624,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__pacman__help) exhaustive__pacman__help)
opts="one two help" opts="one two help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -596,7 +638,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__pacman__help__help) exhaustive__pacman__help__help)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -610,7 +652,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__pacman__help__one) exhaustive__pacman__help__one)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -624,7 +666,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__pacman__help__two) exhaustive__pacman__help__two)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -638,7 +680,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__pacman__one) exhaustive__pacman__one)
opts="-h -V --global --help --version" opts="-h -V --global --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -652,7 +694,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__pacman__two) exhaustive__pacman__two)
opts="-h -V --global --help --version" opts="-h -V --global --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -666,7 +708,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 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" 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 if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -680,7 +722,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__cmd__backslash) exhaustive__quote__cmd__backslash)
opts="-h -V --global --help --version" opts="-h -V --global --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -694,7 +736,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__cmd__backticks) exhaustive__quote__cmd__backticks)
opts="-h -V --global --help --version" opts="-h -V --global --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -708,7 +750,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__cmd__brackets) exhaustive__quote__cmd__brackets)
opts="-h -V --global --help --version" opts="-h -V --global --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -722,7 +764,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__cmd__double__quotes) exhaustive__quote__cmd__double__quotes)
opts="-h -V --global --help --version" opts="-h -V --global --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -736,7 +778,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__cmd__expansions) exhaustive__quote__cmd__expansions)
opts="-h -V --global --help --version" opts="-h -V --global --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -750,7 +792,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__cmd__single__quotes) exhaustive__quote__cmd__single__quotes)
opts="-h -V --global --help --version" opts="-h -V --global --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -764,7 +806,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__help) exhaustive__quote__help)
opts="cmd-single-quotes cmd-double-quotes cmd-backticks cmd-backslash cmd-brackets cmd-expansions help" opts="cmd-single-quotes cmd-double-quotes cmd-backticks cmd-backslash cmd-brackets cmd-expansions help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -778,7 +820,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__help__cmd__backslash) exhaustive__quote__help__cmd__backslash)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -792,7 +834,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__help__cmd__backticks) exhaustive__quote__help__cmd__backticks)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -806,7 +848,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__help__cmd__brackets) exhaustive__quote__help__cmd__brackets)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -820,7 +862,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__help__cmd__double__quotes) exhaustive__quote__help__cmd__double__quotes)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -834,7 +876,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__help__cmd__expansions) exhaustive__quote__help__cmd__expansions)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -848,7 +890,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__help__cmd__single__quotes) exhaustive__quote__help__cmd__single__quotes)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -862,7 +904,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__quote__help__help) exhaustive__quote__help__help)
opts="" opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -876,7 +918,7 @@ _test() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
test__value) exhaustive__value)
opts="-h -V --delim --tuple --require-eq --global --help --version [term]..." opts="-h -V --delim --tuple --require-eq --global --help --version [term]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
@ -905,5 +947,5 @@ _test() {
esac esac
} }
complete -F _test -o nosort -o bashdefault -o default test complete -F _exhaustive -o nosort -o bashdefault -o default exhaustive

View file

@ -4,14 +4,14 @@ set edit:prompt = (constantly "% ")
use builtin; use builtin;
use str; use str;
set edit:completion:arg-completer[test] = {|@words| set edit:completion:arg-completer[exhaustive] = {|@words|
fn spaces {|n| fn spaces {|n|
builtin:repeat $n ' ' | str:join '' builtin:repeat $n ' ' | str:join ''
} }
fn cand {|text desc| fn cand {|text desc|
edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
} }
var command = 'test' var command = 'exhaustive'
for word $words[1..-1] { for word $words[1..-1] {
if (str:has-prefix $word '-') { if (str:has-prefix $word '-') {
break break
@ -19,7 +19,7 @@ set edit:completion:arg-completer[test] = {|@words|
set command = $command';'$word set command = $command';'$word
} }
var completions = [ var completions = [
&'test'= { &'exhaustive'= {
cand --generate 'generate' cand --generate 'generate'
cand --global 'everywhere' cand --global 'everywhere'
cand -h 'Print help' cand -h 'Print help'
@ -33,9 +33,10 @@ set edit:completion:arg-completer[test] = {|@words|
cand last 'last' cand last 'last'
cand alias 'alias' cand alias 'alias'
cand hint 'hint' cand hint 'hint'
cand complete 'Register shell completions for this program'
cand help 'Print this message or the help of the given subcommand(s)' cand help 'Print this message or the help of the given subcommand(s)'
} }
&'test;action'= { &'exhaustive;action'= {
cand --set 'value' cand --set 'value'
cand --choice 'enum' cand --choice 'enum'
cand --set-true 'bool' cand --set-true 'bool'
@ -46,7 +47,7 @@ set edit:completion:arg-completer[test] = {|@words|
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;quote'= { &'exhaustive;quote'= {
cand --single-quotes 'Can be ''always'', ''auto'', or ''never''' cand --single-quotes 'Can be ''always'', ''auto'', or ''never'''
cand --double-quotes 'Can be "always", "auto", or "never"' cand --double-quotes 'Can be "always", "auto", or "never"'
cand --backticks 'For more information see `echo test`' cand --backticks 'For more information see `echo test`'
@ -66,49 +67,49 @@ set edit:completion:arg-completer[test] = {|@words|
cand cmd-expansions 'Execute the shell command with $SHELL' cand cmd-expansions 'Execute the shell command with $SHELL'
cand help 'Print this message or the help of the given subcommand(s)' 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 --global 'everywhere'
cand -h 'Print help' cand -h 'Print help'
cand --help 'Print help' cand --help 'Print help'
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;quote;cmd-double-quotes'= { &'exhaustive;quote;cmd-double-quotes'= {
cand --global 'everywhere' cand --global 'everywhere'
cand -h 'Print help' cand -h 'Print help'
cand --help 'Print help' cand --help 'Print help'
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;quote;cmd-backticks'= { &'exhaustive;quote;cmd-backticks'= {
cand --global 'everywhere' cand --global 'everywhere'
cand -h 'Print help' cand -h 'Print help'
cand --help 'Print help' cand --help 'Print help'
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;quote;cmd-backslash'= { &'exhaustive;quote;cmd-backslash'= {
cand --global 'everywhere' cand --global 'everywhere'
cand -h 'Print help' cand -h 'Print help'
cand --help 'Print help' cand --help 'Print help'
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;quote;cmd-brackets'= { &'exhaustive;quote;cmd-brackets'= {
cand --global 'everywhere' cand --global 'everywhere'
cand -h 'Print help' cand -h 'Print help'
cand --help 'Print help' cand --help 'Print help'
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;quote;cmd-expansions'= { &'exhaustive;quote;cmd-expansions'= {
cand --global 'everywhere' cand --global 'everywhere'
cand -h 'Print help' cand -h 'Print help'
cand --help 'Print help' cand --help 'Print help'
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;quote;help'= { &'exhaustive;quote;help'= {
cand cmd-single-quotes 'Can be ''always'', ''auto'', or ''never''' cand cmd-single-quotes 'Can be ''always'', ''auto'', or ''never'''
cand cmd-double-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`' cand cmd-backticks 'For more information see `echo test`'
@ -117,21 +118,21 @@ set edit:completion:arg-completer[test] = {|@words|
cand cmd-expansions 'Execute the shell command with $SHELL' cand cmd-expansions 'Execute the shell command with $SHELL'
cand help 'Print this message or the help of the given subcommand(s)' 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 --delim 'delim'
cand --tuple 'tuple' cand --tuple 'tuple'
cand --require-eq 'require-eq' cand --require-eq 'require-eq'
@ -141,7 +142,7 @@ set edit:completion:arg-completer[test] = {|@words|
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;pacman'= { &'exhaustive;pacman'= {
cand --global 'everywhere' cand --global 'everywhere'
cand -h 'Print help' cand -h 'Print help'
cand --help 'Print help' cand --help 'Print help'
@ -151,39 +152,39 @@ set edit:completion:arg-completer[test] = {|@words|
cand two 'two' cand two 'two'
cand help 'Print this message or the help of the given subcommand(s)' cand help 'Print this message or the help of the given subcommand(s)'
} }
&'test;pacman;one'= { &'exhaustive;pacman;one'= {
cand --global 'everywhere' cand --global 'everywhere'
cand -h 'Print help' cand -h 'Print help'
cand --help 'Print help' cand --help 'Print help'
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;pacman;two'= { &'exhaustive;pacman;two'= {
cand --global 'everywhere' cand --global 'everywhere'
cand -h 'Print help' cand -h 'Print help'
cand --help 'Print help' cand --help 'Print help'
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;pacman;help'= { &'exhaustive;pacman;help'= {
cand one 'one' cand one 'one'
cand two 'two' cand two 'two'
cand help 'Print this message or the help of the given subcommand(s)' 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 --global 'everywhere'
cand -h 'Print help' cand -h 'Print help'
cand --help 'Print help' cand --help 'Print help'
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;alias'= { &'exhaustive;alias'= {
cand -o 'cmd option' cand -o 'cmd option'
cand -O 'cmd option' cand -O 'cmd option'
cand --option 'cmd option' cand --option 'cmd option'
@ -198,7 +199,7 @@ set edit:completion:arg-completer[test] = {|@words|
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;hint'= { &'exhaustive;hint'= {
cand --choice 'choice' cand --choice 'choice'
cand --unknown 'unknown' cand --unknown 'unknown'
cand --other 'other' cand --other 'other'
@ -225,7 +226,16 @@ set edit:completion:arg-completer[test] = {|@words|
cand -V 'Print version' cand -V 'Print version'
cand --version 'Print version' cand --version 'Print version'
} }
&'test;help'= { &'exhaustive;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'
}
&'exhaustive;help'= {
cand action 'action' cand action 'action'
cand quote 'quote' cand quote 'quote'
cand value 'value' cand value 'value'
@ -233,11 +243,12 @@ set edit:completion:arg-completer[test] = {|@words|
cand last 'last' cand last 'last'
cand alias 'alias' cand alias 'alias'
cand hint 'hint' cand hint 'hint'
cand complete 'Register shell completions for this program'
cand help 'Print this message or the help of the given subcommand(s)' 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-single-quotes 'Can be ''always'', ''auto'', or ''never'''
cand cmd-double-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`' cand cmd-backticks 'For more information see `echo test`'
@ -245,35 +256,37 @@ set edit:completion:arg-completer[test] = {|@words|
cand cmd-brackets 'List packages [filter]' cand cmd-brackets 'List packages [filter]'
cand cmd-expansions 'Execute the shell command with $SHELL' 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 one 'one'
cand two 'two' 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;help'= { &'exhaustive;help;complete'= {
}
&'exhaustive;help;help'= {
} }
] ]
$completions[$command] $completions[$command]

View file

@ -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"

View file

@ -1,8 +1,8 @@
#compdef test #compdef exhaustive
autoload -U is-at-least autoload -U is-at-least
_test() { _exhaustive() {
typeset -A opt_args typeset -A opt_args
typeset -a _arguments_options typeset -a _arguments_options
local ret=1 local ret=1
@ -15,20 +15,20 @@ _test() {
local context curcontext="$curcontext" state line local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
'--generate=[generate]: :(bash elvish fish powershell zsh)' \ '--generate=[generate]:SHELL:(bash elvish fish powershell zsh)' \
'--global[everywhere]' \ '--global[everywhere]' \
'-h[Print help]' \ '-h[Print help]' \
'--help[Print help]' \ '--help[Print help]' \
'-V[Print version]' \ '-V[Print version]' \
'--version[Print version]' \ '--version[Print version]' \
":: :_test_commands" \ ":: :_exhaustive_commands" \
"*::: :->test" \ "*::: :->exhaustive" \
&& ret=0 && ret=0
case $state in case $state in
(test) (exhaustive)
words=($line[1] "${words[@]}") words=($line[1] "${words[@]}")
(( CURRENT += 1 )) (( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:test-command-$line[1]:" curcontext="${curcontext%:*:*}:exhaustive-command-$line[1]:"
case $line[1] in case $line[1] in
(action) (action)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
@ -56,7 +56,7 @@ _arguments "${_arguments_options[@]}" \
'--help[Print help]' \ '--help[Print help]' \
'-V[Print version]' \ '-V[Print version]' \
'--version[Print version]' \ '--version[Print version]' \
":: :_test__quote_commands" \ ":: :_exhaustive__quote_commands" \
"*::: :->quote" \ "*::: :->quote" \
&& ret=0 && ret=0
@ -64,7 +64,7 @@ _arguments "${_arguments_options[@]}" \
(quote) (quote)
words=($line[1] "${words[@]}") words=($line[1] "${words[@]}")
(( CURRENT += 1 )) (( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:test-quote-command-$line[1]:" curcontext="${curcontext%:*:*}:exhaustive-quote-command-$line[1]:"
case $line[1] in case $line[1] in
(cmd-single-quotes) (cmd-single-quotes)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
@ -122,7 +122,7 @@ _arguments "${_arguments_options[@]}" \
;; ;;
(help) (help)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
":: :_test__quote__help_commands" \ ":: :_exhaustive__quote__help_commands" \
"*::: :->help" \ "*::: :->help" \
&& ret=0 && ret=0
@ -130,7 +130,7 @@ _arguments "${_arguments_options[@]}" \
(help) (help)
words=($line[1] "${words[@]}") words=($line[1] "${words[@]}")
(( CURRENT += 1 )) (( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:test-quote-help-command-$line[1]:" curcontext="${curcontext%:*:*}:exhaustive-quote-help-command-$line[1]:"
case $line[1] in case $line[1] in
(cmd-single-quotes) (cmd-single-quotes)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
@ -188,7 +188,7 @@ _arguments "${_arguments_options[@]}" \
'--help[Print help]' \ '--help[Print help]' \
'-V[Print version]' \ '-V[Print version]' \
'--version[Print version]' \ '--version[Print version]' \
":: :_test__pacman_commands" \ ":: :_exhaustive__pacman_commands" \
"*::: :->pacman" \ "*::: :->pacman" \
&& ret=0 && ret=0
@ -196,7 +196,7 @@ _arguments "${_arguments_options[@]}" \
(pacman) (pacman)
words=($line[1] "${words[@]}") words=($line[1] "${words[@]}")
(( CURRENT += 1 )) (( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:test-pacman-command-$line[1]:" curcontext="${curcontext%:*:*}:exhaustive-pacman-command-$line[1]:"
case $line[1] in case $line[1] in
(one) (one)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
@ -218,7 +218,7 @@ _arguments "${_arguments_options[@]}" \
;; ;;
(help) (help)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
":: :_test__pacman__help_commands" \ ":: :_exhaustive__pacman__help_commands" \
"*::: :->help" \ "*::: :->help" \
&& ret=0 && ret=0
@ -226,7 +226,7 @@ _arguments "${_arguments_options[@]}" \
(help) (help)
words=($line[1] "${words[@]}") words=($line[1] "${words[@]}")
(( CURRENT += 1 )) (( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:test-pacman-help-command-$line[1]:" curcontext="${curcontext%:*:*}:exhaustive-pacman-help-command-$line[1]:"
case $line[1] in case $line[1] in
(one) (one)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
@ -307,9 +307,21 @@ _arguments "${_arguments_options[@]}" \
'*::command_with_args:_cmdambivalent' \ '*::command_with_args:_cmdambivalent' \
&& ret=0 && 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) (help)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
":: :_test__help_commands" \ ":: :_exhaustive__help_commands" \
"*::: :->help" \ "*::: :->help" \
&& ret=0 && ret=0
@ -317,7 +329,7 @@ _arguments "${_arguments_options[@]}" \
(help) (help)
words=($line[1] "${words[@]}") words=($line[1] "${words[@]}")
(( CURRENT += 1 )) (( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:test-help-command-$line[1]:" curcontext="${curcontext%:*:*}:exhaustive-help-command-$line[1]:"
case $line[1] in case $line[1] in
(action) (action)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
@ -325,7 +337,7 @@ _arguments "${_arguments_options[@]}" \
;; ;;
(quote) (quote)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
":: :_test__help__quote_commands" \ ":: :_exhaustive__help__quote_commands" \
"*::: :->quote" \ "*::: :->quote" \
&& ret=0 && ret=0
@ -333,7 +345,7 @@ _arguments "${_arguments_options[@]}" \
(quote) (quote)
words=($line[1] "${words[@]}") words=($line[1] "${words[@]}")
(( CURRENT += 1 )) (( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:test-help-quote-command-$line[1]:" curcontext="${curcontext%:*:*}:exhaustive-help-quote-command-$line[1]:"
case $line[1] in case $line[1] in
(cmd-single-quotes) (cmd-single-quotes)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
@ -369,7 +381,7 @@ _arguments "${_arguments_options[@]}" \
;; ;;
(pacman) (pacman)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
":: :_test__help__pacman_commands" \ ":: :_exhaustive__help__pacman_commands" \
"*::: :->pacman" \ "*::: :->pacman" \
&& ret=0 && ret=0
@ -377,7 +389,7 @@ _arguments "${_arguments_options[@]}" \
(pacman) (pacman)
words=($line[1] "${words[@]}") words=($line[1] "${words[@]}")
(( CURRENT += 1 )) (( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:test-help-pacman-command-$line[1]:" curcontext="${curcontext%:*:*}:exhaustive-help-pacman-command-$line[1]:"
case $line[1] in case $line[1] in
(one) (one)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
@ -403,6 +415,10 @@ _arguments "${_arguments_options[@]}" \
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
&& ret=0 && ret=0
;; ;;
(complete)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help) (help)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
&& ret=0 && ret=0
@ -416,8 +432,8 @@ esac
esac esac
} }
(( $+functions[_test_commands] )) || (( $+functions[_exhaustive_commands] )) ||
_test_commands() { _exhaustive_commands() {
local commands; commands=( local commands; commands=(
'action:' \ 'action:' \
'quote:' \ 'quote:' \
@ -426,122 +442,133 @@ _test_commands() {
'last:' \ 'last:' \
'alias:' \ 'alias:' \
'hint:' \ 'hint:' \
'complete:Register shell completions for this program' \
'help:Print this message or the help of the given subcommand(s)' \ '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] )) || (( $+functions[_exhaustive__action_commands] )) ||
_test__action_commands() { _exhaustive__action_commands() {
local commands; commands=() local commands; commands=()
_describe -t commands 'test action commands' commands "$@" _describe -t commands 'exhaustive action commands' commands "$@"
} }
(( $+functions[_test__help__action_commands] )) || (( $+functions[_exhaustive__help__action_commands] )) ||
_test__help__action_commands() { _exhaustive__help__action_commands() {
local commands; commands=() local commands; commands=()
_describe -t commands 'test help action commands' commands "$@" _describe -t commands 'exhaustive help action commands' commands "$@"
} }
(( $+functions[_test__alias_commands] )) || (( $+functions[_exhaustive__alias_commands] )) ||
_test__alias_commands() { _exhaustive__alias_commands() {
local commands; commands=() local commands; commands=()
_describe -t commands 'test alias commands' commands "$@" _describe -t commands 'exhaustive alias commands' commands "$@"
} }
(( $+functions[_test__help__alias_commands] )) || (( $+functions[_exhaustive__help__alias_commands] )) ||
_test__help__alias_commands() { _exhaustive__help__alias_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__help__quote__cmd-backslash_commands] )) ||
_test__help__quote__cmd-backslash_commands() { _exhaustive__help__quote__cmd-backslash_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__cmd-backslash_commands] )) ||
_test__quote__cmd-backslash_commands() { _exhaustive__quote__cmd-backslash_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__help__cmd-backslash_commands] )) ||
_test__quote__help__cmd-backslash_commands() { _exhaustive__quote__help__cmd-backslash_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__help__quote__cmd-backticks_commands] )) ||
_test__help__quote__cmd-backticks_commands() { _exhaustive__help__quote__cmd-backticks_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__cmd-backticks_commands] )) ||
_test__quote__cmd-backticks_commands() { _exhaustive__quote__cmd-backticks_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__help__cmd-backticks_commands] )) ||
_test__quote__help__cmd-backticks_commands() { _exhaustive__quote__help__cmd-backticks_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__help__quote__cmd-brackets_commands] )) ||
_test__help__quote__cmd-brackets_commands() { _exhaustive__help__quote__cmd-brackets_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__cmd-brackets_commands] )) ||
_test__quote__cmd-brackets_commands() { _exhaustive__quote__cmd-brackets_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__help__cmd-brackets_commands] )) ||
_test__quote__help__cmd-brackets_commands() { _exhaustive__quote__help__cmd-brackets_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__help__quote__cmd-double-quotes_commands] )) ||
_test__help__quote__cmd-double-quotes_commands() { _exhaustive__help__quote__cmd-double-quotes_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__cmd-double-quotes_commands] )) ||
_test__quote__cmd-double-quotes_commands() { _exhaustive__quote__cmd-double-quotes_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__help__cmd-double-quotes_commands] )) ||
_test__quote__help__cmd-double-quotes_commands() { _exhaustive__quote__help__cmd-double-quotes_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__help__quote__cmd-expansions_commands] )) ||
_test__help__quote__cmd-expansions_commands() { _exhaustive__help__quote__cmd-expansions_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__cmd-expansions_commands] )) ||
_test__quote__cmd-expansions_commands() { _exhaustive__quote__cmd-expansions_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__help__cmd-expansions_commands] )) ||
_test__quote__help__cmd-expansions_commands() { _exhaustive__quote__help__cmd-expansions_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__help__quote__cmd-single-quotes_commands] )) ||
_test__help__quote__cmd-single-quotes_commands() { _exhaustive__help__quote__cmd-single-quotes_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__cmd-single-quotes_commands] )) ||
_test__quote__cmd-single-quotes_commands() { _exhaustive__quote__cmd-single-quotes_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__help__cmd-single-quotes_commands] )) ||
_test__quote__help__cmd-single-quotes_commands() { _exhaustive__quote__help__cmd-single-quotes_commands() {
local commands; 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__help_commands] )) || (( $+functions[_exhaustive__complete_commands] )) ||
_test__help_commands() { _exhaustive__complete_commands() {
local commands; commands=()
_describe -t commands 'exhaustive complete commands' commands "$@"
}
(( $+functions[_exhaustive__help__complete_commands] )) ||
_exhaustive__help__complete_commands() {
local commands; commands=()
_describe -t commands 'exhaustive help complete commands' commands "$@"
}
(( $+functions[_exhaustive__help_commands] )) ||
_exhaustive__help_commands() {
local commands; commands=( local commands; commands=(
'action:' \ 'action:' \
'quote:' \ 'quote:' \
@ -550,31 +577,32 @@ _test__help_commands() {
'last:' \ 'last:' \
'alias:' \ 'alias:' \
'hint:' \ 'hint:' \
'complete:Register shell completions for this program' \
'help:Print this message or the help of the given subcommand(s)' \ '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] )) || (( $+functions[_exhaustive__help__help_commands] )) ||
_test__help__help_commands() { _exhaustive__help__help_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__pacman__help_commands] )) ||
_test__pacman__help_commands() { _exhaustive__pacman__help_commands() {
local commands; commands=( local commands; commands=(
'one:' \ 'one:' \
'two:' \ 'two:' \
'help:Print this message or the help of the given subcommand(s)' \ '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] )) || (( $+functions[_exhaustive__pacman__help__help_commands] )) ||
_test__pacman__help__help_commands() { _exhaustive__pacman__help__help_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__quote__help_commands] )) ||
_test__quote__help_commands() { _exhaustive__quote__help_commands() {
local commands; commands=( local commands; commands=(
'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \ 'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \
'cmd-double-quotes:Can be "always", "auto", or "never"' \ 'cmd-double-quotes:Can be "always", "auto", or "never"' \
@ -584,67 +612,67 @@ _test__quote__help_commands() {
'cmd-expansions:Execute the shell command with \$SHELL' \ 'cmd-expansions:Execute the shell command with \$SHELL' \
'help:Print this message or the help of the given subcommand(s)' \ '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] )) || (( $+functions[_exhaustive__quote__help__help_commands] )) ||
_test__quote__help__help_commands() { _exhaustive__quote__help__help_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__help__hint_commands] )) ||
_test__help__hint_commands() { _exhaustive__help__hint_commands() {
local commands; commands=() local commands; commands=()
_describe -t commands 'test help hint commands' commands "$@" _describe -t commands 'exhaustive help hint commands' commands "$@"
} }
(( $+functions[_test__hint_commands] )) || (( $+functions[_exhaustive__hint_commands] )) ||
_test__hint_commands() { _exhaustive__hint_commands() {
local commands; commands=() local commands; commands=()
_describe -t commands 'test hint commands' commands "$@" _describe -t commands 'exhaustive hint commands' commands "$@"
} }
(( $+functions[_test__help__last_commands] )) || (( $+functions[_exhaustive__help__last_commands] )) ||
_test__help__last_commands() { _exhaustive__help__last_commands() {
local commands; commands=() local commands; commands=()
_describe -t commands 'test help last commands' commands "$@" _describe -t commands 'exhaustive help last commands' commands "$@"
} }
(( $+functions[_test__last_commands] )) || (( $+functions[_exhaustive__last_commands] )) ||
_test__last_commands() { _exhaustive__last_commands() {
local commands; commands=() local commands; commands=()
_describe -t commands 'test last commands' commands "$@" _describe -t commands 'exhaustive last commands' commands "$@"
} }
(( $+functions[_test__help__pacman__one_commands] )) || (( $+functions[_exhaustive__help__pacman__one_commands] )) ||
_test__help__pacman__one_commands() { _exhaustive__help__pacman__one_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__pacman__help__one_commands] )) ||
_test__pacman__help__one_commands() { _exhaustive__pacman__help__one_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__pacman__one_commands] )) ||
_test__pacman__one_commands() { _exhaustive__pacman__one_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__help__pacman_commands] )) ||
_test__help__pacman_commands() { _exhaustive__help__pacman_commands() {
local commands; commands=( local commands; commands=(
'one:' \ 'one:' \
'two:' \ 'two:' \
) )
_describe -t commands 'test help pacman commands' commands "$@" _describe -t commands 'exhaustive help pacman commands' commands "$@"
} }
(( $+functions[_test__pacman_commands] )) || (( $+functions[_exhaustive__pacman_commands] )) ||
_test__pacman_commands() { _exhaustive__pacman_commands() {
local commands; commands=( local commands; commands=(
'one:' \ 'one:' \
'two:' \ 'two:' \
'help:Print this message or the help of the given subcommand(s)' \ '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] )) || (( $+functions[_exhaustive__help__quote_commands] )) ||
_test__help__quote_commands() { _exhaustive__help__quote_commands() {
local commands; commands=( local commands; commands=(
'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \ 'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \
'cmd-double-quotes:Can be "always", "auto", or "never"' \ 'cmd-double-quotes:Can be "always", "auto", or "never"' \
@ -653,10 +681,10 @@ _test__help__quote_commands() {
'cmd-brackets:List packages \[filter\]' \ 'cmd-brackets:List packages \[filter\]' \
'cmd-expansions:Execute the shell command with \$SHELL' \ '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] )) || (( $+functions[_exhaustive__quote_commands] )) ||
_test__quote_commands() { _exhaustive__quote_commands() {
local commands; commands=( local commands; commands=(
'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \ 'cmd-single-quotes:Can be '\''always'\'', '\''auto'\'', or '\''never'\''' \
'cmd-double-quotes:Can be "always", "auto", or "never"' \ 'cmd-double-quotes:Can be "always", "auto", or "never"' \
@ -666,36 +694,36 @@ _test__quote_commands() {
'cmd-expansions:Execute the shell command with \$SHELL' \ 'cmd-expansions:Execute the shell command with \$SHELL' \
'help:Print this message or the help of the given subcommand(s)' \ '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] )) || (( $+functions[_exhaustive__help__pacman__two_commands] )) ||
_test__help__pacman__two_commands() { _exhaustive__help__pacman__two_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__pacman__help__two_commands] )) ||
_test__pacman__help__two_commands() { _exhaustive__pacman__help__two_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__pacman__two_commands] )) ||
_test__pacman__two_commands() { _exhaustive__pacman__two_commands() {
local commands; 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] )) || (( $+functions[_exhaustive__help__value_commands] )) ||
_test__help__value_commands() { _exhaustive__help__value_commands() {
local commands; commands=() local commands; commands=()
_describe -t commands 'test help value commands' commands "$@" _describe -t commands 'exhaustive help value commands' commands "$@"
} }
(( $+functions[_test__value_commands] )) || (( $+functions[_exhaustive__value_commands] )) ||
_test__value_commands() { _exhaustive__value_commands() {
local commands; commands=() local commands; commands=()
_describe -t commands 'test value commands' commands "$@" _describe -t commands 'exhaustive value commands' commands "$@"
} }
if [ "$funcstack[1]" = "_test" ]; then if [ "$funcstack[1]" = "_exhaustive" ]; then
_test "$@" _exhaustive "$@"
else else
compdef _test test compdef _exhaustive exhaustive
fi fi

View file

@ -1,121 +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 "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 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 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"

View file

@ -1,5 +1,6 @@
_clap_complete_my_app() { _clap_complete_my_app() {
export IFS=$'/013'
export _CLAP_COMPLETE_INDEX=${COMP_CWORD} export _CLAP_COMPLETE_INDEX=${COMP_CWORD}
export _CLAP_COMPLETE_COMP_TYPE=${COMP_TYPE} export _CLAP_COMPLETE_COMP_TYPE=${COMP_TYPE}
if compopt +o nospace 2> /dev/null; then if compopt +o nospace 2> /dev/null; then
@ -7,7 +8,6 @@ _clap_complete_my_app() {
else else
export _CLAP_COMPLETE_SPACE=true export _CLAP_COMPLETE_SPACE=true
fi fi
export _CLAP_COMPLETE_IFS=$'/013'
COMPREPLY=( $("my-app" complete --shell bash -- "${COMP_WORDS[@]}") ) COMPREPLY=( $("my-app" complete --shell bash -- "${COMP_WORDS[@]}") )
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
unset COMPREPLY unset COMPREPLY

View file

@ -141,11 +141,7 @@ fn subcommand_last() {
#[test] #[test]
#[cfg(unix)] #[cfg(unix)]
fn register_completion() { fn register_completion() {
if !common::has_command("bash") { common::register_example("static", "exhaustive", completest::Shell::Bash);
return;
}
common::register_example("test", completest::Shell::Bash);
} }
#[test] #[test]
@ -156,12 +152,18 @@ fn complete() {
} }
let term = completest::Term::new(); let term = completest::Term::new();
let mut runtime = common::load_runtime("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#"% let expected = r#"%
-h --global --help action value last hint -h --global --help action value last hint help
-V --generate --version quote pacman alias help"#; -V --generate --version quote pacman alias complete"#;
let actual = runtime.complete(input, &term).unwrap(); let actual = runtime.complete(input, &term).unwrap();
snapbox::assert_eq(expected, actual); snapbox::assert_eq(expected, actual);
} }
#[test]
#[cfg(unix)]
fn register_dynamic_completion() {
common::register_example("dynamic", "exhaustive", completest::Shell::Bash);
}

View file

@ -296,27 +296,43 @@ pub fn assert_matches_path(
.matches_path(expected_path, buf); .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 = snapbox::path::PathFixture::mutable_temp().unwrap();
let scratch_path = scratch.path().unwrap(); let scratch_path = scratch.path().unwrap();
let shell_name = shell.name(); let shell_name = shell.name();
let home = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) let home = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("tests/snapshots/home") .join("tests/snapshots/home")
.join(context)
.join(name) .join(name)
.join(shell_name); .join(shell_name);
println!("Compiling"); println!("Compiling");
let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml"); let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml");
let bin_path = let bin_path = snapbox::cmd::compile_example(
snapbox::cmd::compile_example(name, ["--manifest-path", manifest_path.to_str().unwrap()]) name,
.unwrap(); [
"--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"); println!("Compiled");
let bin_root = bin_path.parent().unwrap().to_owned(); let bin_root = bin_path.parent().unwrap().to_owned();
let registration = std::process::Command::new(&bin_path) let mut registration = std::process::Command::new(&bin_path);
.arg(format!("--generate={shell_name}")) match context {
.output() "static" => registration.args([format!("--generate={shell_name}")]),
.unwrap(); "dynamic" => registration.args([
"complete".to_owned(),
"--register=-".to_owned(),
format!("--shell={shell_name}"),
]),
_ => unreachable!("unsupported context {}", context),
};
let registration = registration.output().unwrap();
assert!( assert!(
registration.status.success(), registration.status.success(),
"{}", "{}",
@ -334,10 +350,15 @@ pub fn register_example(name: &str, shell: completest::Shell) {
scratch.close().unwrap(); scratch.close().unwrap();
} }
pub fn load_runtime(name: &str, shell: completest::Shell) -> Box<dyn completest::Runtime> { pub fn load_runtime(
context: &str,
name: &str,
shell: completest::Shell,
) -> Box<dyn completest::Runtime> {
let shell_name = shell.name(); let shell_name = shell.name();
let home = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) let home = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("tests/snapshots/home") .join("tests/snapshots/home")
.join(context)
.join(name) .join(name)
.join(shell_name); .join(shell_name);
let scratch = snapbox::path::PathFixture::mutable_temp() let scratch = snapbox::path::PathFixture::mutable_temp()
@ -347,9 +368,17 @@ pub fn load_runtime(name: &str, shell: completest::Shell) -> Box<dyn completest:
let home = scratch.path().unwrap().to_owned(); let home = scratch.path().unwrap().to_owned();
println!("Compiling"); println!("Compiling");
let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml"); let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml");
let bin_path = let bin_path = snapbox::cmd::compile_example(
snapbox::cmd::compile_example(name, ["--manifest-path", manifest_path.to_str().unwrap()]) name,
.unwrap(); [
"--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"); println!("Compiled");
let bin_root = bin_path.parent().unwrap().to_owned(); let bin_root = bin_path.parent().unwrap().to_owned();

View file

@ -2,7 +2,7 @@
#[test] #[test]
fn suggest_subcommand_subset() { fn suggest_subcommand_subset() {
let name = "test"; let name = "exhaustive";
let mut cmd = clap::Command::new(name) let mut cmd = clap::Command::new(name)
.subcommand(clap::Command::new("hello-world")) .subcommand(clap::Command::new("hello-world"))
.subcommand(clap::Command::new("hello-moon")) .subcommand(clap::Command::new("hello-moon"))
@ -27,7 +27,7 @@ fn suggest_subcommand_subset() {
#[test] #[test]
fn suggest_long_flag_subset() { fn suggest_long_flag_subset() {
let name = "test"; let name = "exhaustive";
let mut cmd = clap::Command::new(name) let mut cmd = clap::Command::new(name)
.arg( .arg(
clap::Arg::new("hello-world") clap::Arg::new("hello-world")
@ -64,7 +64,7 @@ fn suggest_long_flag_subset() {
#[test] #[test]
fn suggest_possible_value_subset() { 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([ let mut cmd = clap::Command::new(name).arg(clap::Arg::new("hello-world").value_parser([
"hello-world", "hello-world",
"hello-moon", "hello-moon",
@ -90,7 +90,7 @@ fn suggest_possible_value_subset() {
#[test] #[test]
fn suggest_additional_short_flags() { fn suggest_additional_short_flags() {
let name = "test"; let name = "exhaustive";
let mut cmd = clap::Command::new(name) let mut cmd = clap::Command::new(name)
.arg( .arg(
clap::Arg::new("a") clap::Arg::new("a")

View file

@ -123,11 +123,7 @@ fn subcommand_last() {
#[test] #[test]
#[cfg(unix)] #[cfg(unix)]
fn register_completion() { fn register_completion() {
if !common::has_command("elvish") { common::register_example("static", "exhaustive", completest::Shell::Elvish);
return;
}
common::register_example("test", completest::Shell::Elvish);
} }
#[test] #[test]
@ -138,10 +134,10 @@ fn complete() {
} }
let term = completest::Term::new(); let term = completest::Term::new();
let mut runtime = common::load_runtime("test", completest::Shell::Elvish); let mut runtime = common::load_runtime("static", "exhaustive", completest::Shell::Elvish);
let input = "test \t"; let input = "exhaustive \t";
let expected = r#"% test --generate let expected = r#"% exhaustive --generate
--generate generate --generate generate
--global everywhere --global everywhere
--help Print help --help Print help
@ -150,6 +146,7 @@ fn complete() {
-h Print help -h Print help
action action action action
alias alias alias alias
complete Register shell completions for this program
help Print this message or the help of the given subcommand(s) help Print this message or the help of the given subcommand(s)
hint hint hint hint
last last last last

View file

@ -123,11 +123,7 @@ fn subcommand_last() {
#[test] #[test]
#[cfg(unix)] #[cfg(unix)]
fn register_completion() { fn register_completion() {
if !common::has_command("fish") { common::register_example("static", "exhaustive", completest::Shell::Fish);
return;
}
common::register_example("test", completest::Shell::Fish);
} }
#[test] #[test]
@ -138,12 +134,12 @@ fn complete() {
} }
let term = completest::Term::new(); let term = completest::Term::new();
let mut runtime = common::load_runtime("test", completest::Shell::Fish); let mut runtime = common::load_runtime("static", "exhaustive", completest::Shell::Fish);
let input = "test \t"; let input = "exhaustive \t";
let expected = r#"% test let expected = r#"% exhaustive
action help (Print this message or the help of the given subcommand(s)) last quote action complete (Register shell completions for this program) hint pacman value
alias 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(); let actual = runtime.complete(input, &term).unwrap();
snapbox::assert_eq(expected, actual); snapbox::assert_eq(expected, actual);
} }

View file

@ -123,11 +123,7 @@ fn subcommand_last() {
#[test] #[test]
#[cfg(unix)] #[cfg(unix)]
fn register_completion() { fn register_completion() {
if !common::has_command("zsh") { common::register_example("static", "exhaustive", completest::Shell::Zsh);
return;
}
common::register_example("test", completest::Shell::Zsh);
} }
#[test] #[test]
@ -138,12 +134,13 @@ fn complete() {
} }
let term = completest::Term::new(); let term = completest::Term::new();
let mut runtime = common::load_runtime("test", completest::Shell::Zsh); let mut runtime = common::load_runtime("static", "exhaustive", completest::Shell::Zsh);
let input = "test \t"; let input = "exhaustive \t";
let expected = r#"% test let expected = r#"% exhaustive
help -- Print this message or the help of the given subcommand(s) complete -- Register shell completions for this program
pacman action alias value quote hint last --"#; 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(); let actual = runtime.complete(input, &term).unwrap();
snapbox::assert_eq(expected, actual); snapbox::assert_eq(expected, actual);
} }