mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
Merge pull request #4734 from XiaoXiaoSN/master
feat(complete): Support to run ZSH completion as a script
This commit is contained in:
commit
e9535a3618
10 changed files with 50 additions and 10 deletions
|
@ -43,7 +43,11 @@ _{name}() {{
|
|||
|
||||
{subcommand_details}
|
||||
|
||||
_{name} \"$@\"
|
||||
if [ \"$funcstack[1]\" = \"_{name}\" ]; then
|
||||
_{name} \"$@\"
|
||||
else
|
||||
compdef _{name} {name}
|
||||
fi
|
||||
",
|
||||
name = bin_name,
|
||||
initial_args = get_args_of(cmd, None),
|
||||
|
|
|
@ -37,4 +37,8 @@ _my-app_commands() {
|
|||
_describe -t commands 'my-app commands' commands "$@"
|
||||
}
|
||||
|
||||
_my-app "$@"
|
||||
if [ "$funcstack[1]" = "_my-app" ]; then
|
||||
_my-app "$@"
|
||||
else
|
||||
compdef _my-app my-app
|
||||
fi
|
||||
|
|
|
@ -97,4 +97,8 @@ _my-app__test_commands() {
|
|||
_describe -t commands 'my-app test commands' commands "$@"
|
||||
}
|
||||
|
||||
_my-app "$@"
|
||||
if [ "$funcstack[1]" = "_my-app" ]; then
|
||||
_my-app "$@"
|
||||
else
|
||||
compdef _my-app my-app
|
||||
fi
|
||||
|
|
|
@ -104,4 +104,8 @@ _my-app__test_commands() {
|
|||
_describe -t commands 'my-app test commands' commands "$@"
|
||||
}
|
||||
|
||||
_my-app "$@"
|
||||
if [ "$funcstack[1]" = "_my-app" ]; then
|
||||
_my-app "$@"
|
||||
else
|
||||
compdef _my-app my-app
|
||||
fi
|
||||
|
|
|
@ -211,4 +211,8 @@ _my-app__help__help_commands() {
|
|||
_describe -t commands 'my-app help help commands' commands "$@"
|
||||
}
|
||||
|
||||
_my-app "$@"
|
||||
if [ "$funcstack[1]" = "_my-app" ]; then
|
||||
_my-app "$@"
|
||||
else
|
||||
compdef _my-app my-app
|
||||
fi
|
||||
|
|
|
@ -178,4 +178,8 @@ _my-app__test_commands() {
|
|||
_describe -t commands 'my-app test commands' commands "$@"
|
||||
}
|
||||
|
||||
_my-app "$@"
|
||||
if [ "$funcstack[1]" = "_my-app" ]; then
|
||||
_my-app "$@"
|
||||
else
|
||||
compdef _my-app my-app
|
||||
fi
|
||||
|
|
|
@ -224,4 +224,8 @@ _my-app__test_commands() {
|
|||
_describe -t commands 'my-app test commands' commands "$@"
|
||||
}
|
||||
|
||||
_my-app "$@"
|
||||
if [ "$funcstack[1]" = "_my-app" ]; then
|
||||
_my-app "$@"
|
||||
else
|
||||
compdef _my-app my-app
|
||||
fi
|
||||
|
|
|
@ -27,4 +27,8 @@ _my-app_commands() {
|
|||
_describe -t commands 'my-app commands' commands "$@"
|
||||
}
|
||||
|
||||
_my-app "$@"
|
||||
if [ "$funcstack[1]" = "_my-app" ]; then
|
||||
_my-app "$@"
|
||||
else
|
||||
compdef _my-app my-app
|
||||
fi
|
||||
|
|
|
@ -47,4 +47,8 @@ _my-app_commands() {
|
|||
_describe -t commands 'my-app commands' commands "$@"
|
||||
}
|
||||
|
||||
_my-app "$@"
|
||||
if [ "$funcstack[1]" = "_my-app" ]; then
|
||||
_my-app "$@"
|
||||
else
|
||||
compdef _my-app my-app
|
||||
fi
|
||||
|
|
|
@ -27,4 +27,8 @@ _my-app_commands() {
|
|||
_describe -t commands 'my-app commands' commands "$@"
|
||||
}
|
||||
|
||||
_my-app "$@"
|
||||
if [ "$funcstack[1]" = "_my-app" ]; then
|
||||
_my-app "$@"
|
||||
else
|
||||
compdef _my-app my-app
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue