Skip to content

Commit

Permalink
Merge pull request #85 from chaqchase/update-shell-completions
Browse files Browse the repository at this point in the history
chore: update shell completions
  • Loading branch information
chaqchase authored Jan 4, 2025
2 parents c73d44d + ad962c4 commit b78464a
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 3 deletions.
51 changes: 50 additions & 1 deletion completions/_lla
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,27 @@ _arguments "${_arguments_options[@]}" \
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
":: :_lla__theme_commands" \
"*::: :->theme" \
&& ret=0

case $state in
(theme)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:lla-theme-command-$line[1]:"
case $line[1] in
(pull)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(install)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':path -- Path to theme file or directory containing themes:' \
&& ret=0
;;
(help)
Expand All @@ -204,6 +225,15 @@ _arguments "${_arguments_options[@]}" \
esac
;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
esac
;;
esac
}

(( $+functions[_lla_commands] )) ||
Expand Down Expand Up @@ -254,6 +284,11 @@ _lla__shortcut__help_commands() {
local commands; commands=()
_describe -t commands 'lla shortcut help commands' commands "$@"
}
(( $+functions[_lla__theme__help_commands] )) ||
_lla__theme__help_commands() {
local commands; commands=()
_describe -t commands 'lla theme help commands' commands "$@"
}
(( $+functions[_lla__init_commands] )) ||
_lla__init_commands() {
local commands; commands=()
Expand All @@ -264,6 +299,11 @@ _lla__install_commands() {
local commands; commands=()
_describe -t commands 'lla install commands' commands "$@"
}
(( $+functions[_lla__theme__install_commands] )) ||
_lla__theme__install_commands() {
local commands; commands=()
_describe -t commands 'lla theme install commands' commands "$@"
}
(( $+functions[_lla__shortcut__list_commands] )) ||
_lla__shortcut__list_commands() {
local commands; commands=()
Expand All @@ -279,6 +319,11 @@ _lla__plugin_commands() {
local commands; commands=()
_describe -t commands 'lla plugin commands' commands "$@"
}
(( $+functions[_lla__theme__pull_commands] )) ||
_lla__theme__pull_commands() {
local commands; commands=()
_describe -t commands 'lla theme pull commands' commands "$@"
}
(( $+functions[_lla__shortcut__remove_commands] )) ||
_lla__shortcut__remove_commands() {
local commands; commands=()
Expand All @@ -296,7 +341,11 @@ _lla__shortcut_commands() {
}
(( $+functions[_lla__theme_commands] )) ||
_lla__theme_commands() {
local commands; commands=()
local commands; commands=(
'pull:Pull and install themes from the official repository' \
'install:Install theme(s) from a file or directory' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'lla theme commands' commands "$@"
}
(( $+functions[_lla__update_commands] )) ||
Expand Down
47 changes: 46 additions & 1 deletion completions/lla.bash
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ _lla() {
plugin)
cmd+="__plugin"
;;
pull)
cmd+="__pull"
;;
remove)
cmd+="__remove"
;;
Expand Down Expand Up @@ -356,7 +359,7 @@ _lla() {
return 0
;;
lla__theme)
opts="-h --help"
opts="-h --help pull install help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -369,6 +372,48 @@ _lla() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
lla__theme__help)
opts="<SUBCOMMAND>..."
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
;;
lla__theme__install)
opts="-h --help <path>"
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
;;
lla__theme__pull)
opts="-h --help"
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
;;
lla__update)
opts="-h --help <name>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down
13 changes: 13 additions & 0 deletions completions/lla.elv
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,19 @@ set edit:completion:arg-completer[lla] = {|@words|
&'lla;theme'= {
cand -h 'Print help information'
cand --help 'Print help information'
cand pull 'Pull and install themes from the official repository'
cand install 'Install theme(s) from a file or directory'
cand help 'Print this message or the help of the given subcommand(s)'
}
&'lla;theme;pull'= {
cand -h 'Print help information'
cand --help 'Print help information'
}
&'lla;theme;install'= {
cand -h 'Print help information'
cand --help 'Print help information'
}
&'lla;theme;help'= {
}
&'lla;help'= {
}
Expand Down
7 changes: 6 additions & 1 deletion completions/lla.fish
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,9 @@ complete -c lla -n "__fish_seen_subcommand_from shortcut; and __fish_seen_subcom
complete -c lla -n "__fish_seen_subcommand_from completion" -s p -l path -d 'Custom installation path for the completion script' -r
complete -c lla -n "__fish_seen_subcommand_from completion" -s o -l output -d 'Output path for the completion script (prints to stdout if not specified)' -r
complete -c lla -n "__fish_seen_subcommand_from completion" -s h -l help -d 'Print help information'
complete -c lla -n "__fish_seen_subcommand_from theme" -s h -l help -d 'Print help information'
complete -c lla -n "__fish_seen_subcommand_from theme; and not __fish_seen_subcommand_from pull; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -s h -l help -d 'Print help information'
complete -c lla -n "__fish_seen_subcommand_from theme; and not __fish_seen_subcommand_from pull; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -f -a "pull" -d 'Pull and install themes from the official repository'
complete -c lla -n "__fish_seen_subcommand_from theme; and not __fish_seen_subcommand_from pull; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -f -a "install" -d 'Install theme(s) from a file or directory'
complete -c lla -n "__fish_seen_subcommand_from theme; and not __fish_seen_subcommand_from pull; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c lla -n "__fish_seen_subcommand_from theme; and __fish_seen_subcommand_from pull" -s h -l help -d 'Print help information'
complete -c lla -n "__fish_seen_subcommand_from theme; and __fish_seen_subcommand_from install" -s h -l help -d 'Print help information'
16 changes: 16 additions & 0 deletions completions/lla.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,22 @@ Register-ArgumentCompleter -Native -CommandName 'lla' -ScriptBlock {
'lla;theme' {
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information')
[CompletionResult]::new('pull', 'pull', [CompletionResultType]::ParameterValue, 'Pull and install themes from the official repository')
[CompletionResult]::new('install', 'install', [CompletionResultType]::ParameterValue, 'Install theme(s) from a file or directory')
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
break
}
'lla;theme;pull' {
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information')
break
}
'lla;theme;install' {
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information')
break
}
'lla;theme;help' {
break
}
'lla;help' {
Expand Down

0 comments on commit b78464a

Please sign in to comment.