update completions

This commit is contained in:
Daylin Morgan 2023-12-13 15:46:08 -06:00
parent 3055a75db4
commit 5473d6edef
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
4 changed files with 149 additions and 8 deletions

View file

@ -0,0 +1,120 @@
#compdef nim
# Installation note:
# Please name this file as _nim (with underscore!) and copy it to a
# completions directory, either:
# - system wide one, like /usr/share/zsh/functions/Completion/Unix/ on Linux
# - or to a user directory like ~/scripts. Then you also need to add
# that directory in your ~/.zshrc to `fpath` array like so:
# fpath=( ~/scripts "${fpath[@]}" )
_nim() {
local -a nimCommands=(
{compile,c}:'compile project with default code generator C'
{compileToC,cc}:'compile project with C code generator'
{compileToCpp,cpp}:'compile project to C++ code'
{compileToOC,objc}:'compile project to Objective C code'
'js:compile project to Javascript'
'e:run a Nimscript file'
'doc:generate the HTML documentation for inputfile'
'rst2html:convert a reStructuredText file to HTML'
'doc2tex:generate the documentation for inputfile to LaTeX'
'rst2tex:convert a reStructuredText file to TeX'
'jsondoc:extract the documentation to a json file'
'buildIndex:build an index for the whole documentation'
'genDepend:generate a DOT file containing the module dependency graph'
'dump:dump all defined conditionals and search paths'
'check:checks the project for syntax and semantic'
{--help,-h}:'basic help'
'--fullhelp:show all switches'
{-v,--version}:'show version'
)
_arguments '*:: :->anyState' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "Nim commands" nimCommands -V1
return
fi
local -a conditionalSymbols=(
release danger mingw androidNDK useNimRtl useMalloc noSignalHandler ssl
debug leanCompiler gcDestructors)
local -a sharedOpts=(
{--define\\:-,-d\\:-}'[define a conditional symbol]:x:($conditionalSymbols)'
{--undef\\:-,-u\\:-}'[undefine a conditional symbol]:x:($conditionalSymbols)'
{--path\\:-,-p\\:-}'[add path to search paths]:x:_files'
'--verbosity\:-[set verbosity level (default\: 1)]:x:(0 1 2 3)'
'--hints\:-[print compilation hints? (or `list`)]:x:(on off list)'
)
local runOpts=(
{--run,-r}'[run the application]'
)
local docOpts=(
'--index\:-[enable index .idx files?]:x:(on off)'
'--project\:-[output any dependency for doc?]:x:(on off)'
'--docInternal\:-[generate module-private documentation?]:x:(on off)'
)
local -a codeOpts=(
{--forceBuild,-f}'[force rebuilding of all modules]'
'--stackTrace\:-[enable stack tracing?]:x:(on off)'
'--lineTrace\:-[enable line tracing?]:x:(on off)'
'--threads\:-[enable support for multi-threading?]:x:(on off)'
{--checks\\:-,-x\\:-}'[enable/disable all runtime checks?]:x:(on off)'
'--objChecks\:-[enable obj conversion checks]:x:(on off)'
'--fieldChecks\:-[enable case variant field checks?]:x:(on off)'
'--rangeChecks\:-[enable range checks?]:x:(on off)'
'--boundChecks\:-[enable bound checks?]:x:(on off)'
'--overflowChecks\:-[enable integer over-/underflow checks?]:x:(on off)'
{--assertions\\:-,-a\\:-}'[enable assertions?]:x:(on off)'
'--floatChecks\:-[enable floating point (NaN/Inf) checks?]:x:(on off)'
'--nanChecks\:-[enable NaN checks?]:x:(on off)'
'--infChecks\:-[enable Inf checks?]:x:(on off)'
'--nilChecks\:-[enable nil checks?]:x:(on off)'
'--expandArc\:-[show how given proc looks before final backend pass]'
'--expandMacro\:-[dump every generated AST from given macro]'
)
local -a nativeOpts=(
'--opt\:-[optimization mode]:x:(none speed size)'
'--debugger\:native[use native debugger (gdb)]'
'--app\:-[generate this type of app (lib=dynamic)]:x:(console gui lib staticlib)'
'--cpu\:-[target architecture]:x:(alpha amd64 arm arm64 avr e2k esp hppa i386 ia64 js loongarch64 m68k mips mipsel mips64 mips64el msp430 nimvm powerpc powerpc64 powerpc64el riscv32 riscv64 sparc sparc64 vm wasm32)'
'--gc\:-[memory management algorithm to use (default\: refc)]:x:(refc arc orc markAndSweep boehm go regions none)'
'--os\:-[operating system to compile for]:x:(AIX Amiga Android Any Atari DOS DragonFly FreeBSD FreeRTOS Genode Haiku iOS Irix JS Linux MacOS MacOSX MorphOS NetBSD Netware NimVM NintendoSwitch OS2 OpenBSD PalmOS Standalone QNX SkyOS Solaris VxWorks Windows)'
'--panics\:-[turn panics into process termination (default\: off)]:x:(off on)'
)
case "$words[1]" in
compile|c|compileToC|cpp|compileToCpp|compileToOC|objc)
_arguments $codeOpts $runOpts $sharedOpts $nativeOpts \
'*:filename:_files -g"*.nim"'
;;
js)
_arguments $codeOpts $runOpts $sharedOpts \
'*:filename:_files -g"*.nim"'
;;
e)
_arguments $codeOpts $runOpts $sharedOpts \
'*:filename:_files -g"*.nims"'
;;
doc|doc2tex|jsondoc)
_arguments $runOpts $sharedOpts '*:filename:_files -g"*.nim"'
;;
rst2html|rst2tex)
_arguments $runOpts $sharedOpts $docOpts '*:filename:_files -g"*.rst"'
;;
buildIndex|genDepend|check)
_arguments $sharedOpts '*:filename:_files -g"*.nim"'
;;
dump)
_arguments $sharedOpts
;;
*)
_arguments '*:filename:_files -g"*"'
;;
esac
return 1
}
_nim "$@"

