add and remove completions

This commit is contained in:
Daylin Morgan 2023-07-13 10:31:18 -05:00
parent 60a867dfae
commit 508a3384f8
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
5 changed files with 978 additions and 5 deletions

View file

@ -0,0 +1,205 @@
#compdef gh
# zsh completion for gh -*- shell-script -*-
__gh_debug()
{
local file="$BASH_COMP_DEBUG_FILE"
if [[ -n ${file} ]]; then
echo "$*" >> "${file}"
fi
}
_gh()
{
local shellCompDirectiveError=1
local shellCompDirectiveNoSpace=2
local shellCompDirectiveNoFileComp=4
local shellCompDirectiveFilterFileExt=8
local shellCompDirectiveFilterDirs=16
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace
local -a completions
__gh_debug "\n========= starting completion logic =========="
__gh_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
# The user could have moved the cursor backwards on the command-line.
# We need to trigger completion from the $CURRENT location, so we need
# to truncate the command-line ($words) up to the $CURRENT location.
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
words=("${=words[1,CURRENT]}")
__gh_debug "Truncated words[*]: ${words[*]},"
lastParam=${words[-1]}
lastChar=${lastParam[-1]}
__gh_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
# For zsh, when completing a flag with an = (e.g., gh -n=<TAB>)
# completions must be prefixed with the flag
setopt local_options BASH_REMATCH
if [[ "${lastParam}" =~ '-.*=' ]]; then
# We are dealing with a flag with an =
flagPrefix="-P ${BASH_REMATCH}"
fi
# Prepare the command to obtain completions
requestComp="${words[1]} __complete ${words[2,-1]}"
if [ "${lastChar}" = "" ]; then
# If the last parameter is complete (there is a space following it)
# We add an extra empty parameter so we can indicate this to the go completion code.
__gh_debug "Adding extra empty parameter"
requestComp="${requestComp} \"\""
fi
__gh_debug "About to call: eval ${requestComp}"
# Use eval to handle any environment variables and such
out=$(eval ${requestComp} 2>/dev/null)
__gh_debug "completion output: ${out}"
# Extract the directive integer following a : from the last line
local lastLine
while IFS='\n' read -r line; do
lastLine=${line}
done < <(printf "%s\n" "${out[@]}")
__gh_debug "last line: ${lastLine}"
if [ "${lastLine[1]}" = : ]; then
directive=${lastLine[2,-1]}
# Remove the directive including the : and the newline
local suffix
(( suffix=${#lastLine}+2))
out=${out[1,-$suffix]}
else
# There is no directive specified. Leave $out as is.
__gh_debug "No directive found. Setting do default"
directive=0
fi
__gh_debug "directive: ${directive}"
__gh_debug "completions: ${out}"
__gh_debug "flagPrefix: ${flagPrefix}"
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
__gh_debug "Completion received error. Ignoring completions."
return
fi
local activeHelpMarker="_activeHelp_ "
local endIndex=${#activeHelpMarker}
local startIndex=$((${#activeHelpMarker}+1))
local hasActiveHelp=0
while IFS='\n' read -r comp; do
# Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
__gh_debug "ActiveHelp found: $comp"
comp="${comp[$startIndex,-1]}"
if [ -n "$comp" ]; then
compadd -x "${comp}"
__gh_debug "ActiveHelp will need delimiter"
hasActiveHelp=1
fi
continue
fi
if [ -n "$comp" ]; then
# If requested, completions are returned with a description.
# The description is preceded by a TAB character.
# For zsh's _describe, we need to use a : instead of a TAB.
# We first need to escape any : as part of the completion itself.
comp=${comp//:/\\:}
local tab="$(printf '\t')"
comp=${comp//$tab/:}
__gh_debug "Adding completion: ${comp}"
completions+=${comp}
lastComp=$comp
fi
done < <(printf "%s\n" "${out[@]}")
# Add a delimiter after the activeHelp statements, but only if:
# - there are completions following the activeHelp statements, or
# - file completion will be performed (so there will be choices after the activeHelp)
if [ $hasActiveHelp -eq 1 ]; then
if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
__gh_debug "Adding activeHelp delimiter"
compadd -x "--"
hasActiveHelp=0
fi
fi
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
__gh_debug "Activating nospace."
noSpace="-S ''"
fi
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
# File extension filtering
local filteringCmd
filteringCmd='_files'
for filter in ${completions[@]}; do
if [ ${filter[1]} != '*' ]; then
# zsh requires a glob pattern to do file filtering
filter="\*.$filter"
fi
filteringCmd+=" -g $filter"
done
filteringCmd+=" ${flagPrefix}"
__gh_debug "File filtering command: $filteringCmd"
_arguments '*:filename:'"$filteringCmd"
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
# File completion for directories only
local subdir
subdir="${completions[1]}"
if [ -n "$subdir" ]; then
__gh_debug "Listing directories in $subdir"
pushd "${subdir}" >/dev/null 2>&1
else
__gh_debug "Listing directories in ."
fi
local result
_arguments '*:dirname:_files -/'" ${flagPrefix}"
result=$?
if [ -n "$subdir" ]; then
popd >/dev/null 2>&1
fi
return $result
else
__gh_debug "Calling _describe"
if eval _describe "completions" completions $flagPrefix $noSpace; then
__gh_debug "_describe found some completions"
# Return the success of having called _describe
return 0
else
__gh_debug "_describe did not find completions."
__gh_debug "Checking if we should do file completion."
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
__gh_debug "deactivating file completion"
# We must return an error code here to let zsh know that there were no
# completions found by _describe; this is what will trigger other
# matching algorithms to attempt to find completions.
# For example zsh can match letters in the middle of words.
return 1
else
# Perform file completion
__gh_debug "Activating file completion"
# We must return the result of this command, so it must be the
# last command, or else we must store its result to return it.
_arguments '*:filename:_files'" ${flagPrefix}"
fi
fi
fi
}
# don't run the completion function when being source-ed or eval-ed
if [ "$funcstack[1]" = "_gh" ]; then
_gh
fi

View file

@ -1,6 +1,6 @@
#compdef pdm
PDM_PYTHON="$HOME/.local/pipx/venvs/pdm/bin/python"
PDM_PYTHON="$HOME/.cache/viv/venvs/c63f4950/bin/python"
PDM_PIP_INDEXES=($(command ${PDM_PYTHON} -m pdm config pypi.url))
_pdm() {
@ -145,6 +145,7 @@ _pdm() {
{-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-f+,--format+}"[Specify the export file format]:format:(pipfile poetry flit requirements setuppy)"
"--without-hashes[Don't include artifact hashes]"
"--expandvars[Expand environment variables in requirements]"
{-L,--lockfile}'[Specify another lockfile path, or use `PDM_LOCKFILE` env variable. Default: pdm.lock]:lockfile:_files'
{-o+,--output+}"[Write output to the given file, or print to stdout if not given]:output file:_files"
{-G+,--group+}'[Select group of optional-dependencies or dev-dependencies(with -d). Can be supplied multiple times, use ":all" to include all groups under the same species]:group:_pdm_groups'
@ -298,6 +299,7 @@ _pdm() {
{-i,--identity}'[GPG identity used to sign files.]:gpg identity:'
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
{-c,--comment}'[The comment to include with the distribution file.]:comment:'
"--no-verify-ssl[Disable SSL verification]"
"--ca-certs[The path to a PEM-encoded Certificate Authority bundle to use for publish server validation]:cacerts:_files"
"--no-build[Don't build the package before publishing]"
)

View file

@ -0,0 +1,768 @@
#compdef pixi
autoload -U is-at-least
_pixi() {
typeset -A opt_args
typeset -a _arguments_options
local ret=1
if is-at-least 5.2; then
_arguments_options=(-s -S -C)
else
_arguments_options=(-s -C)
fi
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_pixi_commands" \
"*::: :->pixi" \
&& ret=0
case $state in
(pixi)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:pixi-command-$line[1]:"
case $line[1] in
(completion)
_arguments "${_arguments_options[@]}" \
'-s+[The shell to generate a completion script for (defaults to '\''bash'\'')]:SHELL:(bash elvish fish powershell zsh)' \
'--shell=[The shell to generate a completion script for (defaults to '\''bash'\'')]:SHELL:(bash elvish fish powershell zsh)' \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
'*-c+[Channels to use in the project]:channel: ' \
'*--channel=[Channels to use in the project]:channel: ' \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
'::path -- Where to place the project (defaults to current path):_files' \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[The path to '\''pixi.toml'\'']:MANIFEST_PATH:_files' \
'(--build)--host[This is a host dependency]' \
'(--host)--build[This is a build dependency]' \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'*::specs -- Specify the dependencies you wish to add to the project:' \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[The path to '\''pixi.toml'\'']:MANIFEST_PATH:_files' \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
'*::task -- The task you want to run in the projects environment:' \
&& ret=0
;;
(shell)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[The path to '\''pixi.toml'\'']:MANIFEST_PATH:_files' \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(global)
_arguments "${_arguments_options[@]}" \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
":: :_pixi__global_commands" \
"*::: :->global" \
&& ret=0
case $state in
(global)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:pixi-global-command-$line[1]:"
case $line[1] in
(install)
_arguments "${_arguments_options[@]}" \
'*-c+[Represents the channels from which the package will be installed. Multiple channels can be specified by using this field multiple times]:CHANNEL: ' \
'*--channel=[Represents the channels from which the package will be installed. Multiple channels can be specified by using this field multiple times]:CHANNEL: ' \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':package -- Specifies the package that is to be installed:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_pixi__global__help_commands" \
"*::: :->help" \
&& ret=0
case $state in
(help)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:pixi-global-help-command-$line[1]:"
case $line[1] in
(install)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
esac
;;
esac
;;
esac
;;
esac
;;
(auth)
_arguments "${_arguments_options[@]}" \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_pixi__auth_commands" \
"*::: :->auth" \
&& ret=0
case $state in
(auth)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:pixi-auth-command-$line[1]:"
case $line[1] in
(login)
_arguments "${_arguments_options[@]}" \
'--token=[The token to use (for authentication with prefix.dev)]:TOKEN: ' \
'--username=[The username to use (for basic HTTP authentication)]:USERNAME: ' \
'--password=[The password to use (for basic HTTP authentication)]:PASSWORD: ' \
'--conda-token=[The token to use on anaconda.org / quetz authentication]:CONDA_TOKEN: ' \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
':host -- The host to authenticate with (e.g. repo.prefix.dev):' \
&& ret=0
;;
(logout)
_arguments "${_arguments_options[@]}" \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
':host -- The host to remove authentication for:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_pixi__auth__help_commands" \
"*::: :->help" \
&& ret=0
case $state in
(help)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:pixi-auth-help-command-$line[1]:"
case $line[1] in
(login)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(logout)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
esac
;;
esac
;;
esac
;;
esac
;;
(install)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[The path to '\''pixi.toml'\'']:MANIFEST_PATH:_files' \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(task)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[The path to '\''pixi.toml'\'']:MANIFEST_PATH:_files' \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_pixi__task_commands" \
"*::: :->task" \
&& ret=0
case $state in
(task)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:pixi-task-command-$line[1]:"
case $line[1] in
(add)
_arguments "${_arguments_options[@]}" \
'*--depends-on=[Depends on these other commands]:DEPENDS_ON: ' \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
':name -- Task name:' \
'*::commands -- One or more commands to actually execute:' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
'*::names -- Task names to remove:' \
&& ret=0
;;
(alias)
_arguments "${_arguments_options[@]}" \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
':alias -- Alias name:' \
'*::depends_on -- Depends on these tasks to execute:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_pixi__task__help_commands" \
"*::: :->help" \
&& ret=0
case $state in
(help)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:pixi-task-help-command-$line[1]:"
case $line[1] in
(add)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(alias)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
esac
;;
esac
;;
esac
;;
esac
;;
(info)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[The path to '\''pixi.toml'\'']:MANIFEST_PATH:_files' \
'--json[Wether to show the output as JSON or not]' \
'*-v[More output per occurrence]' \
'*--verbose[More output per occurrence]' \
'(-v --verbose)*-q[Less output per occurrence]' \
'(-v --verbose)*--quiet[Less output per occurrence]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_pixi__help_commands" \
"*::: :->help" \
&& ret=0
case $state in
(help)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:pixi-help-command-$line[1]:"
case $line[1] in
(completion)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(add)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(shell)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(global)
_arguments "${_arguments_options[@]}" \
":: :_pixi__help__global_commands" \
"*::: :->global" \
&& ret=0
case $state in
(global)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:pixi-help-global-command-$line[1]:"
case $line[1] in
(install)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
esac
;;
esac
;;
(auth)
_arguments "${_arguments_options[@]}" \
":: :_pixi__help__auth_commands" \
"*::: :->auth" \
&& ret=0
case $state in
(auth)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:pixi-help-auth-command-$line[1]:"
case $line[1] in
(login)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(logout)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
esac
;;
esac
;;
(install)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(task)
_arguments "${_arguments_options[@]}" \
":: :_pixi__help__task_commands" \
"*::: :->task" \
&& ret=0
case $state in
(task)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:pixi-help-task-command-$line[1]:"
case $line[1] in
(add)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(alias)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
esac
;;
esac
;;
(info)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
esac
;;
esac
;;
esac
;;
esac
}
(( $+functions[_pixi_commands] )) ||
_pixi_commands() {
local commands; commands=(
'completion:Generates a completion script for a shell' \
'init:Creates a new project' \
'add:Adds a dependency to the project' \
'run:Runs task in project' \
'shell:Start a shell in the pixi environment of the project' \
'global:Global is the main entry point for the part of pixi that executes on the global(system) level' \
'auth:Login to prefix.dev or anaconda.org servers to access private channels' \
'install:Install all dependencies' \
'task:Command management in project' \
'info:' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'pixi commands' commands "$@"
}
(( $+functions[_pixi__add_commands] )) ||
_pixi__add_commands() {
local commands; commands=()
_describe -t commands 'pixi add commands' commands "$@"
}
(( $+functions[_pixi__help__add_commands] )) ||
_pixi__help__add_commands() {
local commands; commands=()
_describe -t commands 'pixi help add commands' commands "$@"
}
(( $+functions[_pixi__help__task__add_commands] )) ||
_pixi__help__task__add_commands() {
local commands; commands=()
_describe -t commands 'pixi help task add commands' commands "$@"
}
(( $+functions[_pixi__task__add_commands] )) ||
_pixi__task__add_commands() {
local commands; commands=()
_describe -t commands 'pixi task add commands' commands "$@"
}
(( $+functions[_pixi__task__help__add_commands] )) ||
_pixi__task__help__add_commands() {
local commands; commands=()
_describe -t commands 'pixi task help add commands' commands "$@"
}
(( $+functions[_pixi__help__task__alias_commands] )) ||
_pixi__help__task__alias_commands() {
local commands; commands=()
_describe -t commands 'pixi help task alias commands' commands "$@"
}
(( $+functions[_pixi__task__alias_commands] )) ||
_pixi__task__alias_commands() {
local commands; commands=()
_describe -t commands 'pixi task alias commands' commands "$@"
}
(( $+functions[_pixi__task__help__alias_commands] )) ||
_pixi__task__help__alias_commands() {
local commands; commands=()
_describe -t commands 'pixi task help alias commands' commands "$@"
}
(( $+functions[_pixi__auth_commands] )) ||
_pixi__auth_commands() {
local commands; commands=(
'login:Store authentication information for a given host' \
'logout:Remove authentication information for a given host' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'pixi auth commands' commands "$@"
}
(( $+functions[_pixi__help__auth_commands] )) ||
_pixi__help__auth_commands() {
local commands; commands=(
'login:Store authentication information for a given host' \
'logout:Remove authentication information for a given host' \
)
_describe -t commands 'pixi help auth commands' commands "$@"
}
(( $+functions[_pixi__completion_commands] )) ||
_pixi__completion_commands() {
local commands; commands=()
_describe -t commands 'pixi completion commands' commands "$@"
}
(( $+functions[_pixi__help__completion_commands] )) ||
_pixi__help__completion_commands() {
local commands; commands=()
_describe -t commands 'pixi help completion commands' commands "$@"
}
(( $+functions[_pixi__global_commands] )) ||
_pixi__global_commands() {
local commands; commands=(
'install:Installs the defined package in a global accessible location' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'pixi global commands' commands "$@"
}
(( $+functions[_pixi__help__global_commands] )) ||
_pixi__help__global_commands() {
local commands; commands=(
'install:Installs the defined package in a global accessible location' \
)
_describe -t commands 'pixi help global commands' commands "$@"
}
(( $+functions[_pixi__auth__help_commands] )) ||
_pixi__auth__help_commands() {
local commands; commands=(
'login:Store authentication information for a given host' \
'logout:Remove authentication information for a given host' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'pixi auth help commands' commands "$@"
}
(( $+functions[_pixi__auth__help__help_commands] )) ||
_pixi__auth__help__help_commands() {
local commands; commands=()
_describe -t commands 'pixi auth help help commands' commands "$@"
}
(( $+functions[_pixi__global__help_commands] )) ||
_pixi__global__help_commands() {
local commands; commands=(
'install:Installs the defined package in a global accessible location' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'pixi global help commands' commands "$@"
}
(( $+functions[_pixi__global__help__help_commands] )) ||
_pixi__global__help__help_commands() {
local commands; commands=()
_describe -t commands 'pixi global help help commands' commands "$@"
}
(( $+functions[_pixi__help_commands] )) ||
_pixi__help_commands() {
local commands; commands=(
'completion:Generates a completion script for a shell' \
'init:Creates a new project' \
'add:Adds a dependency to the project' \
'run:Runs task in project' \
'shell:Start a shell in the pixi environment of the project' \
'global:Global is the main entry point for the part of pixi that executes on the global(system) level' \
'auth:Login to prefix.dev or anaconda.org servers to access private channels' \
'install:Install all dependencies' \
'task:Command management in project' \
'info:' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'pixi help commands' commands "$@"
}
(( $+functions[_pixi__help__help_commands] )) ||
_pixi__help__help_commands() {
local commands; commands=()
_describe -t commands 'pixi help help commands' commands "$@"
}
(( $+functions[_pixi__task__help_commands] )) ||
_pixi__task__help_commands() {
local commands; commands=(
'add:Add a command to the project' \
'remove:Remove a command from the project' \
'alias:Alias another specific command' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'pixi task help commands' commands "$@"
}
(( $+functions[_pixi__task__help__help_commands] )) ||
_pixi__task__help__help_commands() {
local commands; commands=()
_describe -t commands 'pixi task help help commands' commands "$@"
}
(( $+functions[_pixi__help__info_commands] )) ||
_pixi__help__info_commands() {
local commands; commands=()
_describe -t commands 'pixi help info commands' commands "$@"
}
(( $+functions[_pixi__info_commands] )) ||
_pixi__info_commands() {
local commands; commands=()
_describe -t commands 'pixi info commands' commands "$@"
}
(( $+functions[_pixi__help__init_commands] )) ||
_pixi__help__init_commands() {
local commands; commands=()
_describe -t commands 'pixi help init commands' commands "$@"
}
(( $+functions[_pixi__init_commands] )) ||
_pixi__init_commands() {
local commands; commands=()
_describe -t commands 'pixi init commands' commands "$@"
}
(( $+functions[_pixi__global__help__install_commands] )) ||
_pixi__global__help__install_commands() {
local commands; commands=()
_describe -t commands 'pixi global help install commands' commands "$@"
}
(( $+functions[_pixi__global__install_commands] )) ||
_pixi__global__install_commands() {
local commands; commands=()
_describe -t commands 'pixi global install commands' commands "$@"
}
(( $+functions[_pixi__help__global__install_commands] )) ||
_pixi__help__global__install_commands() {
local commands; commands=()
_describe -t commands 'pixi help global install commands' commands "$@"
}
(( $+functions[_pixi__help__install_commands] )) ||
_pixi__help__install_commands() {
local commands; commands=()
_describe -t commands 'pixi help install commands' commands "$@"
}
(( $+functions[_pixi__install_commands] )) ||
_pixi__install_commands() {
local commands; commands=()
_describe -t commands 'pixi install commands' commands "$@"
}
(( $+functions[_pixi__auth__help__login_commands] )) ||
_pixi__auth__help__login_commands() {
local commands; commands=()
_describe -t commands 'pixi auth help login commands' commands "$@"
}
(( $+functions[_pixi__auth__login_commands] )) ||
_pixi__auth__login_commands() {
local commands; commands=()
_describe -t commands 'pixi auth login commands' commands "$@"
}
(( $+functions[_pixi__help__auth__login_commands] )) ||
_pixi__help__auth__login_commands() {
local commands; commands=()
_describe -t commands 'pixi help auth login commands' commands "$@"
}
(( $+functions[_pixi__auth__help__logout_commands] )) ||
_pixi__auth__help__logout_commands() {
local commands; commands=()
_describe -t commands 'pixi auth help logout commands' commands "$@"
}
(( $+functions[_pixi__auth__logout_commands] )) ||
_pixi__auth__logout_commands() {
local commands; commands=()
_describe -t commands 'pixi auth logout commands' commands "$@"
}
(( $+functions[_pixi__help__auth__logout_commands] )) ||
_pixi__help__auth__logout_commands() {
local commands; commands=()
_describe -t commands 'pixi help auth logout commands' commands "$@"
}
(( $+functions[_pixi__help__task__remove_commands] )) ||
_pixi__help__task__remove_commands() {
local commands; commands=()
_describe -t commands 'pixi help task remove commands' commands "$@"
}
(( $+functions[_pixi__task__help__remove_commands] )) ||
_pixi__task__help__remove_commands() {
local commands; commands=()
_describe -t commands 'pixi task help remove commands' commands "$@"
}
(( $+functions[_pixi__task__remove_commands] )) ||
_pixi__task__remove_commands() {
local commands; commands=()
_describe -t commands 'pixi task remove commands' commands "$@"
}
(( $+functions[_pixi__help__run_commands] )) ||
_pixi__help__run_commands() {
local commands; commands=()
_describe -t commands 'pixi help run commands' commands "$@"
}
(( $+functions[_pixi__run_commands] )) ||
_pixi__run_commands() {
local commands; commands=()
_describe -t commands 'pixi run commands' commands "$@"
}
(( $+functions[_pixi__help__shell_commands] )) ||
_pixi__help__shell_commands() {
local commands; commands=()
_describe -t commands 'pixi help shell commands' commands "$@"
}
(( $+functions[_pixi__shell_commands] )) ||
_pixi__shell_commands() {
local commands; commands=()
_describe -t commands 'pixi shell commands' commands "$@"
}
(( $+functions[_pixi__help__task_commands] )) ||
_pixi__help__task_commands() {
local commands; commands=(
'add:Add a command to the project' \
'remove:Remove a command from the project' \
'alias:Alias another specific command' \
)
_describe -t commands 'pixi help task commands' commands "$@"
}
(( $+functions[_pixi__task_commands] )) ||
_pixi__task_commands() {
local commands; commands=(
'add:Add a command to the project' \
'remove:Remove a command from the project' \
'alias:Alias another specific command' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'pixi task commands' commands "$@"
}
if [ "$funcstack[1]" = "_pixi" ]; then
_pixi "$@"
else
compdef _pixi pixi
fi

View file

@ -1,4 +0,0 @@
#compdef todo
# show files in the functions dir (exclude dirs)
_path_files -W "$PWD" -g "**/*(.)"

View file

@ -17,7 +17,9 @@ gen() {
echo "GENERATING COMPLETION SCRIPTS"
echo "-----------------------------"
gen pdm completion zsh
gen chezmoi completion zsh
gen rye self completion -s zsh
gen gh completion -s zsh
gen pixi completion -s zsh