View file

@ -12,7 +12,8 @@ _pdm() {
local curcontext=$curcontext ret=1 local curcontext=$curcontext ret=1
local -a arguments=( local -a arguments=(
{-h,--help}'[Show help message and exit]' {-h,--help}'[Show help message and exit]'
{-v,--verbose}'[Show detailed output]' {-v,--verbose}'[Use `-v` for detailed output and `-vv` for more detailed]'
{-q,--quiet}'[Suppress output]'
) )
local sub_commands=( local sub_commands=(
'add:Add package(s) to pyproject.toml and install them' 'add:Add package(s) to pyproject.toml and install them'
@ -73,6 +74,7 @@ _pdm() {
'--update-all[Update all dependencies and sub-dependencies]' '--update-all[Update all dependencies and sub-dependencies]'
'--no-editable[Install non-editable versions for all packages]' '--no-editable[Install non-editable versions for all packages]'
"--no-self[Don't install the project itself]" "--no-self[Don't install the project itself]"
"--no-lock[Don't try to create or update the lockfile. [env var: PDM_NO_LOCK]]"
'--venv[Run the command in the virtual environment with the given key. (env var: PDM_IN_VENV)]:venv:' '--venv[Run the command in the virtual environment with the given key. (env var: PDM_IN_VENV)]:venv:'
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]' {-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
{-u,--unconstrained}'[Ignore the version constraint of packages]' {-u,--unconstrained}'[Ignore the version constraint of packages]'
@ -128,6 +130,7 @@ _pdm() {
{-g,--global}'[Use the global project, supply the project root with `-p` option]' \ {-g,--global}'[Use the global project, supply the project root with `-p` option]' \
{-l,--local}"[Set config in the project's local configuration file]" \ {-l,--local}"[Set config in the project's local configuration file]" \
{-d,--delete}'[Unset a configuration key]' \ {-d,--delete}'[Unset a configuration key]' \
{-e,--edit}'[Edit the configuration file in the default editor(defined by EDITOR env var)]' \
'1:key:->keys' \ '1:key:->keys' \
'2:value:_files' && return 0 '2:value:_files' && return 0
if [[ $state == keys ]]; then if [[ $state == keys ]]; then
@ -184,9 +187,13 @@ _pdm() {
{-g,--global}'[Use the global project, supply the project root with `-p` option]' {-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-n,--non-interactive}"[Don't ask questions but use default values]" {-n,--non-interactive}"[Don't ask questions but use default values]"
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]' {-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
'--backend[Specify the build backend]:backend:(pdm-backend setuptools hatchling flit pdm-pep517)' {-r,--overwrite}'[Overwrite existing files]'
'--backend[Specify the build backend]:backend:(pdm-backend setuptools hatchling flit)'
'--lib[Create a library project]' '--lib[Create a library project]'
'--python[Specify the Python version/path to use]:python:' '--python[Specify the Python version/path to use]:python:'
'--copier[Use Copier to generate project]'
'--cookiecutter[Use Cookiecutter to generate project]'
'1:template:'
) )
;; ;;
install) install)
@ -197,7 +204,7 @@ _pdm() {
{-L,--lockfile}'[Specify another lockfile path, or use `PDM_LOCKFILE` env variable. Default: pdm.lock]:lockfile:_files' {-L,--lockfile}'[Specify another lockfile path, or use `PDM_LOCKFILE` env variable. Default: pdm.lock]:lockfile:_files'
{--prod,--production}"[Unselect dev dependencies]" {--prod,--production}"[Unselect dev dependencies]"
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]' {-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
"--no-lock[Don't do lock if lock file is not found or outdated]" "--no-lock[Don't try to create or update the lockfile. [env var: PDM_NO_LOCK]]"
"--no-default[Don\'t include dependencies from the default group]" "--no-default[Don\'t include dependencies from the default group]"
'--no-editable[Install non-editable versions for all packages]' '--no-editable[Install non-editable versions for all packages]'
"--no-self[Don't install the project itself]" "--no-self[Don't install the project itself]"
@ -212,18 +219,19 @@ _pdm() {
list) list)
arguments+=( arguments+=(
{-g,--global}'[Use the global project, supply the project root with `-p` option]' {-g,--global}'[Use the global project, supply the project root with `-p` option]'
{-r,--reverse}'[Reverse the dependency graph]' {-r,--reverse}'[Reverse the dependency tree]'
'--fields[Select information to output as a comma separated string.]:fields:' '--fields[Select information to output as a comma separated string.]:fields:'
"--sort[Sort the output using a given field name. If nothing is set, no sort is applied. Multiple fields can be combined with ',']:sort:" "--sort[Sort the output using a given field name. If nothing is set, no sort is applied. Multiple fields can be combined with ',']:sort:"
'--json[Output dependencies in JSON document format]' '--json[Output dependencies in JSON document format]'
'--csv[Output dependencies in CSV document format]' '--csv[Output dependencies in CSV document format]'
'--markdown[Output dependencies and legal notices in markdown document format - best effort basis]' '--markdown[Output dependencies and legal notices in markdown document format - best effort basis]'
'--graph[Display a graph of dependencies]' '{--tree,--graph}[Display a tree of dependencies]'
"--freeze[Show the installed dependencies as pip's requirements.txt format]" "--freeze[Show the installed dependencies as pip's requirements.txt format]"
"--include[Dependency groups to include in the output. By default all are included]:include:" "--include[Dependency groups to include in the output. By default all are included]:include:"
"--exclude[Dependency groups to exclude from the output]:exclude:" "--exclude[Dependency groups to exclude from the output]:exclude:"
"--resolve[Resolve all requirements to output licenses (instead of just showing those currently installed)]" "--resolve[Resolve all requirements to output licenses (instead of just showing those currently installed)]"
'--venv[Run the command in the virtual environment with the given key. (env var: PDM_IN_VENV)]:venv:' '--venv[Run the command in the virtual environment with the given key. (env var: PDM_IN_VENV)]:venv:'
'*:patterns:'
) )
;; ;;
lock) lock)
@ -237,8 +245,11 @@ _pdm() {
{-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' {-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'
{-d,--dev}"[Select dev dependencies]" {-d,--dev}"[Select dev dependencies]"
{--prod,--production}"[Unselect dev dependencies]" {--prod,--production}"[Unselect dev dependencies]"
"--static-urls[(DEPRECATED) Store static file URLs in the lockfile]"
"--no-static-urls[(DEPRECATED) Do not store static file URLs in the lockfile]"
"--no-default[Don\'t include dependencies from the default group]" "--no-default[Don\'t include dependencies from the default group]"
"--no-cross-platform[Only lock packages for the current platform]" "--no-cross-platform[(DEPRECATED) Only lock packages for the current platform]"
{-S,--strategy}'Specify lock strategy(cross_platform,static_urls,direct_minimal_versions). Add no_ prefix to disable. Support given multiple times or split by comma.:strategy:'
) )
;; ;;
self) self)
@ -314,6 +325,7 @@ _pdm() {
"--no-sync[Only write pyproject.toml and do not uninstall packages]" "--no-sync[Only write pyproject.toml and do not uninstall packages]"
'--no-editable[Install non-editable versions for all packages]' '--no-editable[Install non-editable versions for all packages]'
"--no-self[Don't install the project itself]" "--no-self[Don't install the project itself]"
"--no-lock[Don't try to create or update the lockfile. [env var: PDM_NO_LOCK]]"
{-x,--fail-fast}'[Abort on first installation error]' {-x,--fail-fast}'[Abort on first installation error]'
"--no-isolation[do not isolate the build in a clean environment]" "--no-isolation[do not isolate the build in a clean environment]"
"--dry-run[Show the difference only without modifying the lockfile content]" "--dry-run[Show the difference only without modifying the lockfile content]"
@ -391,6 +403,7 @@ _pdm() {
'--no-editable[Install non-editable versions for all packages]' '--no-editable[Install non-editable versions for all packages]'
"--no-self[Don't install the project itself]" "--no-self[Don't install the project itself]"
"--no-sync[Only update lock file but do not sync packages]" "--no-sync[Only update lock file but do not sync packages]"
"--no-lock[Don't try to create or update the lockfile. [env var: PDM_NO_LOCK]]"
{-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]' {-k,--skip}'[Skip some tasks and/or hooks by their comma-separated names]'
{-u,--unconstrained}'[Ignore the version constraint of packages]' {-u,--unconstrained}'[Ignore the version constraint of packages]'
{--pre,--prerelease}'[Allow prereleases to be pinned]' {--pre,--prerelease}'[Allow prereleases to be pinned]'

View file

@ -1,4 +1,5 @@
#compdef rclone #compdef rclone
compdef _rclone rclone
# zsh completion for rclone -*- shell-script -*- # zsh completion for rclone -*- shell-script -*-
@ -17,8 +18,9 @@ _rclone()
local shellCompDirectiveNoFileComp=4 local shellCompDirectiveNoFileComp=4
local shellCompDirectiveFilterFileExt=8 local shellCompDirectiveFilterFileExt=8
local shellCompDirectiveFilterDirs=16 local shellCompDirectiveFilterDirs=16
local shellCompDirectiveKeepOrder=32
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
local -a completions local -a completions
__rclone_debug "\n========= starting completion logic ==========" __rclone_debug "\n========= starting completion logic =========="
@ -136,6 +138,11 @@ _rclone()
noSpace="-S ''" noSpace="-S ''"
fi fi
if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
__rclone_debug "Activating keep order."
keepOrder="-V"
fi
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
# File extension filtering # File extension filtering
local filteringCmd local filteringCmd
@ -171,7 +178,7 @@ _rclone()
return $result return $result
else else
__rclone_debug "Calling _describe" __rclone_debug "Calling _describe"
if eval _describe "completions" completions $flagPrefix $noSpace; then if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then
__rclone_debug "_describe found some completions" __rclone_debug "_describe found some completions"
# Return the success of having called _describe # Return the success of having called _describe

View file

@ -23,3 +23,4 @@ gen chezmoi completion zsh
gen rye self completion -s zsh gen rye self completion -s zsh
gen gh completion -s zsh gen gh completion -s zsh
gen pixi completion -s zsh gen pixi completion -s zsh
gen rclone completion zsh -