refactor(zsh): remove custom completions dir
All checks were successful
Check Formatting of Files / Check-Formatting (push) Successful in 1m4s
All checks were successful
Check Formatting of Files / Check-Formatting (push) Successful in 1m4s
This commit is contained in:
parent
8fbd3c8000
commit
84708a48fb
@ -1,26 +0,0 @@
|
||||
#compdef note
|
||||
|
||||
local file_name_comp='*: :_files -W ${NOTES_DIR} -g "*.norg(:r)" -S " "'
|
||||
|
||||
(( $+functions[_Note_subcommand] )) ||
|
||||
_Note_command() {
|
||||
local -a args
|
||||
args=(
|
||||
{--open,-o}'[Create or edit a note]'
|
||||
{--delete,-d}'[Delete a note]'
|
||||
{--list,-l}'[List all notes]'
|
||||
{--help,-h}'[Show help menu]'
|
||||
{--version,-V}'[Show program version]'
|
||||
"${file_name_comp}"
|
||||
)
|
||||
|
||||
_arguments -S -s $args
|
||||
}
|
||||
|
||||
if (( ${#words} == 2 )); then
|
||||
_Note_command
|
||||
elif (( ${#words} == 3)); then
|
||||
_arguments "${file_name_comp}"
|
||||
elif (( ${#words} > 3 )) && [[ ${words[2]} = "--delete" || ${words[2]} = "-d" ]]; then
|
||||
_arguments "${file_name_comp}"
|
||||
fi
|
@ -1,99 +0,0 @@
|
||||
#compdef bat
|
||||
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
(( $+functions[_bat_cache_subcommand] )) ||
|
||||
_bat_cache_subcommand() {
|
||||
local -a args
|
||||
args=(
|
||||
'(-b --build -c --clear)'{-b,--build}'[Initialize or update the syntax/theme cache]'
|
||||
'(-b --build -c --clear)'{-c,--clear}'[Remove the cached syntax definitions and themes]'
|
||||
'(--source)'--source='[Use a different directory to load syntaxes and themes from]:directory:_files -/'
|
||||
'(--target)'--target='[Use a different directory to store the cached syntax and theme set]:directory:_files -/'
|
||||
'(--blank)'--blank'[Create completely new syntax and theme sets]'
|
||||
'(: -)'{-h,--help}'[Prints help information]'
|
||||
'*: :'
|
||||
)
|
||||
|
||||
_arguments -S -s $args
|
||||
}
|
||||
|
||||
(( $+functions[_bat_main] )) ||
|
||||
_bat_main() {
|
||||
local -a args
|
||||
args=(
|
||||
'(-A --show-all)'{-A,--show-all}'[Show non-printable characters (space, tab, newline, ..)]'
|
||||
'*'{-p,--plain}'[Show plain style (alias for `--style=plain`), repeat twice to disable disable automatic paging (alias for `--paging=never`)]'
|
||||
'(-l --language)'{-l+,--language=}'[Set the language for syntax highlighting]:<language>:->language'
|
||||
'(-H --highlight-line)'{-H,--highlight-line}'[Highlight lines N through M]:<N\:M>...'
|
||||
'(--file-name)'--file-name'[Specify the name to display for a file]:<name>...:_files'
|
||||
'(-d --diff)'--diff'[Only show lines that have been added/removed/modified]'
|
||||
'(--diff-context)'--diff-context'[Include N lines of context around added/removed/modified lines when using `--diff`]:<N> (lines):()'
|
||||
'(--tabs)'--tabs'[Set the tab width to T spaces]:<T> (tab width):()'
|
||||
'(--wrap)'--wrap='[Specify the text-wrapping mode]:<when>:(auto never character)'
|
||||
'(--terminal-width)'--terminal-width'[Explicitly set the width of the terminal instead of determining it automatically]:<width>'
|
||||
'(-n --number)'{-n,--number}'[Show line numbers]'
|
||||
'(--color)'--color='[When to use colors]:<when>:(auto never always)'
|
||||
'(--italic-text)'--italic-text='[Use italics in output]:<when>:(always never)'
|
||||
'(--decorations)'--decorations='[When to show the decorations]:<when>:(auto never always)'
|
||||
'(--paging)'--paging='[Specify when to use the pager]:<when>:(auto never always)'
|
||||
'(-m --map-syntax)'{-m+,--map-syntax=}'[Use the specified syntax for files matching the glob pattern]:<glob\:syntax>...'
|
||||
'(--theme)'--theme='[Set the color theme for syntax highlighting]:<theme>:->theme'
|
||||
'(: --list-themes --list-languages -L)'--list-themes'[Display all supported highlighting themes]'
|
||||
'(--style)'--style='[Comma-separated list of style elements to display]:<components>:->style'
|
||||
'(-r --line-range)'{-r+,--line-range=}'[Only print the lines from N to M]:<N\:M>...'
|
||||
'(: --list-themes --list-languages -L)'{-L,--list-languages}'[Display all supported languages]'
|
||||
'(: --no-config)'--no-config'[Do not use the configuration file]'
|
||||
'(: --no-custom-assets)'--no-custom-assets'[Do not load custom assets]'
|
||||
'(: --config-dir)'--config-dir'[Show bat'"'"'s configuration directory]'
|
||||
'(: --config-file)'--config-file'[Show path to the configuration file]'
|
||||
'(: --generate-config-file)'--generate-config-file'[Generates a default configuration file]'
|
||||
'(: --cache-dir)'--cache-dir'[Show bat'"'"'s cache directory]'
|
||||
'(: -)'{-h,--help}'[Print this help message]'
|
||||
'(: -)'{-V,--version}'[Show version information]'
|
||||
'*: :_files'
|
||||
)
|
||||
|
||||
_arguments -S -s $args
|
||||
|
||||
case "$state" in
|
||||
language)
|
||||
local IFS=$'\n'
|
||||
local -a languages
|
||||
languages=( $(bat --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }') )
|
||||
|
||||
_describe 'language' languages
|
||||
;;
|
||||
|
||||
theme)
|
||||
local IFS=$'\n'
|
||||
local -a themes
|
||||
themes=( $(bat --list-themes | sort) )
|
||||
|
||||
_values 'theme' $themes
|
||||
;;
|
||||
|
||||
style)
|
||||
_values -s , 'style' auto full plain changes header grid rule numbers snip
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# first positional argument
|
||||
if (( ${#words} == 2 )); then
|
||||
local -a subcommands
|
||||
subcommands=('cache:Modify the syntax-definition and theme cache')
|
||||
_describe subcommand subcommands
|
||||
_bat_main
|
||||
else
|
||||
case $words[2] in
|
||||
cache)
|
||||
_bat_cache_subcommand
|
||||
;;
|
||||
|
||||
*)
|
||||
_bat_main
|
||||
;;
|
||||
esac
|
||||
fi
|
@ -1,3 +0,0 @@
|
||||
#compdef bob
|
||||
|
||||
source <(gh completion -s zsh)
|
@ -1,2 +0,0 @@
|
||||
#compdef cargo
|
||||
source <(rustup compeltions zsh cargo)
|
@ -1,597 +0,0 @@
|
||||
#compdef cmake -value-,CMAKE_GENERATOR,-default-
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2017 Github zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for CMake (http://www.cmake.org).
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Scott M. Kroll <skroll@gmail.com> (initial version)
|
||||
# * Paul Seyfert <pseyfert.mathphys@gmail.com> (handling of --build and updates)
|
||||
# * Norbert Lange <nolange79@gmail.com> (presets, command mode, updates)
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# Notes
|
||||
# -----
|
||||
#
|
||||
# * By default only C and C++ languages are supported for compiler flag
|
||||
# variables. To define your own list of languages:
|
||||
#
|
||||
# cmake_langs=('C' 'C'
|
||||
# 'CXX' 'C++')
|
||||
# zstyle ':completion:*:cmake:*' languages $cmake_langs
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
local context state line curcontext="$curcontext" cmake_args
|
||||
|
||||
local cmake_build_options;cmake_build_options=(
|
||||
'-S[Explicitly specify a source directory]:source directory:_path_files -/'
|
||||
'-B[Explicitly specify a build directory]:build directory:_path_files -/'
|
||||
'-C[Pre-load a script to populate the cache]:initial cache:_files'
|
||||
'*-D-[Create a cmake cache entry]:property:_cmake_define_property'
|
||||
'*-U[Remove matching entries from CMake cache]:globbing expression'
|
||||
'-G[Specify a makefile generator]:generator:_cmake_generators'
|
||||
'-T[Specify toolset name if supported by generator]:toolset name'
|
||||
'-A[Specify platform name if supported by generator]:platform name'
|
||||
|
||||
# Warnings
|
||||
'(-Wdev)-Wno-dev[Suppress/Enable developer warnings]'
|
||||
'(-Wno-dev)-Wdev[Suppress/Enable developer warnings]'
|
||||
'(-Wdeprecated)-Wno-deprecated[Suppress/Enable deprecation warnings]'
|
||||
'(-Wno-deprecated)-Wdeprecated[Suppress/Enable deprecation warnings]'
|
||||
'(-Werror=dev)-Wno-error=dev[Make developer warnings (not) errors]'
|
||||
'(-Wno-error=dev)-Werror=dev[Make developer warnings (not) errors]'
|
||||
'(-Wno-error=deprecated)-Werror=deprecated[Make deprecated macro and function warnings (not) errors]'
|
||||
'(-Werror=deprecated)-Wno-error=deprecated[Make deprecated macro and function warnings (not) errors]'
|
||||
|
||||
'--preset=[Specify a configure preset]:preset:_cmake_presets'
|
||||
'--list-presets[List available presets]'
|
||||
|
||||
'-E[CMake command mode]:command:_cmake_command_help'
|
||||
|
||||
'-L-[List cache variables]::_values "options" "[non-advanced cache variables]" "A[advanced cache variables]" "H[non-advanced cached variables with help]" "AH[advanced cache variables with help]"'
|
||||
|
||||
'--build[Build a CMake-generated project binary tree]:project directory:_path_files -/'
|
||||
'--install[Install a CMake-generated project binary tree]:project directory:_path_files -/'
|
||||
'--open[Open generated project in the associated application]:project directory:_path_files -/'
|
||||
|
||||
'-N[View mode only]'
|
||||
'-P[Process script mode]:script:_files'
|
||||
|
||||
'--find-package[Legacy pkg-config like mode. Do not use]'
|
||||
|
||||
'--graphviz=[Generate graphviz of dependencies, see CMakeGraphVizOptions.cmake for more]:graphviz output:_files'
|
||||
'--system-information[Dump information about this system]::system information output:_files'
|
||||
|
||||
'--log-level=[Set the verbosity of messages from CMake files]:log level:(ERROR WARNING NOTICE STATUS VERBOSE DEBUG TRACE)'
|
||||
'--log-context[Prepend log messages with context, if given]'
|
||||
|
||||
'--debug-trycompile[Do not delete the try_compile build tree. Only useful on one try_compile at a time]'
|
||||
'--debug-output[Put cmake in a debug mode]'
|
||||
'--debug-find[Put cmake find in a debug mode]'
|
||||
|
||||
'(--trace-expand)--trace[Put cmake in trace mode]'
|
||||
'(--trace)--trace-expand[Put cmake in trace mode with variable expansion]'
|
||||
'--trace-format=[Set the output format of the trace]:trace format:(human json-v1)'
|
||||
'*--trace-source[Trace only this CMake file/module. Multiple options allowed]:filename:_files'
|
||||
'--trace-redirect[Redirect trace output to a file instead of stderr]:trace output:_files'
|
||||
|
||||
'--warn-uninitialized[Warn about uninitialized values]'
|
||||
'--no-warn-unused-cli[Do not warn about command line options]'
|
||||
'--warn-unused-vars[Warn about unused variables]'
|
||||
'--check-system-vars[Find problems with variable usage in system files]'
|
||||
|
||||
'--profiling-format[Output data for profiling CMake scripts]:profiling format:(google-trace)'
|
||||
'--profiling-output[Select an output path for the profiling data]:filename:_files'
|
||||
|
||||
':cmake project:_path_files -/'
|
||||
)
|
||||
|
||||
# ------------------------
|
||||
# _cmake_generator_options
|
||||
#
|
||||
# arguments are $1: build working directory (top level Makefile or build.ninja file)
|
||||
# $2: position of "--" in the command line
|
||||
# ------------------------
|
||||
(( $+functions[_cmake_generator_options] )) ||
|
||||
_cmake_generator_options() {
|
||||
# pass only the part of the command line starting at "--" to the completion
|
||||
shift (( $2 - 1 )) words
|
||||
(( CURRENT = $CURRENT + 1 - $2 ))
|
||||
if [ -f $1/Makefile ]
|
||||
then
|
||||
$_comps[make]
|
||||
elif [ -f $1/build.ninja ]
|
||||
then
|
||||
$_comps[ninja]
|
||||
fi
|
||||
}
|
||||
|
||||
# --------------
|
||||
# _cmake_presets
|
||||
# --------------
|
||||
(( $+functions[_cmake_presets] )) ||
|
||||
_cmake_presets() {
|
||||
local invoke; invoke=(${words[@]})
|
||||
# TODO: remove all arguments -* except -S
|
||||
invoke[$CURRENT]=--list-presets
|
||||
|
||||
# TODO: Problems with quotes need eval
|
||||
# would need a way to exec the array
|
||||
local list_presets; list_presets=(${(f)"$(eval "${invoke[@]} 2> /dev/null" | sed -n 's,^[[:space:]]*"\([^"]*\)"[[:space:]]*-[[:space:]]*\(.*\),\1:\2,p' )"})
|
||||
|
||||
_describe 'presets' list_presets
|
||||
}
|
||||
|
||||
# --------------
|
||||
# _cmake_targets
|
||||
# --------------
|
||||
(( $+functions[_cmake_targets] )) ||
|
||||
_cmake_targets() {
|
||||
local -a targets
|
||||
if [ -f $1/Makefile ]
|
||||
then
|
||||
# `make help` doesn't work for Makefiles in general, but for CMake generated Makefiles it does.
|
||||
i=1
|
||||
for target in $(make -f $1/Makefile help | \grep -e "\.\.\." | sed "s/\.\.\. //" | sed "s/ (the default.*//") ; do
|
||||
targets[$i]=$target
|
||||
(( i = $i + 1 ))
|
||||
done
|
||||
elif [ -f $1/build.ninja ]
|
||||
then
|
||||
# `ninja help` doesn't seem to be the list of targets we're interested in
|
||||
i=1
|
||||
for target in $(ninja -C $1 -t targets all 2&>/dev/null | awk -F: '{print $1}') ; do
|
||||
targets[$i]="$target"
|
||||
(( i++ ))
|
||||
done
|
||||
fi
|
||||
_describe 'build targets' targets
|
||||
}
|
||||
|
||||
_cmake_suggest_builddirs() {
|
||||
_alternative ':current directory:(.)' 'directory::_directories' && return 0
|
||||
}
|
||||
|
||||
_cmake_suggest_installdirs() {
|
||||
_alternative ':current directory:(.)' 'directory::_directories' && return 0
|
||||
}
|
||||
|
||||
_cmake_on_build() {
|
||||
local build_extras;build_extras=(
|
||||
'--[Native build tool options]'
|
||||
'--target[specify build target]'
|
||||
'--clean-first[build target clean first]'
|
||||
'--config[For multi-configuration tools]'
|
||||
'--parallel[maximum number of build processes]'
|
||||
'--use-stderr')
|
||||
local -a undescribed_build_extras
|
||||
i=1
|
||||
for be in $build_extras ; do
|
||||
undescribed_build_extras[$i]=$(echo $be | sed "s/\[.*//")
|
||||
(( i++ ))
|
||||
done
|
||||
inbuild=false
|
||||
dashdashposition=-1
|
||||
for ((i = (($CURRENT - 1)); i > 1 ; i--)); do
|
||||
if [[ $words[$i] == --build ]] ; then
|
||||
inbuild=true
|
||||
buildat=$i
|
||||
(( difference = $CURRENT - $i ))
|
||||
elif [[ $words[$i] == -- ]] ; then
|
||||
dashdashposition=$i
|
||||
fi
|
||||
done
|
||||
# check if build mode has been left
|
||||
outofbuild=false
|
||||
for ((i = (($CURRENT - 1)); i > (($buildat + 1)); i--)); do
|
||||
# don't check the word after --build (should be a directory)
|
||||
if [[ ${undescribed_build_extras[(r)$words[$i]]} == $words[$i] ]] ; then continue ; fi
|
||||
if [[ $words[(($i - 1))] == --target ]] ; then continue ; fi
|
||||
if [[ $words[(($i - 1))] == --config ]] ; then continue ; fi
|
||||
if [[ $words[(($i - 1))] == --parallel ]] ; then continue ; fi
|
||||
outofbuild=true
|
||||
done
|
||||
if (( $dashdashposition > 0 )) ; then
|
||||
_cmake_generator_options $words[(($buildat + 1))] $dashdashposition && return 0
|
||||
fi
|
||||
if [[ "$inbuild" == false || "$difference" -eq 1 ]] ; then
|
||||
# either there is no --build or completing the directory after --build
|
||||
_arguments -C -s \
|
||||
- build_opts \
|
||||
"$cmake_build_options[@]" \
|
||||
- build_cmds \
|
||||
"$cmake_suggest_build[@]" && return 0
|
||||
elif [[ $words[(($CURRENT - 1))] == --target ]] ; then
|
||||
# after --build <dir> --target, suggest targets
|
||||
_cmake_targets $words[(($buildat + 1))] && return 0
|
||||
elif [[ $words[(($CURRENT - 1))] == --config ]] ; then
|
||||
# after --build <dir> --config, no idea
|
||||
return 0
|
||||
elif [[ $words[(($CURRENT - 1))] == --parallel ]] ; then
|
||||
# after --build <dir> --parallel
|
||||
return 0
|
||||
elif [ "$outofbuild" = true ] ; then
|
||||
# after --build <dir> --<not a --build option>, suggest other cmake_build_options (like -Wno-dev)
|
||||
_arguments "$cmake_build_options[@]" && return 0
|
||||
else
|
||||
# after --build <dir>, suggest other cmake_build_options (like -Wno-dev) or --build options (like --clean-first)
|
||||
_arguments "$build_extras[@]" "$cmake_build_options[@]" && return 0
|
||||
fi
|
||||
}
|
||||
|
||||
_cmake_on_install() {
|
||||
local build_extras;build_extras=(
|
||||
'--[Native build tool options]'
|
||||
'--prefix[Override the installation prefix, CMAKE_INSTALL_PREFIX]'
|
||||
'--config[For multi-configuration generators(e.g. Visual Studio)]'
|
||||
'--component[Component-based install]'
|
||||
'--strip[Strip before installing.]'
|
||||
)
|
||||
local -a undescribed_build_extras
|
||||
i=1
|
||||
for be in $build_extras ; do
|
||||
undescribed_build_extras[$i]=$(echo $be | sed "s/\[.*//")
|
||||
(( i++ ))
|
||||
done
|
||||
inbuild=false
|
||||
dashdashposition=-1
|
||||
for ((i = (($CURRENT - 1)); i > 1 ; i--)); do
|
||||
if [[ $words[$i] == --install ]] ; then
|
||||
inbuild=true
|
||||
buildat=$i
|
||||
(( difference = $CURRENT - $i ))
|
||||
elif [[ $words[$i] == -- ]] ; then
|
||||
dashdashposition=$i
|
||||
fi
|
||||
done
|
||||
outofbuild=false
|
||||
for ((i = (($CURRENT - 1)); i > (($buildat + 1)); i--)); do
|
||||
# don't check the word after --install (should be a directory)
|
||||
if [[ ${undescribed_build_extras[(r)$words[$i]]} == $words[$i] ]] ; then continue ; fi
|
||||
if [[ $words[(($i - 1))] == --prefix ]] ; then continue ; fi
|
||||
if [[ $words[(($i - 1))] == --config ]] ; then continue ; fi
|
||||
if [[ $words[(($i - 1))] == --component ]] ; then continue ; fi
|
||||
outofbuild=true
|
||||
done
|
||||
if (( $dashdashposition > 0 )) ; then
|
||||
_cmake_generator_options $words[(($buildat + 1))] $dashdashposition && return 0
|
||||
fi
|
||||
if [[ "$inbuild" == false || "$difference" -eq 1 ]] ; then
|
||||
# either there is no --install or completing the directory after --install
|
||||
_arguments -C -s \
|
||||
- build_opts \
|
||||
"$cmake_build_options[@]" \
|
||||
- build_cmds \
|
||||
"$cmake_suggest_install[@]" && return 0
|
||||
elif [[ $words[(($CURRENT - 1))] == --prefix ]] ; then
|
||||
# after --install <dir> --prefix, no idea
|
||||
return 0
|
||||
elif [[ $words[(($CURRENT - 1))] == --config ]] ; then
|
||||
# after --install <dir> --config, no idea
|
||||
return 0
|
||||
elif [[ $words[(($CURRENT - 1))] == --component ]] ; then
|
||||
# after --build <dir> --component, no idea
|
||||
return 0
|
||||
elif [ "$outofbuild" = true ] ; then
|
||||
# after --build <dir> --<not a --build option>, suggest other cmake_build_options (like -Wno-dev)
|
||||
_arguments "$cmake_build_options[@]" && return 0
|
||||
else
|
||||
# after --build <dir>, suggest other cmake_build_options (like -Wno-dev) or --build options (like --clean-first)
|
||||
_arguments "$build_extras[@]" "$cmake_build_options[@]" && return 0
|
||||
fi
|
||||
}
|
||||
|
||||
local cmake_help_actions;cmake_help_actions=(
|
||||
'(- 1)'{--help,-help,-usage,-h,-H}'[Print usage information and exit]'
|
||||
'(- 1)'{--version,-version}'[Print version number and exit]'
|
||||
'(- 1)--help-full[Print all help manuals and exit]'
|
||||
'(- 1)--help-manual[Print one help manual and exit]:module-name: _cmake_list_names --help-manual-list "manual name"'
|
||||
'(- 1)--help-manual-list[List help manuals available and exit]'
|
||||
'(- 1)--help-command[Print help for one command and exit]:command-name: _cmake_list_names --help-command-list "command name"'
|
||||
'(- 1)--help-command-list[List commands with help available and exit]'
|
||||
'(- 1)--help-commands[Print cmake-commands manual and exit]'
|
||||
'(- 1)--help-module[Print help for one module and exit]:module-name: _cmake_list_names --help-module-list "module name"'
|
||||
'(- 1)--help-module-list[List modules with help available and exit]'
|
||||
'(- 1)--help-modules[Print cmake-modules manual and exit]'
|
||||
'(- 1)--help-policy[Print help for one policy and exit]:policy-name: _cmake_list_names --help-policy-list "policy name"'
|
||||
'(- 1)--help-policy-list[List policies with help available and exit]'
|
||||
'(- 1)--help-policies[Print cmake-policies manual and exit]'
|
||||
'(- 1)--help-property[Print help for one property and exit]:property-name: _cmake_list_names --help-property-list "property name" brakremove'
|
||||
'(- 1)--help-property-list[List properties with help available and exit]'
|
||||
'(- 1)--help-properties[Print cmake-properties manual and exit]'
|
||||
'(- 1)--help-variable[Print help for one variable and exit]:variable-name: _cmake_list_names --help-variable-list "variable name" brakremove'
|
||||
'(- 1)--help-variable-list[List variables with help available and exit]'
|
||||
'(- 1)--help-variables[Print cmake-variables manual and exit]'
|
||||
)
|
||||
_cmake_help() {
|
||||
_arguments -C -s - help "$cmake_help_actions[@]"
|
||||
}
|
||||
|
||||
# -----------------
|
||||
# _cmake_list_names
|
||||
# -----------------
|
||||
(( $+functions[_cmake_list_names] )) ||
|
||||
_cmake_list_names() {
|
||||
local command; command="$@[1]"
|
||||
local desc; desc="$@[2]"
|
||||
local opts; opts=($@[3])
|
||||
local list_names; list_names=(${(f)"$($service $command 2> /dev/null)"})
|
||||
# Older CMake (< 3.0) writes out the version
|
||||
list_names=(${^list_names##cmake version*})
|
||||
|
||||
if [[ ${opts[(i)brakremove]} -le ${#opts} ]]; then
|
||||
list_names=(${^list_names//\[/\\\[})
|
||||
list_names=(${^list_names//\]/\\\]})
|
||||
fi
|
||||
|
||||
_values ${desc} ${list_names[@]:-1} && return 0
|
||||
}
|
||||
|
||||
# ----------------------
|
||||
# _cmake_define_property
|
||||
# ----------------------
|
||||
(( $+functions[_cmake_define_property] )) ||
|
||||
_cmake_define_property() {
|
||||
if compset -P '*='; then
|
||||
_wanted property-values expl 'property value' _cmake_define_property_values ${${IPREFIX%=}#-D} && return 0
|
||||
else
|
||||
_wanted property-names expl 'property name' _cmake_define_property_names -qS= && return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------
|
||||
# _cmake_define_property_names
|
||||
# ----------------------------
|
||||
(( $+functions[_cmake_define_property_names] )) ||
|
||||
_cmake_define_property_names() {
|
||||
local alternatives; alternatives=(
|
||||
'common-property-names:common property name:_cmake_define_common_property_names -qS='
|
||||
)
|
||||
local -A cmake_langs
|
||||
zstyle -a ":completion:${curcontext}:" languages cmake_langs
|
||||
[[ $#cmake_langs -eq 0 ]] && cmake_langs=('C' 'C' 'CXX' 'C++')
|
||||
|
||||
for cmake_lang in ${(k)cmake_langs}; do
|
||||
cmake_lang_desc="${cmake_langs[$cmake_lang]}"
|
||||
alternatives+=("${cmake_lang//:/-}-property-names:${cmake_lang_desc} language property name:_cmake_define_lang_property_names -qS= ${cmake_lang} ${cmake_lang_desc}")
|
||||
done
|
||||
|
||||
_alternative "${alternatives[@]}"
|
||||
}
|
||||
|
||||
# ---------------------------------
|
||||
# _cmake_define_lang_property_names
|
||||
# ---------------------------------
|
||||
(( $+functions[_cmake_define_lang_property_names] )) ||
|
||||
_cmake_define_lang_property_names() {
|
||||
local cmake_lang="$@[-2]" cmake_lang_desc="$@[-1]"
|
||||
local properties; properties=(
|
||||
"CMAKE_${cmake_lang}_COMPILER:${cmake_lang_desc} compiler"
|
||||
"CMAKE_${cmake_lang}_COMPILER_LAUNCHER:${cmake_lang_desc} compiler launcher (e.g. ccache)"
|
||||
"CMAKE_${cmake_lang}_FLAGS:${cmake_lang_desc} compiler flags for all builds"
|
||||
"CMAKE_${cmake_lang}_FLAGS_DEBUG:${cmake_lang_desc} compiler flags for all Debug build"
|
||||
"CMAKE_${cmake_lang}_FLAGS_RELEASE:${cmake_lang_desc} compiler flags for all Release build"
|
||||
"CMAKE_${cmake_lang}_FLAGS_MINSIZREL:${cmake_lang_desc} compiler flags for all MinSizRel build"
|
||||
"CMAKE_${cmake_lang}_FLAGS_RELWITHDEBINFO:${cmake_lang_desc} compiler flags for all RelWithDebInfo build"
|
||||
"CMAKE_${cmake_lang}_STANDARD:${cmake_lang_desc} language standard"
|
||||
"CMAKE_${cmake_lang}_STANDARD_REQUIRED:${cmake_lang_desc} language standard is required"
|
||||
"CMAKE_${cmake_lang}_EXTENSIONS:${cmake_lang_desc} enable compiler specific extensions"
|
||||
)
|
||||
|
||||
_describe -t "${cmake_lang//:/-}-property-names" "${cmake_lang_desc} property name" properties $@[0,-3] && return 0
|
||||
}
|
||||
|
||||
# -----------------------------------
|
||||
# _cmake_define_common_property_names
|
||||
# -----------------------------------
|
||||
(( $+functions[_cmake_define_common_property_names] )) ||
|
||||
_cmake_define_common_property_names() {
|
||||
local properties; properties=(
|
||||
'CMAKE_MODULE_PATH:Search path for CMake modules (FindPROJECT.cmake)'
|
||||
'CMAKE_PREFIX_PATH:Search path for installations (PROJECTConfig.cmake)'
|
||||
'CMAKE_BUILD_TYPE:Specifies the build type for make based generators'
|
||||
'CMAKE_TOOLCHAIN_FILE:Absolute or relative path to a CMake script which sets up toolchain related variables'
|
||||
'CMAKE_COLOR_MAKEFILE:Enables/disables color output when using the Makefile generator'
|
||||
'CMAKE_INSTALL_PREFIX:Install directory used by install'
|
||||
'CMAKE_EXPORT_COMPILE_COMMANDS:Enable/disable output of compilation database during generation'
|
||||
'CMAKE_RULE_MESSAGES:Specify whether to report a message for each make rule'
|
||||
'CMAKE_VERBOSE_MAKEFILE:Enable verbose output from Makefile builds'
|
||||
'CMAKE_UNITY_BUILD:Batch include source files'
|
||||
)
|
||||
|
||||
_describe -t 'common-property-names' 'common property name' properties $@
|
||||
}
|
||||
|
||||
local _cmake_build_types=('Debug' 'Release' 'RelWithDebInfo' 'MinSizeRel')
|
||||
local _cmake_c_standards=(90 99 11)
|
||||
local _cmake_cxx_standards=(98 11 14 17 20)
|
||||
|
||||
# ----------------------------
|
||||
# _cmake_define_property_values
|
||||
# ----------------------------
|
||||
(( $+functions[_cmake_define_property_values] )) ||
|
||||
_cmake_define_property_values() {
|
||||
local ret=1
|
||||
setopt localoptions extendedglob
|
||||
case $@[-1] in
|
||||
(CMAKE_BUILD_TYPE) _wanted build-types expl 'build type' _values 'build type' ${_cmake_build_types[@]} && ret=0;;
|
||||
(CMAKE_CXX_STANDARD) _wanted cxx-standards expl 'cxx standard' _values 'cxx standard' ${_cmake_cxx_standards[@]} && ret=0;;
|
||||
(CMAKE_C_STANDARD) _wanted c-standards expl 'c standard' _values 'c standard' ${_cmake_c_standards[@]} && ret=0;;
|
||||
(CMAKE_TOOLCHAIN_FILE) _wanted toolchain-files expl 'file' _cmake_toolchain_files && ret=0;;
|
||||
(CMAKE_COLOR_MAKEFILE) _wanted booleans expl 'boolean' ${_cmake_booleans[@]} && ret=0;;
|
||||
(CMAKE_RULE_MESSAGES) _wanted booleans expl 'boolean' ${_cmake_booleans[@]} && ret=0;;
|
||||
(CMAKE_VERBOSE_MAKEFILE) _wanted booleans expl 'boolean' ${_cmake_booleans[@]} && ret=0;;
|
||||
(CMAKE_UNITY_BUILD) _wanted booleans expl 'boolean' ${_cmake_booleans[@]} && ret=0;;
|
||||
(CMAKE_INSTALL_PREFIX) _files -/ && ret=0;;
|
||||
(CMAKE_EXPORT_COMPILE_COMMANDS) _wanted booleans expl 'boolean' ${_cmake_booleans[@]} && ret=0;;
|
||||
(CMAKE_*_COMPILER) _wanted compilers expl 'compiler' _cmake_compilers && ret=0;;
|
||||
(CMAKE_*_COMPILER_LAUNCHER) _wanted compilers expl 'compiler launcher' _cmake_launchers && ret=0;;
|
||||
(CMAKE_*_FLAGS(|_?*)) _message -e compiler-flags 'compiler flags' && _dispatch $service -value-,CPPFLAGS,-default- && ret=0;;
|
||||
(CMAKE_*_STANDARD_REQUIRED) _wanted booleans expl 'boolean' ${_cmake_booleans[@]} && ret=0;;
|
||||
(CMAKE_*_EXTENSIONS) _wanted booleans expl 'boolean' ${_cmake_booleans[@]} && ret=0;;
|
||||
(*) _files && ret=0;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
local _cmake_generator_list
|
||||
_cmake_generator_list=(
|
||||
'Green Hills MULTI'
|
||||
'Unix Makefiles'
|
||||
'Ninja'
|
||||
'Ninja Multi-Config'
|
||||
'CodeBlocks - Ninja'
|
||||
'CodeBlocks - Unix Makefiles'
|
||||
'CodeLite - Ninja'
|
||||
'CodeLite - Unix Makefiles'
|
||||
'Eclipse CDT4 - Ninja'
|
||||
'Eclipse CDT4 - Unix Makefiles'
|
||||
'Kate - Ninja'
|
||||
'Kate - Unix Makefiless'
|
||||
'Sublime Text 2 - Ninja'
|
||||
'Sublime Text 2 - Unix Makefiles'
|
||||
)
|
||||
|
||||
# -----------------
|
||||
# _cmake_generators
|
||||
# -----------------
|
||||
(( $+functions[_cmake_generators] )) ||
|
||||
_cmake_generators() {
|
||||
_describe -t generators 'generator' _cmake_generator_list
|
||||
}
|
||||
|
||||
# ----------------------
|
||||
# _cmake_toolchain_files
|
||||
# ----------------------
|
||||
(( $+functions[_cmake_toolchain_files] )) ||
|
||||
_cmake_toolchain_files() {
|
||||
_files -g '*\.cmake*'
|
||||
}
|
||||
|
||||
|
||||
local _cmake_booleans=(_describe -t booleans 'boolean' 'YES' 'NO')
|
||||
|
||||
# ---------------
|
||||
# _cmake_compilers
|
||||
#
|
||||
# by default just executable commands, but can be overridden by users.
|
||||
# ---------------
|
||||
(( $+functions[_cmake_compilers] )) ||
|
||||
_cmake_compilers() {
|
||||
_command_names -e
|
||||
}
|
||||
|
||||
# ---------------
|
||||
# _cmake_launchers
|
||||
#
|
||||
# by default just executable commands, but can be overridden by users.
|
||||
# useful commands might be ccache, distcc, ...
|
||||
# ---------------
|
||||
(( $+functions[_cmake_launchers] )) ||
|
||||
_cmake_launchers() {
|
||||
_command_names -e
|
||||
}
|
||||
|
||||
local _cmake_commands=(
|
||||
'capabilities:Report capabilities built into cmake in JSON format' \
|
||||
'cat:concat the files and print them to the standard output' \
|
||||
'chdir:run command in a given directory' \
|
||||
'compare_files:check if file1 is same as file2' \
|
||||
'copy:copy files to destination (either file or directory)' \
|
||||
'copy_directory:copy content of <dir>... directories to destination directory' \
|
||||
'copy_if_different:copy files if it has changed' \
|
||||
'echo:displays arguments as text' \
|
||||
'echo_append:displays arguments as text but no new line' \
|
||||
'env:run command in a modified environment' \
|
||||
'environment:display the current environment' \
|
||||
'make_directory:create parent and <dir> directories' \
|
||||
'md5sum:create MD5 checksum of files' \
|
||||
'sha1sum:create SHA1 checksum of files' \
|
||||
'sha224sum:create SHA224 checksum of files' \
|
||||
'sha256sum:create SHA256 checksum of files' \
|
||||
'sha384sum:create SHA384 checksum of files' \
|
||||
'sha512sum:create SHA512 checksum of files' \
|
||||
'remove:remove the file(s), use -f to force it' \
|
||||
'remove_directory:remove directories and their contents' \
|
||||
'rename:rename a file or directory (on one volume)' \
|
||||
'rm:remove files or directories' \
|
||||
'server:start cmake in server mode' \
|
||||
'sleep:sleep for given number of seconds' \
|
||||
'tar:create or extract a tar or zip archive' \
|
||||
'time:run command and display elapsed time' \
|
||||
'touch:touch a <file>' \
|
||||
'touch_nocreate:touch a <file> but do not create it' \
|
||||
'create_symlink:create a symbolic link new -> old' \
|
||||
'create_hardlink:create a hard link new -> old' \
|
||||
'true:do nothing with an exit code of 0' \
|
||||
'false:do nothing with an exit code of 1'
|
||||
)
|
||||
_cmake_command() {
|
||||
_arguments -C \
|
||||
'-E[CMake command mode]:command:(("${_cmake_commands[@]}"))'
|
||||
|
||||
}
|
||||
local cmake_suggest_build;cmake_suggest_build=(
|
||||
'--build[build]:build dir:_cmake_suggest_builddirs'
|
||||
)
|
||||
|
||||
local cmake_suggest_install;cmake_suggest_install=(
|
||||
'--install[install]:install dir:_cmake_suggest_installdirs'
|
||||
)
|
||||
|
||||
if [[ "$service" = -value-*CMAKE_GENERATOR* ]]; then
|
||||
_cmake_generators
|
||||
elif [ $CURRENT -eq 2 ] ; then
|
||||
_arguments -C -s \
|
||||
- help \
|
||||
"$cmake_help_actions[@]" \
|
||||
- command \
|
||||
'-E[CMake command mode]:command:( )' \
|
||||
- build_opts \
|
||||
"$cmake_build_options[@]" \
|
||||
- build_cmds \
|
||||
"$cmake_suggest_build[@]" \
|
||||
- install_cmds \
|
||||
"$cmake_suggest_install[@]" && return 0
|
||||
elif [[ $words[2] = --help* ]] ; then
|
||||
_cmake_help
|
||||
elif [[ $words[2] == --build ]] ; then
|
||||
_cmake_on_build
|
||||
elif [[ $words[2] == --install ]] ; then
|
||||
_cmake_on_install
|
||||
elif [[ $words[2] == -E ]]; then
|
||||
_cmake_command
|
||||
else
|
||||
_arguments "$cmake_build_options[@]"
|
||||
fi
|
@ -1,257 +0,0 @@
|
||||
#compdef curl
|
||||
|
||||
# curl zsh completion
|
||||
|
||||
local curcontext="$curcontext" state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
local rc=1
|
||||
|
||||
_arguments -C -S \
|
||||
--aws-sigv4'[Use AWS V4 signature authentication]':'<provider1[\:provider2[\:region[\:service]]]>' \
|
||||
{-c,--cookie-jar}'[Write cookies to <filename> after operation]':'<filename>':_files \
|
||||
--resolve'[Resolve the host+port to this address]':'<[+]host\:port\:addr[,addr]...>' \
|
||||
{-D,--dump-header}'[Write the received headers to <filename>]':'<filename>':_files \
|
||||
{-y,--speed-time}'[Trigger '\''speed-limit'\'' abort after this time]':'<seconds>' \
|
||||
--proxy-cacert'[CA certificate to verify peer against for proxy]':'<file>':_files \
|
||||
--happy-eyeballs-timeout-ms'[Time for IPv6 before trying IPv4]':'<milliseconds>' \
|
||||
--proxy-ssl-auto-client-cert'[Use auto client certificate for proxy (Schannel)]' \
|
||||
{-E,--cert}'[Client certificate file and password]':'<certificate[\:password]>' \
|
||||
--connect-timeout'[Maximum time allowed for connection]':'<fractional seconds>' \
|
||||
--etag-save'[Parse ETag from a request and save it to a file]':'<file>':_files \
|
||||
--libcurl'[Dump libcurl equivalent code of this command line]':'<file>':_files \
|
||||
--proxy-capath'[CA directory to verify peer against for proxy]':'<dir>':_files \
|
||||
--proxy-pinnedpubkey'[FILE/HASHES public key to verify proxy with]':'<hashes>' \
|
||||
--doh-cert-status'[Verify the status of the DoH server cert via OCSP-staple]' \
|
||||
--etag-compare'[Pass an ETag from a file as a custom header]':'<file>':_files \
|
||||
--curves'[(EC) TLS key exchange algorithm(s) to request]':'<algorithm list>' \
|
||||
--proxy-negotiate'[Use HTTP Negotiate (SPNEGO) authentication on the proxy]' \
|
||||
--hostpubsha256'[Acceptable SHA256 hash of the host public key]':'<sha256>' \
|
||||
--mail-rcpt-allowfails'[Allow RCPT TO command to fail for some recipients]' \
|
||||
{-m,--max-time}'[Maximum time allowed for transfer]':'<fractional seconds>' \
|
||||
--socks5-hostname'[SOCKS5 proxy, pass host name to proxy]':'<host[\:port]>' \
|
||||
--abstract-unix-socket'[Connect via abstract Unix domain socket]':'<path>' \
|
||||
--pinnedpubkey'[FILE/HASHES Public key to verify peer against]':'<hashes>' \
|
||||
--proxy-insecure'[Do HTTPS proxy connections without verifying the proxy]' \
|
||||
--proxy-pass'[Pass phrase for the private key for HTTPS proxy]':'<phrase>' \
|
||||
--proxy-ssl-allow-beast'[Allow security flaw for interop for HTTPS proxy]' \
|
||||
{-p,--proxytunnel}'[Operate through an HTTP proxy tunnel (using CONNECT)]' \
|
||||
--proto-default'[Use PROTOCOL for any URL missing a scheme]':'<protocol>' \
|
||||
--proxy-tls13-ciphers'[TLS 1.3 proxy cipher suites]':'<ciphersuite list>' \
|
||||
--socks5-gssapi-service'[SOCKS5 proxy service name for GSS-API]':'<name>' \
|
||||
--ftp-alternative-to-user'[String to replace USER \[name\]]':'<command>' \
|
||||
{-T,--upload-file}'[Transfer local FILE to destination]':'<file>':_files \
|
||||
--form-escape'[Escape multipart form field/file names using backslash]' \
|
||||
--local-port'[Force use of RANGE for local port numbers]':'<num/range>' \
|
||||
--proxy-tlsauthtype'[TLS authentication type for HTTPS proxy]':'<type>' \
|
||||
{-R,--remote-time}'[Set the remote file'\''s time on the local output]' \
|
||||
--ssl-revoke-best-effort'[Ignore missing/offline cert CRL dist points]' \
|
||||
--ftp-ssl-control'[Require SSL/TLS for FTP login, clear for transfer]' \
|
||||
--parallel-immediate'[Do not wait for multiplexing (with --parallel)]' \
|
||||
--cert-status'[Verify the status of the server cert via OCSP-staple]' \
|
||||
--proxy-cert-type'[Client certificate type for HTTPS proxy]':'<type>' \
|
||||
{-Q,--quote}'[Send command(s) to server before transfer]':'<command>' \
|
||||
{-O,--remote-name}'[Write output to a file named as the remote file]' \
|
||||
--retry-connrefused'[Retry on connection refused (use with --retry)]' \
|
||||
--sasl-authzid'[Identity for SASL PLAIN authentication]':'<identity>' \
|
||||
--suppress-connect-headers'[Suppress proxy CONNECT response headers]' \
|
||||
--trace-ascii'[Like --trace, but without hex output]':'<file>':_files \
|
||||
--expect100-timeout'[How long to wait for 100-continue]':'<seconds>' \
|
||||
{-g,--globoff}'[Disable URL sequences and ranges using {} and \[\]]' \
|
||||
{-j,--junk-session-cookies}'[Ignore session cookies read from file]' \
|
||||
--parallel-max'[Maximum concurrency for parallel transfers]':'<num>' \
|
||||
--tls13-ciphers'[TLS 1.3 cipher suites to use]':'<ciphersuite list>' \
|
||||
--dns-ipv4-addr'[IPv4 address to use for DNS requests]':'<address>' \
|
||||
--dns-ipv6-addr'[IPv6 address to use for DNS requests]':'<address>' \
|
||||
--location-trusted'[Like --location, and send auth to other hosts]' \
|
||||
--mail-auth'[Originator address of the original email]':'<address>' \
|
||||
--noproxy'[List of hosts which do not use proxy]':'<no-proxy-list>' \
|
||||
--proto-redir'[Enable/disable PROTOCOLS on redirect]':'<protocols>' \
|
||||
--proxy-cert'[Set client certificate for proxy]':'<cert[\:passwd]>' \
|
||||
--dns-interface'[Interface to use for DNS requests]':'<interface>' \
|
||||
--hostpubmd5'[Acceptable MD5 hash of the host public key]':'<md5>' \
|
||||
--keepalive-time'[Interval time for keepalive probes]':'<seconds>' \
|
||||
--random-file'[File for reading random data from]':'<file>':_files \
|
||||
--socks5-basic'[Enable username/password auth for SOCKS5 proxies]' \
|
||||
--cacert'[CA certificate to verify peer against]':'<file>':_files \
|
||||
{-H,--header}'[Pass custom header(s) to server]':'<header/@file>' \
|
||||
--ignore-content-length'[Ignore the size of the remote resource]' \
|
||||
{-i,--include}'[Include protocol response headers in the output]' \
|
||||
--preproxy'[\[protocol\://\]host\[\:port\] Use this proxy first]' \
|
||||
--proxy-header'[Pass custom header(s) to proxy]':'<header/@file>' \
|
||||
--unix-socket'[Connect through this Unix domain socket]':'<path>' \
|
||||
{-w,--write-out}'[Use output FORMAT after completion]':'<format>' \
|
||||
{-b,--cookie}'[Send cookies from string/file]':'<data|filename>' \
|
||||
{-o,--output}'[Write to file instead of stdout]':'<file>':_files \
|
||||
--request-target'[Specify the target for this request]':'<path>' \
|
||||
--socks4a'[SOCKS4a proxy on given host + port]':'<host[\:port]>' \
|
||||
--ssl-auto-client-cert'[Use auto client certificate (Schannel)]' \
|
||||
{-U,--proxy-user}'[Proxy user and password]':'<user\:password>' \
|
||||
--proxy1.0'[Use HTTP/1.0 proxy on given port]':'<host[\:port]>' \
|
||||
{-Y,--speed-limit}'[Stop transfers slower than this]':'<speed>' \
|
||||
{-z,--time-cond}'[Transfer based on a time condition]':'<time>' \
|
||||
--alt-svc'[Enable alt-svc with this cache file]':'<file name>' \
|
||||
--capath'[CA directory to verify peer against]':'<dir>':_files \
|
||||
--connect-to'[Connect to host]':'<HOST1\:PORT1\:HOST2\:PORT2>' \
|
||||
{-f,--fail}'[Fail silently (no output at all) on HTTP errors]' \
|
||||
--http2-prior-knowledge'[Use HTTP 2 without HTTP/1.1 Upgrade]' \
|
||||
--proxy-tlspassword'[TLS password for HTTPS proxy]':'<string>' \
|
||||
{-r,--range}'[Retrieve only the bytes within RANGE]':'<range>' \
|
||||
--socks4'[SOCKS4 proxy on given host + port]':'<host[\:port]>' \
|
||||
--socks5'[SOCKS5 proxy on given host + port]':'<host[\:port]>' \
|
||||
{-A,--user-agent}'[Send User-Agent <name> to server]':'<name>' \
|
||||
--egd-file'[EGD socket path for random data]':'<file>':_files \
|
||||
--fail-early'[Fail on first transfer error, do not continue]' \
|
||||
{-x,--proxy}'[\[protocol\://\]host\[\:port\] Use this proxy]' \
|
||||
{-J,--remote-header-name}'[Use the header-provided filename]' \
|
||||
--retry-max-time'[Retry only within this period]':'<seconds>' \
|
||||
{-:,--next}'[Make next URL use its separate set of options]' \
|
||||
--proxy-key-type'[Private key file type for proxy]':'<type>' \
|
||||
--retry'[Retry request if transient problems occur]':'<num>' \
|
||||
--ssl-no-revoke'[Disable cert revocation checks (Schannel)]' \
|
||||
--create-dirs'[Create necessary local directory hierarchy]' \
|
||||
--haproxy-protocol'[Send HAProxy PROXY protocol v1 header]' \
|
||||
--max-redirs'[Maximum number of redirects allowed]':'<num>' \
|
||||
{-n,--netrc}'[Must read .netrc for user name and password]' \
|
||||
--proxy-crlfile'[Set a CRL list for proxy]':'<file>':_files \
|
||||
--sasl-ir'[Enable initial response in SASL authentication]' \
|
||||
--socks5-gssapi-nec'[Compatibility with NEC SOCKS5 server]' \
|
||||
--ssl-allow-beast'[Allow security flaw to improve interop]' \
|
||||
--create-file-mode'[File mode for created files]':'<mode>' \
|
||||
--ftp-create-dirs'[Create the remote dirs if not present]' \
|
||||
--interface'[Use network INTERFACE (or address)]':'<name>' \
|
||||
--key-type'[Private key file type (DER/PEM/ENG)]':'<type>' \
|
||||
--netrc-file'[Specify FILE for netrc]':'<filename>':_files \
|
||||
{-N,--no-buffer}'[Disable buffering of the output stream]' \
|
||||
--proxy-service-name'[SPNEGO proxy service name]':'<name>' \
|
||||
--remote-name-all'[Use the remote file name for all URLs]' \
|
||||
{-X,--request}'[Specify request method to use]':'<method>' \
|
||||
{-u,--user}'[Server user and password]':'<user\:password>' \
|
||||
--fail-with-body'[Fail on HTTP errors but save the body]' \
|
||||
--max-filesize'[Maximum file size to download]':'<bytes>' \
|
||||
--negotiate'[Use HTTP Negotiate (SPNEGO) authentication]' \
|
||||
--no-keepalive'[Disable TCP keepalive on the connection]' \
|
||||
--output-dir'[Directory to save files in]':'<dir>':_files \
|
||||
{-#,--progress-bar}'[Display transfer progress as a bar]' \
|
||||
--retry-all-errors'[Retry all errors (use with --retry)]' \
|
||||
--socks5-gssapi'[Enable GSS-API auth for SOCKS5 proxies]' \
|
||||
{-K,--config}'[Read config from a file]':'<file>':_files \
|
||||
{-C,--continue-at}'[Resumed transfer offset]':'<offset>' \
|
||||
--data-raw'[HTTP POST data, '\''@'\'' allowed]':'<data>' \
|
||||
--hsts'[Enable HSTS with this cache file]':'<file name>' \
|
||||
--krb'[Enable Kerberos with security <level>]':'<level>' \
|
||||
--proxy-ciphers'[SSL ciphers to use for proxy]':'<list>' \
|
||||
--proxy-digest'[Use Digest authentication on the proxy]' \
|
||||
--proxy-tlsuser'[TLS username for HTTPS proxy]':'<name>' \
|
||||
--styled-output'[Enable styled output for HTTP headers]' \
|
||||
--tls-max'[Set maximum allowed TLS version]':'<VERSION>' \
|
||||
--data-urlencode'[HTTP POST data url encoded]':'<data>' \
|
||||
--delegation'[GSS-API delegation permission]':'<LEVEL>' \
|
||||
--doh-insecure'[Allow insecure DoH server connections]' \
|
||||
{-P,--ftp-port}'[Use PORT instead of PASV]':'<address>' \
|
||||
--post301'[Do not switch to GET after following a 301]' \
|
||||
--post302'[Do not switch to GET after following a 302]' \
|
||||
--post303'[Do not switch to GET after following a 303]' \
|
||||
--proxy-anyauth'[Pick any proxy authentication method]' \
|
||||
--trace-time'[Add time stamps to trace/verbose output]' \
|
||||
--cert-type'[Certificate type (DER/PEM/ENG)]':'<type>' \
|
||||
--disallow-username-in-url'[Disallow username in url]' \
|
||||
--dns-servers'[DNS server addrs to use]':'<addresses>' \
|
||||
{-G,--get}'[Put the post data in the URL and use GET]' \
|
||||
--limit-rate'[Limit transfer speed to RATE]':'<speed>' \
|
||||
--ntlm-wb'[Use HTTP NTLM authentication with winbind]' \
|
||||
--path-as-is'[Do not squash .. sequences in URL path]' \
|
||||
--proxy-basic'[Use Basic authentication on the proxy]' \
|
||||
--retry-delay'[Wait time between retries]':'<seconds>' \
|
||||
--trace'[Write a debug trace to FILE]':'<file>':_files \
|
||||
{-a,--append}'[Append to target file when uploading]' \
|
||||
--ftp-ssl-ccc-mode'[Set CCC mode]':'<active/passive>' \
|
||||
--metalink'[Process given URLs as metalink XML file]' \
|
||||
--no-progress-meter'[Do not show the progress meter]' \
|
||||
--tr-encoding'[Request compressed transfer encoding]' \
|
||||
--xattr'[Store metadata in extended file attributes]' \
|
||||
{-k,--insecure}'[Allow insecure server connections]' \
|
||||
--pass'[Pass phrase for the private key]':'<phrase>' \
|
||||
--proxy-ntlm'[Use NTLM authentication on the proxy]' \
|
||||
{-S,--show-error}'[Show error even when -s is used]' \
|
||||
--stderr'[Where to redirect stderr]':'<file>':_files \
|
||||
--ciphers'[SSL ciphers to use]':'<list of ciphers>' \
|
||||
--form-string'[Specify multipart MIME data]':'<name=string>' \
|
||||
--login-options'[Server login options]':'<options>' \
|
||||
--tftp-blksize'[Set TFTP BLKSIZE option]':'<value>' \
|
||||
{-v,--verbose}'[Make the operation more talkative]' \
|
||||
--ftp-skip-pasv-ip'[Skip the IP address for PASV]' \
|
||||
--proxy-key'[Private key for HTTPS proxy]':'<key>' \
|
||||
{-F,--form}'[Specify multipart MIME data]':'<name=content>' \
|
||||
{-h,--help}'[Get help for commands]':'<category>' \
|
||||
--mail-from'[Mail from this address]':'<address>' \
|
||||
--oauth2-bearer'[OAuth 2 Bearer Token]':'<token>' \
|
||||
--proto'[Enable/disable PROTOCOLS]':'<protocols>' \
|
||||
--tftp-no-options'[Do not send any TFTP options]' \
|
||||
--tlsauthtype'[TLS authentication type]':'<type>' \
|
||||
--doh-url'[Resolve host names over DoH]':'<URL>' \
|
||||
--no-sessionid'[Disable SSL session-ID reusing]' \
|
||||
{-Z,--parallel}'[Perform transfers in parallel]' \
|
||||
--data-binary'[HTTP POST binary data]':'<data>' \
|
||||
--mail-rcpt'[Mail to this address]':'<address>' \
|
||||
{-t,--telnet-option}'[Set telnet option]':'<opt=val>' \
|
||||
--crlfile'[Use this CRL list]':'<file>':_files \
|
||||
--ftp-ssl-ccc'[Send CCC after authenticating]' \
|
||||
{-4,--ipv4}'[Resolve names to IPv4 addresses]' \
|
||||
{-6,--ipv6}'[Resolve names to IPv6 addresses]' \
|
||||
--service-name'[SPNEGO service name]':'<name>' \
|
||||
{-V,--version}'[Show version number and quit]' \
|
||||
--data-ascii'[HTTP POST ASCII data]':'<data>' \
|
||||
--ftp-account'[Account data string]':'<data>' \
|
||||
--disable-eprt'[Inhibit using EPRT or LPRT]' \
|
||||
--ftp-method'[Control CWD usage]':'<method>' \
|
||||
--netrc-optional'[Use either .netrc or URL]' \
|
||||
--pubkey'[SSH Public key file name]':'<key>' \
|
||||
--raw'[Do HTTP "raw"; no transfer decoding]' \
|
||||
--anyauth'[Pick any authentication method]' \
|
||||
--compressed'[Request compressed response]' \
|
||||
--ftp-pasv'[Use PASV/EPSV instead of PORT]' \
|
||||
--no-alpn'[Disable the ALPN TLS extension]' \
|
||||
--tcp-nodelay'[Use the TCP_NODELAY option]' \
|
||||
{-B,--use-ascii}'[Use ASCII/text transfer]' \
|
||||
--compressed-ssh'[Enable SSH compression]' \
|
||||
--digest'[Use HTTP Digest Authentication]' \
|
||||
--proxy-tlsv1'[Use TLSv1 for HTTPS proxy]' \
|
||||
--engine'[Crypto engine to use]':'<name>' \
|
||||
--no-npn'[Disable the NPN TLS extension]' \
|
||||
--basic'[Use HTTP Basic Authentication]' \
|
||||
{-M,--manual}'[Display the full manual]' \
|
||||
--tlspassword'[TLS password]':'<string>' \
|
||||
--false-start'[Enable TLS False Start]' \
|
||||
--crlf'[Convert LF to CRLF in upload]' \
|
||||
{-d,--data}'[HTTP POST data]':'<data>' \
|
||||
{-I,--head}'[Show document info only]' \
|
||||
--key'[Private key file name]':'<key>' \
|
||||
--ntlm'[Use HTTP NTLM authentication]' \
|
||||
{-e,--referer}'[Referrer URL]':'<URL>' \
|
||||
{-1,--tlsv1}'[Use TLSv1.0 or greater]' \
|
||||
--http0.9'[Allow HTTP 0.9 responses]' \
|
||||
--disable-epsv'[Inhibit using EPSV]' \
|
||||
--ftp-pret'[Send PRET before PASV]' \
|
||||
{-L,--location}'[Follow redirects]' \
|
||||
--tcp-fastopen'[Use TCP Fast Open]' \
|
||||
--tlsuser'[TLS user name]':'<name>' \
|
||||
--tlsv1.0'[Use TLSv1.0 or greater]' \
|
||||
--tlsv1.1'[Use TLSv1.1 or greater]' \
|
||||
--tlsv1.2'[Use TLSv1.2 or greater]' \
|
||||
--tlsv1.3'[Use TLSv1.3 or greater]' \
|
||||
{-l,--list-only}'[List only mode]' \
|
||||
{-q,--disable}'[Disable .curlrc]' \
|
||||
--url'[URL to work with]':'<url>' \
|
||||
{-0,--http1.0}'[Use HTTP 1.0]' \
|
||||
--ssl-reqd'[Require SSL/TLS]' \
|
||||
{-s,--silent}'[Silent mode]' \
|
||||
--http1.1'[Use HTTP 1.1]' \
|
||||
{-2,--sslv2}'[Use SSLv2]' \
|
||||
{-3,--sslv3}'[Use SSLv3]' \
|
||||
--http3'[Use HTTP v3]' \
|
||||
--http2'[Use HTTP 2]' \
|
||||
--ssl'[Try SSL/TLS]' \
|
||||
'*:URL:_urls' && rc=0
|
||||
|
||||
return rc
|
@ -1 +0,0 @@
|
||||
compdef _gnu_generic delta
|
@ -1,19 +0,0 @@
|
||||
#compdef dotnet
|
||||
# zsh parameter completion for the dotnet CLI
|
||||
|
||||
_dotnet_zsh_complete()
|
||||
{
|
||||
local completions=("$(dotnet complete "$words")")
|
||||
|
||||
# If the completion list is empty, just continue with filename selection
|
||||
if [ -z "$completions" ]
|
||||
then
|
||||
_arguments '*::arguments: _normal'
|
||||
return
|
||||
fi
|
||||
|
||||
# This is not a variable assignment, don't remove spaces!
|
||||
_values = "${(ps:\n:)completions}"
|
||||
}
|
||||
|
||||
compdef _dotnet_zsh_complete dotnet
|
@ -1,74 +0,0 @@
|
||||
#compdef eza
|
||||
|
||||
# Save this file as _eza in /usr/local/share/zsh/site-functions or in any
|
||||
# other folder in $fpath. E.g. save it in a folder called ~/.zfunc and add a
|
||||
# line containing `fpath=(~/.zfunc $fpath)` somewhere before `compinit` in your
|
||||
# ~/.zshrc.
|
||||
|
||||
__eza() {
|
||||
# Give completions using the `_arguments` utility function with
|
||||
# `-s` for option stacking like `eza -ab` for `eza -a -b` and
|
||||
# `-S` for delimiting options with `--` like in `eza -- -a`.
|
||||
_arguments -s -S \
|
||||
"(- *)"{-v,--version}"[Show version of eza]" \
|
||||
"(- *)"--help"[Show list of command-line options]" \
|
||||
{-1,--oneline}"[Display one entry per line]" \
|
||||
{-l,--long}"[Display extended file metadata as a table]" \
|
||||
{-G,--grid}"[Display entries as a grid]" \
|
||||
{-x,--across}"[Sort the grid across, rather than downwards]" \
|
||||
{-R,--recurse}"[Recurse into directories]" \
|
||||
{-T,--tree}"[Recurse into directories as a tree]" \
|
||||
{-X,--dereference}"[Dereference symbolic links when displaying information]" \
|
||||
{-F,--classify}"[Display type indicator by file names]" \
|
||||
--colo{,u}r="[When to use terminal colours]:(when):(always auto automatic never)" \
|
||||
--colo{,u}r-scale"[highlight levels of 'field' distinctly]:(fields):(all age size)" \
|
||||
--colo{,u}r-scale-mode"[Use gradient or fixed colors in --color-scale]:(mode):(fixed gradient)" \
|
||||
--icons="[When to display icons]:(when):(always auto automatic never)" \
|
||||
--no-quotes"[Don't quote filenames with spaces]" \
|
||||
--hyperlink"[Display entries as hyperlinks]" \
|
||||
--group-directories-first"[Sort directories before other files]" \
|
||||
--git-ignore"[Ignore files mentioned in '.gitignore']" \
|
||||
{-a,--all}"[Show hidden and 'dot' files. Use this twice to also show the '.' and '..' directories]" \
|
||||
{-A,--almost-all}"[Equivalent to --all; included for compatibility with \'ls -A\']" \
|
||||
{-d,--list-dirs}"[List directories like regular files]" \
|
||||
{-D,--only-dirs}"[List only directories]" \
|
||||
{-f,--only-files}"[List only files]" \
|
||||
{-L,--level}"+[Limit the depth of recursion]" \
|
||||
{-w,--width}"+[Limits column output of grid, 0 implies auto-width]" \
|
||||
{-r,--reverse}"[Reverse the sort order]" \
|
||||
{-s,--sort}="[Which field to sort by]:(sort field):(accessed age changed created date extension Extension filename Filename inode modified oldest name Name newest none size time type)" \
|
||||
{-I,--ignore-glob}"[Ignore files that match these glob patterns]" \
|
||||
{-b,--binary}"[List file sizes with binary prefixes]" \
|
||||
{-B,--bytes}"[List file sizes in bytes, without any prefixes]" \
|
||||
--changed"[Use the changed timestamp field]" \
|
||||
{-g,--group}"[List each file's group]" \
|
||||
{-h,--header}"[Add a header row to each column]" \
|
||||
{-H,--links}"[List each file's number of hard links]" \
|
||||
{-i,--inode}"[List each file's inode number]" \
|
||||
{-m,--modified}"[Use the modified timestamp field]" \
|
||||
{-n,--numeric}"[List numeric user and group IDs.]" \
|
||||
{-S,--blocksize}"[List each file's size of allocated file system blocks.]" \
|
||||
{-t,--time}="[Which time field to show]:(time field):(accessed changed created modified)" \
|
||||
--time-style="[How to format timestamps]:(time style):(default iso long-iso full-iso relative)" \
|
||||
--total-size="[Show recursive directory size (unix only)]" \
|
||||
--no-permissions"[Suppress the permissions field]" \
|
||||
{-o,--octal-permissions}"[List each file's permission in octal format]" \
|
||||
--no-filesize"[Suppress the filesize field]" \
|
||||
--no-user"[Suppress the user field]" \
|
||||
--no-time"[Suppress the time field]" \
|
||||
{-u,--accessed}"[Use the accessed timestamp field]" \
|
||||
{-U,--created}"[Use the created timestamp field]" \
|
||||
{-X,--dereference}"[dereference symlinks for file information]" \
|
||||
--git"[List each file's Git status, if tracked]" \
|
||||
--no-git"[Suppress Git status]" \
|
||||
--git-repos"[List each git-repos status and branch name]" \
|
||||
--git-repos-no-status"[List each git-repos branch name (much faster)]" \
|
||||
{-@,--extended}"[List each file's extended attributes and sizes]" \
|
||||
{-Z,--context}"[List each file's security context]" \
|
||||
{-M,--mounts}"[Show mount details (long mode only)]" \
|
||||
'*:filename:_files' \
|
||||
--smart-group"[Only show group if it has a different name from owner]" \
|
||||
--stdin"[When piping to eza. Read file names from stdin]"
|
||||
}
|
||||
|
||||
__eza
|
@ -1,339 +0,0 @@
|
||||
#compdef fail2ban-client
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2020 Github zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for fail2ban-client (https://www.fail2ban.org/).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Felix Neumärker <xdch47@posteo.de>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_f2bc_jails() {
|
||||
LANG=C fail2ban-client status 2> /dev/null | sed -n -e 's/.*Jail list:\s\+//' -e 'T' -e 's/,\s\+/\'$'\n/g' -e 'p'
|
||||
}
|
||||
|
||||
_complete_f2bc_cmds() {
|
||||
local cmds=(
|
||||
'unban:unbans all IP addresses'
|
||||
'set:set property'
|
||||
'get:get property'
|
||||
'status:gets the current status of the server'
|
||||
'reload:reloads the configuration/jails'
|
||||
'restart:restarts the server'
|
||||
'start:starts the server and the jails'
|
||||
'stop:stops all jails and terminate the server'
|
||||
'ping:tests if the server is alive'
|
||||
'flushlogs:flushes the logtarget if a file and reopens it'
|
||||
'help:return this output'
|
||||
'version:return the server version'
|
||||
)
|
||||
|
||||
_describe -V "fail2ban commands" cmds
|
||||
}
|
||||
|
||||
_complete_f2bc_cmdargs() {
|
||||
local f2barg="$words[$NORMARG]"
|
||||
case "$f2barg" in
|
||||
unban)
|
||||
local jail
|
||||
if (( $words[(I)(--all)] == 0 )) ; then
|
||||
for jail in $(_f2bc_jails) ; do
|
||||
_complete_f2bc_ips $jail
|
||||
done
|
||||
local unban_opts=(--all)
|
||||
_describe -o "unban options" unban_opts
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
;;
|
||||
(set|get))
|
||||
if (( $NORMARG + 1 == $CURRENT )) ; then
|
||||
_complete_f2bc_jails
|
||||
_complete_f2bc_settings
|
||||
else
|
||||
_complete_f2bc_jail${f2barg}
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
if (( $NORMARG + 1 == $CURRENT )) ; then
|
||||
_complete_f2bc_jails
|
||||
elif (( $NORMARG + 2 == $CURRENT )) ; then
|
||||
_values "flavor" basic cymru
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_complete_f2bc_jails() {
|
||||
local jails=($(_f2bc_jails))
|
||||
_describe -V "jails" jails
|
||||
}
|
||||
|
||||
_complete_f2bc_ips() {
|
||||
local ips=("${(@f)$(LANG=C fail2ban-client status $1 2> /dev/null | sed -n -e 's/^.*Banned IP list:\s\+//' -e 'T' -e 's/\s\+/\'$'\n/g' -e 'p')}")
|
||||
if [[ -n "${ips[@]}" ]] ; then
|
||||
_describe -t "f2b_jail_$1" -V "banned ips of jail $1" ips
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
}
|
||||
|
||||
_complete_f2bc_jailset() {
|
||||
if (( $NORMARG + 2 == $CURRENT )) ; then
|
||||
case $words[$NORMARG+1] in
|
||||
loglevel)
|
||||
local loglevel=(CRITICAL ERROR WARNING NOTICE INFO DEBUG TRACEDEBUG HEAVYDEBUG)
|
||||
_describe -V "loglevel" loglevel ;;
|
||||
logtarget)
|
||||
local logtarget=(STDOUT STDERR SYSLOG)
|
||||
_describe -V "logtarget" logtarget
|
||||
_files ;;
|
||||
syslogsocket)
|
||||
local syslogsocket=(auto)
|
||||
_describe -V "logtarget" syslogsocket
|
||||
_files ;;
|
||||
dbfile)
|
||||
_files ;;
|
||||
dbpurgeage)
|
||||
_message "sets the max age in <SECONDS> that history of bans will be kept" ;;
|
||||
*)
|
||||
# jail
|
||||
local jailsettings=(
|
||||
unbanip
|
||||
banip
|
||||
action
|
||||
addaction
|
||||
addfailregex
|
||||
addignoreip
|
||||
addignoreregex
|
||||
addjournalmatch
|
||||
addlogpath
|
||||
bantime
|
||||
datepattern
|
||||
delaction
|
||||
delfailregex
|
||||
delignoreip
|
||||
delignorerexgex
|
||||
deljournalmatch
|
||||
dellogpath
|
||||
findtime
|
||||
idle
|
||||
ignorecache
|
||||
ignorecommand
|
||||
ignoreself
|
||||
logencoding
|
||||
maxlines
|
||||
maxretry
|
||||
usedns
|
||||
)
|
||||
_describe -t "f2b_jail_setting" -V "jail setting" jailsettings ;;
|
||||
esac
|
||||
else
|
||||
local jail="$words[$NORMARG+1]"
|
||||
|
||||
if (( $NORMARG + 3 == $CURRENT )) ; then
|
||||
case $words[$NORMARG+2] in
|
||||
unbanip)
|
||||
_complete_f2bc_ips "$jail" ;;
|
||||
delfailregex)
|
||||
_complete_f2bc_regex fail "$jail" ;;
|
||||
delignorerexgex)
|
||||
_complete_f2bc_regex ignore "$jail" ;;
|
||||
dellogpath)
|
||||
local filelist=("${(@f)$(LANG=C fail2ban-client status $jail 2> /dev/null | sed -n -e 's/^.*File list:\s\+//' -e 'T' -e 's/\s\+/\'$'\n/g' -e 'p')}")
|
||||
|
||||
if [[ -n "${filelist[@]}" ]] ; then
|
||||
_describe -t "f2b_filelist" -V "filelist of jail $1" filelist
|
||||
else
|
||||
_nothing
|
||||
fi ;;
|
||||
idle)
|
||||
_values 'fail2ban idle' on off ;;
|
||||
ignoreself)
|
||||
_values 'fail2ban ignoreself' true false ;;
|
||||
delignoreip)
|
||||
local ignoreips=("${(@f)$(fail2ban-client get "$jail" ignoreip 2> /dev/null | sed -e 's/^[|`]-\s\+//p')}")
|
||||
if [[ -n "${ignoreips[@]}" ]] ; then
|
||||
_describe -t "f2b_ignoreip" -V "fail2ban ignored ips" ignoreips
|
||||
else
|
||||
_nothing
|
||||
fi ;;
|
||||
delaction|action)
|
||||
_complete_f2bc_action "$jail" ;;
|
||||
addlogpath)
|
||||
_files ;;
|
||||
*)
|
||||
_message "No completion for ${words[NORMARG+2]}" ;;
|
||||
esac
|
||||
elif (( $NORMARG + 4 == $CURRENT )) ; then
|
||||
case $words[$NORMARG+2] in
|
||||
action)
|
||||
_complete_f2bc_actionproperties "$jail" $words[$NORMARG+3] ;;
|
||||
addaction)
|
||||
_files ;;
|
||||
*)
|
||||
_nothing ;;
|
||||
esac
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_complete_f2bc_jailget() {
|
||||
if (( $NORMARG + 2 == $CURRENT )) ; then
|
||||
case $words[$NORMARG+1] in
|
||||
(loglevel|logtarget|syslogsocket|dbfile|dbpurgeage))
|
||||
_nothing ;;
|
||||
*)
|
||||
# jail
|
||||
local jailprops=(
|
||||
logpath
|
||||
logencoding
|
||||
journalmatch
|
||||
ignoreself
|
||||
ignoreip
|
||||
ignorecommand
|
||||
failregex
|
||||
ignoreregex
|
||||
findtime
|
||||
bantime
|
||||
datepattern
|
||||
usedns
|
||||
maxretry
|
||||
maxlines
|
||||
actions
|
||||
action
|
||||
actionproperties
|
||||
actionmethods
|
||||
)
|
||||
_describe -t "f2b_jail_props" -V "jail properties" jailprops ;;
|
||||
esac
|
||||
else
|
||||
local jail="$words[$NORMARG+1]"
|
||||
|
||||
if (( $NORMARG + 3 == $CURRENT )) ; then
|
||||
case $words[$NORMARG+2] in
|
||||
(action|actionproperties|actionmethods))
|
||||
_complete_f2bc_action "$jail" ;;
|
||||
*)
|
||||
_nothing ;;
|
||||
esac
|
||||
elif (( $NORMARG + 4 == $CURRENT )) ; then
|
||||
case $words[$NORMARG+2] in
|
||||
(action|actionproperties|actionmethods))
|
||||
_complete_f2bc_actionproperties "$jail" $words[$NORMARG+3] ;;
|
||||
*)
|
||||
_nothing ;;
|
||||
esac
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_complete_f2bc_action() {
|
||||
local jailactions=("${(@f)$(fail2ban-client get $1 actions 2>/dev/null | sed -e '1d' -e 's/,\s\+/\'$'\n/g')}")
|
||||
|
||||
if [[ -n "${jailactions[@]}" ]] ; then
|
||||
_describe -t "f2b_jail_actions" -V "jail actions" jailactions
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
}
|
||||
|
||||
_complete_f2bc_actionproperties() {
|
||||
local default_actionproperties=(
|
||||
actionstart
|
||||
actionstop
|
||||
actioncheck
|
||||
actionban
|
||||
actionunban
|
||||
timeout
|
||||
)
|
||||
local all_actionproperties=("${(@f)$(fail2ban-client get $1 actionproperties $2 2>/dev/null | sed -e '1d' -e 's/,\s\+/\'$'\n/g')}")
|
||||
local add_actionproperties=("${(@)all_actionproperties:|default_actionproperties}")
|
||||
|
||||
_describe -t "f2b_actions_defprops" -V "default action properties" default_actionproperties
|
||||
|
||||
if [[ -n "${add_actionproperties[@]}" ]] ; then
|
||||
_describe -t "f2b_actions_remprops" -V "additional action properties" add_actionproperties
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
}
|
||||
|
||||
_complete_f2bc_regex() {
|
||||
local regex=("${(@f)$(fail2ban-client get $2 ${1}regex 2> /dev/null | sed -n -e 's/[|`]- \[\([0-9]\+\)\]:\s\+/\1:/p')}")
|
||||
if [[ -n "${regex[@]}" ]] ; then
|
||||
_describe -t "f2b_regex" -V "jail $2 ${1}regex" regex
|
||||
else
|
||||
_nothing
|
||||
fi
|
||||
}
|
||||
|
||||
_complete_f2bc_settings() {
|
||||
local setargs=(loglevel logtarget syslogsocket dbfile dbpurgeage)
|
||||
_describe -t "f2b_settings" -V "fail2ban-client settings" setargs
|
||||
}
|
||||
|
||||
integer NORMARG
|
||||
|
||||
_arguments -A "-*" -n \
|
||||
'-c[configuration directory]:_files -/' \
|
||||
'-s[socket path]:_files' \
|
||||
'-p[pidfile path]:_files' \
|
||||
'--loglevel[logging level]:(CRITICAL ERROR WARNING, NOTICE INFO, DEBUG, TRACEDEBUG HEAVYDEBUG)' \
|
||||
'--logtarget[logging target]:(stdout stderr syslog sysout)' \
|
||||
'--syslogsocket:_files' \
|
||||
'-d[dump configuration]' \
|
||||
'(--dp --dump-pretty)'{--dp,--dump-pretty}'[dump the configuration using more human readable representation]' \
|
||||
'(-t --test)'{-t,--test}'[test configuration]' \
|
||||
'-i[interactive mode]' \
|
||||
'-v[increase verbosity]' \
|
||||
'-q[decrease verbosity]' \
|
||||
'-x[force execution of the server (remove socket file)]' \
|
||||
'-b[start server in background]' \
|
||||
'-f[start server in foreground]' \
|
||||
'--str2sec[convert time abbreviation format to seconds]:_message str2sec' \
|
||||
'(-h --help)'{-h,--help}'[display this help message]' \
|
||||
'(-V --version)'{-V,--version}'[print the version]' \
|
||||
'1:fail2ban command:_complete_f2bc_cmds' \
|
||||
'*:fail2ban command argument:_complete_f2bc_cmdargs'
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: set et sw=2 ts=2 ft=zsh:
|
@ -1,273 +0,0 @@
|
||||
#compdef fd
|
||||
|
||||
##
|
||||
# zsh completion function for fd
|
||||
#
|
||||
# Based on ripgrep completion function.
|
||||
# Originally based on code from the zsh-users project — see copyright notice
|
||||
# below.
|
||||
|
||||
autoload -U is-at-least
|
||||
|
||||
_fd() {
|
||||
local curcontext="$curcontext" no='!' ret=1
|
||||
local -a context line state state_descr _arguments_options fd_types fd_args
|
||||
local -A opt_args
|
||||
|
||||
if is-at-least 5.2; then
|
||||
_arguments_options=( -s -S )
|
||||
else
|
||||
_arguments_options=( -s )
|
||||
fi
|
||||
|
||||
fd_types=(
|
||||
{f,file}'\:"regular files"'
|
||||
{d,directory}'\:"directories"'
|
||||
{l,symlink}'\:"symbolic links"'
|
||||
{e,empty}'\:"empty files or directories"'
|
||||
{x,executable}'\:"executable (files)"'
|
||||
{s,socket}'\:"sockets"'
|
||||
{p,pipe}'\:"named pipes (FIFOs)"'
|
||||
)
|
||||
|
||||
# Do not complete rare options unless either the current prefix
|
||||
# matches one of those options or the user has the `complete-all`
|
||||
# style set. Note that this prefix check has to be updated manually to account
|
||||
# for all of the potential negation options listed below!
|
||||
if
|
||||
# (--[bpsu]* => match all options marked with '$no')
|
||||
[[ $PREFIX$SUFFIX == --[bopsu]* ]] ||
|
||||
zstyle -t ":complete:$curcontext:*" complete-all
|
||||
then
|
||||
no=
|
||||
fi
|
||||
|
||||
# We make heavy use of argument groups here to prevent the option specs from
|
||||
# growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip
|
||||
# them out below if necessary. This makes the exclusions inaccurate on those
|
||||
# older versions, but oh well — it's not that big a deal
|
||||
fd_args=(
|
||||
+ '(hidden)' # hidden files
|
||||
{-H,--hidden}'[search hidden files/directories]'
|
||||
|
||||
+ '(no-ignore-full)' # all ignore files
|
||||
'(no-ignore-partial)'{-I,--no-ignore}"[don't respect .(git|fd)ignore and global ignore files]"
|
||||
$no'(no-ignore-partial)*'{-u,--unrestricted}'[alias for --no-ignore, when repeated also alias for --hidden]'
|
||||
|
||||
+ no-ignore-partial # some ignore files
|
||||
"(no-ignore-full --no-ignore-vcs)--no-ignore-vcs[don't respect .gitignore files]"
|
||||
"!(no-ignore-full --no-global-ignore-file)--no-global-ignore-file[don't respect the global ignore file]"
|
||||
$no'(no-ignore-full --no-ignore-parent)--no-ignore-parent[]'
|
||||
|
||||
+ '(case)' # case-sensitivity
|
||||
{-s,--case-sensitive}'[perform a case-sensitive search]'
|
||||
{-i,--ignore-case}'[perform a case-insensitive search]'
|
||||
|
||||
+ '(regex-pattern)' # regex-based search pattern
|
||||
'(no-regex-pattern)--regex[perform a regex-based search (default)]'
|
||||
|
||||
+ '(no-regex-pattern)' # non-regex-based search pattern
|
||||
{-g,--glob}'[perform a glob-based search]'
|
||||
{-F,--fixed-strings}'[treat pattern as literal string instead of a regex]'
|
||||
|
||||
+ '(match-full)' # match against full path
|
||||
{-p,--full-path}'[match the pattern against the full path instead of the basename]'
|
||||
|
||||
+ '(follow)' # follow symlinks
|
||||
{-L,--follow}'[follow symbolic links to directories]'
|
||||
|
||||
+ '(abs-path)' # show absolute paths
|
||||
'(long-listing)'{-a,--absolute-path}'[show absolute paths instead of relative paths]'
|
||||
|
||||
+ '(null-sep)' # use null separator for output
|
||||
'(long-listing)'{-0,--print0}'[separate search results by the null character]'
|
||||
|
||||
+ '(long-listing)' # long-listing output
|
||||
'(abs-path null-sep max-results exec-cmds)'{-l,--list-details}'[use a long listing format with file metadata]'
|
||||
|
||||
+ '(max-results)' # max number of results
|
||||
'(long-listing exec-cmds)--max-results=[limit number of search results to given count and quit]:count'
|
||||
'(long-listing exec-cmds)-1[limit to a single search result and quit]'
|
||||
|
||||
+ '(fs-errors)' # file-system errors
|
||||
$no'--show-errors[enable the display of filesystem errors]'
|
||||
|
||||
+ '(fs-traversal)' # file-system traversal
|
||||
$no"--one-file-system[don't descend into directories on other file systems]"
|
||||
'!--mount'
|
||||
'!--xdev'
|
||||
|
||||
+ dir-depth # directory depth
|
||||
'(--exact-depth -d --max-depth)'{-d+,--max-depth=}'[set max directory depth to descend when searching]:depth'
|
||||
'!(--exact-depth -d --max-depth)--maxdepth:depth'
|
||||
'(--exact-depth --min-depth)--min-depth=[set directory depth to descend before start searching]:depth'
|
||||
'(--exact-depth -d --max-depth --maxdepth --min-depth)--exact-depth=[only search at the exact given directory depth]:depth'
|
||||
|
||||
+ prune # pruning
|
||||
"--prune[don't traverse into matching directories]"
|
||||
|
||||
+ filter-misc # filter search
|
||||
'*'{-t+,--type=}"[filter search by type]:type:(($fd_types))"
|
||||
'*'{-e+,--extension=}'[filter search by file extension]:extension'
|
||||
'*'{-E+,--exclude=}'[exclude files/directories that match the given glob pattern]:glob pattern'
|
||||
'*'{-S+,--size=}'[limit search by file size]:size limit:->size'
|
||||
'(-o --owner)'{-o+,--owner=}'[filter by owning user and/or group]:owner and/or group:->owner'
|
||||
|
||||
+ ignore-file # extra ignore files
|
||||
'*--ignore-file=[add a custom, low-precedence ignore-file with .gitignore format]: :_files'
|
||||
|
||||
+ '(filter-mtime-newer)' # filter by files modified after than
|
||||
'--changed-within=[limit search to files/directories modified within the given date/duration]:date or duration'
|
||||
'!--change-newer-than=:date/duration'
|
||||
'!--newer=:date/duration'
|
||||
|
||||
+ '(filter-mtime-older)' # filter by files modified before than
|
||||
'--changed-before=[limit search to files/directories modified before the given date/duration]:date or duration'
|
||||
'!--change-older-than=:date/duration'
|
||||
'!--older=:date/duration'
|
||||
|
||||
+ '(color)' # colorize output
|
||||
{-c+,--color=}'[declare when to colorize search results]:when to colorize:((
|
||||
auto\:"show colors if the output goes to an interactive console (default)"
|
||||
never\:"do not use colorized output"
|
||||
always\:"always use colorized output"
|
||||
))'
|
||||
|
||||
+ '(threads)'
|
||||
{-j+,--threads=}'[set the number of threads for searching and executing]:number of threads'
|
||||
|
||||
+ '(exec-cmds)' # execute command
|
||||
'(long-listing max-results)'{-x+,--exec=}'[execute command for each search result]:command: _command_names -e:*\;::program arguments: _normal'
|
||||
'(long-listing max-results)'{-X+,--exec-batch=}'[execute command for all search results at once]:command: _command_names -e:*\;::program arguments: _normal'
|
||||
'(long-listing max-results)--batch-size=[max number of args for each -X call]:size'
|
||||
|
||||
+ other
|
||||
'!(--max-buffer-time)--max-buffer-time=[set amount of time to buffer before showing output]:time (ms)'
|
||||
|
||||
+ '(about)' # about flags
|
||||
'(: * -)'{-h,--help}'[display help message]'
|
||||
'(: * -)'{-v,--version}'[display version information]'
|
||||
|
||||
+ path-sep # set path separator for output
|
||||
$no'(--path-separator)--path-separator=[set the path separator to use when printing file paths]:path separator'
|
||||
|
||||
+ search-path
|
||||
$no'(--base-directory)--base-directory=[change the current working directory to the given path]:directory:_files -/'
|
||||
$no'(*)*--search-path=[set search path (instead of positional <path> arguments)]:directory:_files -/'
|
||||
|
||||
+ strip-cwd-prefix
|
||||
$no'(strip-cwd-prefix exec-cmds)--strip-cwd-prefix[Strip ./ prefix when output is redirected]'
|
||||
|
||||
+ args # positional arguments
|
||||
'1: :_guard "^-*" pattern'
|
||||
'(--search-path)*:directory:_files -/'
|
||||
)
|
||||
|
||||
# Strip out argument groups where unsupported (see above)
|
||||
is-at-least 5.4 ||
|
||||
fd_args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} )
|
||||
|
||||
_arguments $_arguments_options : $fd_args && ret=0
|
||||
|
||||
case ${state} in
|
||||
owner)
|
||||
compset -P '(\\|)\!'
|
||||
if compset -P '*:'; then
|
||||
_groups && ret=0
|
||||
else
|
||||
if
|
||||
compset -S ':*' ||
|
||||
# Do not add the colon suffix when completing "!user<TAB>
|
||||
# (with a starting double-quote) otherwise pressing tab again
|
||||
# after the inserted colon "!user:<TAB> will complete history modifiers
|
||||
[[ $IPREFIX == (\\|\!)* && ($QIPREFIX == \"* && -z $QISUFFIX) ]]
|
||||
then
|
||||
_users && ret=0
|
||||
else
|
||||
local q
|
||||
# Since quotes are needed when using the negation prefix !,
|
||||
# automatically remove the colon suffix also when closing the quote
|
||||
if [[ $QIPREFIX == [\'\"]* ]]; then
|
||||
q=${QIPREFIX:0:1}
|
||||
fi
|
||||
_users -r ": \t\n\-$q" -S : && ret=0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
size)
|
||||
if compset -P '[-+][0-9]##'; then
|
||||
local -a suff=(
|
||||
'B:bytes'
|
||||
'K:kilobytes (10^3 = 1000 bytes)'
|
||||
'M:megabytes (10^6 = 1000^2 bytes)'
|
||||
'G:gigabytes (10^9 = 1000^3 bytes)'
|
||||
'T:terabytes (10^12 = 1000^4 bytes)'
|
||||
'Ki:kibibytes ( 2^10 = 1024 bytes)'
|
||||
'Mi:mebibytes ( 2^20 = 1024^2 bytes)'
|
||||
'Gi:gigibytes ( 2^30 = 1024^3 bytes)'
|
||||
'Ti:tebibytes ( 2^40 = 1024^4 bytes)'
|
||||
)
|
||||
_describe -t units 'size limit units' suff -V 'units'
|
||||
elif compset -P '[-+]'; then
|
||||
_message -e 'size limit number (full format: <+-><number><unit>)'
|
||||
else
|
||||
_values 'size limit prefix (full format: <prefix><number><unit>)' \
|
||||
'\+[file size must be greater or equal to]'\
|
||||
'-[file size must be less than or equal to]' && ret=0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_fd "$@"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2011 GitHub zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for fd
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * smancill (https://github.com/smancill)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# coding: utf-8-unix
|
||||
# indent-tabs-mode: nil
|
||||
# sh-indentation: 2
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
@ -1,338 +0,0 @@
|
||||
#compdef firewall-cmd firewall-offline-cmd
|
||||
|
||||
local curcontext="$curcontext" name nm="$compstate[nmatches]"
|
||||
local -a state line expl direct args auxargs opargs suf
|
||||
typeset -A opt_args
|
||||
|
||||
direct=(
|
||||
'--get-all-chains[get all chains]'
|
||||
'--get-chains[get all chains added to the table]:family:(ipv4 ipv6 eb):table:->tables'
|
||||
'--add-chain[add a new chain to the table]:family:(ipv4 ipv6 eb):table:->tables:new chain'
|
||||
'--remove-chain[remove a chain from the table]:family:(ipv4 ipv6 eb):table:->tables:chain:->chains'
|
||||
'--query-chain[return whether the chain has been added to the table]:family:(ipv4 ipv6 eb):table:->tables:chain:->chains'
|
||||
'--get-all-rules[get all rules]'
|
||||
'--get-rules[get all rules added to chain in table]:family:(ipv4 ipv6 eb):table:->tables:chain:->chains'
|
||||
'--add-rule[add rule to chain in table]:family:(ipv4 ipv6 eb):table:->tables:chain:->chains:priority: :*:argument'
|
||||
'--remove-rule[remove rule with priority from chain in table]:family:(ipv4 ipv6 eb):table:->tables:chain:->chains:priority: :*:argument'
|
||||
'--remove-rules[remove rules from chain in table]:family:(ipv4 ipv6 eb):table:->tables:chain->chains'
|
||||
'--query-rule[chain in table]:family:(ipv4 ipv6 eb):table:->tables:chain: :priority: :*:argument'
|
||||
'--get-all-passthroughs[get all tracked passthrough rules]'
|
||||
'--get-passthroughs[get tracked passthrough rules]:family:(ipv4 ipv6 eb):*:: : _iptables'
|
||||
'--add-passthrough[add a new tracked passthrough rule]:family:(ipv4 ipv6 eb):*:: : _iptables'
|
||||
'--remove-passthrough[remove a tracked passthrough rule]:family:(ipv4 ipv6 eb):*:: : _iptables'
|
||||
'--query-passthrough[return whether the tracked passthrough rule has been added]:family:(ipv4 ipv6 eb):*:: : _iptables'
|
||||
)
|
||||
name='--name=[specify new name]:name'
|
||||
|
||||
case $service in
|
||||
firewall-cmd)
|
||||
direct+=(
|
||||
'--passthrough[pass a command through (untracked by firewalld)]:family:(ipv4 ipv6 eb):*:: : _iptables'
|
||||
)
|
||||
args=(
|
||||
'(--timeout)--permanent[set an option permanently]'
|
||||
)
|
||||
auxargs=(
|
||||
'(--permanent)--timeout=[specify time for rule to be active]:time value (seconds)'
|
||||
)
|
||||
opargs=(
|
||||
'(aux --permanent --zone)--state[print firewalld state]'
|
||||
'(aux --permanent --zone)--reload[reload firewall and keep state information]'
|
||||
'(aux --permanent --zone)--complete-reload[reload firewall and lose state information]'
|
||||
'(aux --permanent --zone)--runtime-to-permanent[create permanent from runtime configuration]'
|
||||
'(aux --permanent --zone -q --quiet)--get-active-zones[print currently active zones]'
|
||||
'*--remove-service=[remove a service from a zone]:service:->services'
|
||||
'(aux --permanent --zone)--panic-on[enable panic mode]'
|
||||
'(aux --permanent --zone)--panic-off[disable panic mode]'
|
||||
'(aux --permanent --zone)--query-panic[query whether panic mode is enabled]'
|
||||
)
|
||||
;;
|
||||
firewall-offline-cmd)
|
||||
args=(
|
||||
'--system-config[specify path to firewalld system configuration]:path:_directories'
|
||||
'--default-config[specify path to firewalld default configuration]:path:_directories'
|
||||
'--migrate-system-config-firewall=[import configuration data from the given configuration file]:file:_files'
|
||||
'--disabled[disable the firewall by disabling the firewalld service]' '!(--disabled)--enabled'
|
||||
'!--'{add,remove}'module=:iptables module' '!--custom-rules=:type:table:filename (ignored'
|
||||
\*{-s+,--service=}'[enable a service in the default zone]:service:->services'
|
||||
'*--remove-service=[disable a service in the default zone]:service:->services'
|
||||
\*{-p+,--port=}'[enable a port in the default zone]:port:->ports'
|
||||
\*{-t+,--trust=}'[bind an interface to the trusted zone]:interface:_net_interfaces'
|
||||
{-m+,--masq=}'[enable masquerading in the default zone, IPv4 only]:interface (ignored)'
|
||||
'--forward-port=[add port forward in the default zone]:port forward:->port-forwards'
|
||||
'--block-icmp=[block this ICMP type in the default zone]:icmp type:->icmp-types'
|
||||
"--policy-server[change Polkit actions to 'server' (more restricted)]"
|
||||
"--policy-desktop[change Polkit actions to 'desktop' (less restricted)]"
|
||||
)
|
||||
opargs=(
|
||||
'*--remove-service-from-zone[remove a service from a zone]:service:->services'
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
||||
# option ordering doesn't matter but listing fewer options makes
|
||||
# completion more useful:
|
||||
(( $words[(I)--direct] )) || direct=( \!$^direct ) # only list direct options after --direct
|
||||
(( $words[(I)--new-*-from-file*] )) || name="!$name" # also check for required options before listing --name
|
||||
|
||||
_arguments -C -s $args $direct \
|
||||
'!(-q --quiet)'{-v,--verbose} \
|
||||
'(-q --quiet --list-all --list-all-zones --list-lockdown-whitelist-commands --list-lockdown-whitelist-contexts --list-lockdown-whitelist-uids --list-lockdown-whitelist-users --list-services --list-ports --list-protocols --list-icmp-blocks --list-forward-ports --list-rich-rules --list-interfaces --list-sources --get-default-zone --get-active-zones --get-zone-of-interface --get-zone-of-source --get-zones --get-services --get-icmptypes --get-target --info-zone --info-icmptype --info-service --info-ipset --get-ipsets --get-entries --info-helper --get-helpers --get-destinations --get-description --version -h --help)'{-q,--quiet}"[don't print status messages]" \
|
||||
'*--zone=[use this zone to set or query options, else default zone]:zone:->zones' \
|
||||
+ aux \
|
||||
$auxargs $name \
|
||||
'*--option=[specify option]:option (key=value)' \
|
||||
'--type=[specify ipset type]:ipset type:->ipset-types' \
|
||||
'--ipset=[specify ipset]:ipset:->ipsets' \
|
||||
'--icmptype=[specify icmp type]:icmp type:->icmp-types' \
|
||||
'--service=[specify service]:service:->services' \
|
||||
'--helper=[specify helper]:helper:->helpers' \
|
||||
'--family=[specify family]:family:(ipv4 ipv6)' \
|
||||
'--module=[specify module]:module' \
|
||||
+ '(op)' \
|
||||
$opargs \
|
||||
'(aux -)'{-h,--help}'[display usage information]' \
|
||||
'(aux -)'{-V,--version}'[display version information]' \
|
||||
'(aux --permanent --zone)--get-log-denied[print the log denied value]' \
|
||||
'(aux --permanent --zone)--set-log-denied=[set log denied value]:value:(all unicast broadcast multicast off)' \
|
||||
'(aux --permanent --zone)--get-automatic-helpers[print the automatic helpers value]' \
|
||||
'(aux --permanent --zone)--set-automatic-helpers=[set automatic helpers value]:value:(yes no system)' \
|
||||
'(aux --permanent --zone -q --quiet)--get-default-zone[print default zone for connections and interfaces]' \
|
||||
'(aux --permanent --zone)--set-default-zone=[set default zone]:zone:->zones' \
|
||||
'(--zone -q --quiet)--get-zones[print predefined zones]' \
|
||||
'(--zone -q --quiet)--get-services[print predefined services]' \
|
||||
'(--zone -q --quiet)--get-icmptypes[print predefined icmptypes]' \
|
||||
'(-q --quiet)*--get-zone-of-interface=[print name of the zone the interface is bound to]:interface:_net_interfaces' \
|
||||
'(-q --quiet)*--get-zone-of-source=[print name of the zone a source is bound to]:source' \
|
||||
'(-q --quiet)--list-all-zones[list everything added for or enabled in all zones]' \
|
||||
'--new-zone=[add a new zone]:zone:->zones' \
|
||||
'--new-zone-from-file=[add a new zone from file with optional name]:filename:_files' \
|
||||
'--delete-zone=[delete an existing zone]:zone:->zones' \
|
||||
'--load-zone-defaults=[load zone default settings]:zone:->zones' \
|
||||
'(-q --quiet)--get-target[get the zone target]' \
|
||||
'--set-target=[set the zone target]:target:(default ACCEPT DROP REJECT)' \
|
||||
'(-q --quiet)--info-zone=[print information about a zone]:zone:->zones' \
|
||||
'--path-zone=[print file path of a zone]:zone:->zones' \
|
||||
'(aux --permanent --zone)--get-ipset-types[print the supported ipset types]' \
|
||||
'--new-ipset=[add a new ipset]:ipset:->ipsets' \
|
||||
'--new-ipset-from-file=[add a new ipset from file with optional name]:filename:_files' \
|
||||
'--delete-ipset=[delete an existing ipset]:ipset:->ipsets' \
|
||||
'--load-ipset-defaults=[load ipset default settings]:ipset:->ipsets' \
|
||||
'(-q --quiet)--info-ipset=[print information about an ipset]:ipset' \
|
||||
'--path-ipset=[print file path of an ipset]:ipset' \
|
||||
'(aux --permanent --zone -q --quiet)--get-ipsets[print predefined ipsets]' \
|
||||
'--set-description=[set new description]:description' \
|
||||
'(-q --quiet)--get-description[print description]' \
|
||||
'--set-short=[set new short description]:description' \
|
||||
'--get-short[print short description]' \
|
||||
'*--add-entry=[add a new entry to an ipset]:entry' \
|
||||
'*--remove-entry=[remove an entry from an ipset]:entry' \
|
||||
'*--query-entry=[return whether ipset has an entry]:entry' \
|
||||
'(-q --quiet)--get-entries[list entries of an ipset]' \
|
||||
'*--add-entries-from-file=[add a new entries to an ipset]:entry' \
|
||||
'--remove-entries-from-file=[remove entries from an ipset]:entry' \
|
||||
'--new-icmptype=[add a new icmptype]:icmp type:->icmp-types' \
|
||||
'--new-icmptype-from-file=[add a new icmptype from file with optional name]:file:_files' \
|
||||
'--delete-icmptype=[delete an existing icmptype]:icmp type:->icmp-types' \
|
||||
'--load-icmptype-defaults=[load icmptype default settings]:icmp type:->icmp-types' \
|
||||
'(-q --quiet)--info-icmptype=[print information about an icmptype]:icmp type:->icmp-types' \
|
||||
'--path-icmptype=[print file path of an icmptype]:icmp type:->icmp-types' \
|
||||
'*--add-destination=[enable destination for ipv in icmptype]:destination:->destinations' \
|
||||
'*--remove-destination=[disable destination for ipv in service or icmp-type]:destination:->destinations' \
|
||||
'(-q --quiet)--get-destinations[list destinations]' \
|
||||
'--new-service=[add a new service]:service' \
|
||||
'--new-service-from-file=[add a new service from file with optional name]:file:_files' \
|
||||
'--delete-service=[delete an existing service]:service:->services' \
|
||||
'--load-service-defaults=[load icmptype default settings]:service:->services' \
|
||||
'(-q --quiet)--info-service=[print information about a service]:service:->services' \
|
||||
'--path-service=[print file path of a service]:service:->services' \
|
||||
'*--add-port=[add a new port to service, zone or helper]:port:->ports' \
|
||||
'*--remove-port=[remove a port from a service, zone or helper]:port:->ports' \
|
||||
'*--query-port=[return whether the port has been added for service, zone or helper]:port:->ports' \
|
||||
'--get-ports[list ports of service or helper]' \
|
||||
'*--add-protocol=[add a new protocol to service or zone]:protocol' \
|
||||
'*--remove-protocol=[remove a protocol from service or zone]:protocol' \
|
||||
'*--query-protocol=[return whether the protocol has been added for service or zone]:protocol' \
|
||||
'--get-protocols[list protocols of service]' \
|
||||
'*--add-source-port=[add a new source port to service or zone]:port:->ports' \
|
||||
'*--remove-source-port=[remove a source port from service or zone]:port:->ports' \
|
||||
'*--query-source-port=[return whether the source port has been added for service or zone]:port:->ports' \
|
||||
'--get-source-ports[list source ports of service]' \
|
||||
'*--add-module=[add a new module to service]:module' \
|
||||
'*--remove-module=[remove a module from service]:module' \
|
||||
'*--query-module=[return whether the module has been added for service]:module' \
|
||||
'--get-modules[list modules of service]' \
|
||||
'*--set-destination=[set destination for ipv to address in service]:destination:->destinations' \
|
||||
'--query-destination=[return whether destination ipv is set for service or enabled for icmptype]:destination:->destinations' \
|
||||
'(-q --quiet)--list-all[list everything added for or enabled in a zone]' \
|
||||
'(-q --quiet)--list-services[list services added for a zone]' \
|
||||
'*--add-service=[add a service for a zone]:service:->services' \
|
||||
'*--query-service=[return whether service has been added for a zone]:service:->services' \
|
||||
'(-q --quiet)--list-ports[list ports added for a zone]' \
|
||||
'(-q --quiet)--list-protocols[list protocols added for a zone]' \
|
||||
'--list-source-ports[list source ports added for a zone]' \
|
||||
'(-q --quiet)--list-icmp-blocks[list Internet ICMP type blocks added for a zone]' \
|
||||
'*--add-icmp-block=[add an ICMP block for a zone]:icmp type:->icmp-types' \
|
||||
'*--remove-icmp-block=[remove the ICMP block from a zone]:icmp type:->icmp-types' \
|
||||
'*--query-icmp-block=[return whether an ICMP block has been added for a zone]:icmp type:->icmp-types' \
|
||||
'--add-icmp-block-inversion[enable inversion of icmp blocks for a zone]' \
|
||||
'--remove-icmp-block-inversion[disable inversion of icmp blocks for a zone]' \
|
||||
'--query-icmp-block-inversion[return whether inversion of icmp blocks has been enabled for a zone]' \
|
||||
'(-q --quiet)--list-forward-ports[list IPv4 forward ports added for a zone]' \
|
||||
'*--add-forward-port=[add the IPv4 forward port for a zone]: :->port-forwards' \
|
||||
'*--remove-forward-port=[remove the IPv4 forward port from a zone]: :->port-forwards' \
|
||||
'*--query-forward-port=[return whether the IPv4 forward port has been added for a zone]: :->port-forwards' \
|
||||
'--add-forward[enable forwarding between interfaces and sources in a zone]' \
|
||||
'--remove-forward[disable forwarding between interfaces and sources in a zone]' \
|
||||
'--query-forward[return whether forwarding has been enabled for a zone]' \
|
||||
'--add-masquerade[enable IPv4 masquerade for a zone]' \
|
||||
'--remove-masquerade[disable IPv4 masquerade for a zone]' \
|
||||
'--query-masquerade[return whether IPv4 masquerading has been enabled for a zone]' \
|
||||
'(-q --quiet)--list-rich-rules[list rich language rules added for a zone]' \
|
||||
'*--add-rich-rule=[add rich language rule for a zone]:rule' \
|
||||
'*--remove-rich-rule=[remove specified rich language rule from a zone]:rule' \
|
||||
'*--query-rich-rule=[return whether specified rich language rule has been added for a zone]:rule' \
|
||||
'(-q --quiet)--list-interfaces[list interfaces that are bound to a zone]' \
|
||||
'*--add-interface=[bind the specified interface to a zone]:interface:_net_interfaces' \
|
||||
'*--change-interface=[change zone the specified interface is bound to]:interface:_net_interfaces' \
|
||||
'*--query-interface=[query whether specified interface is bound to a zone]:interface:_net_interfaces' \
|
||||
'*--remove-interface=[remove binding of specified interface from a zone]:interface:_net_interfaces' \
|
||||
'(-q --quiet)--list-sources[list sources that are bound to a zone]' \
|
||||
'*--add-source=[bind source to a zone]: :->sources' \
|
||||
'*--change-source=[change zone a source is bound to]: :->sources' \
|
||||
'*--query-source=[query whether source is bound to a zone]: :->sources' \
|
||||
'*--remove-source=[remove binding of a source from a zone]: :->sources' \
|
||||
'--new-helper=[add a new helper]:helper:->helpers' \
|
||||
'--new-helper-from-file=[add a new helper from file with optional name]:file:_files' \
|
||||
'--delete-helper=[delete an existing helper]:helper:->helpers' \
|
||||
'--load-helper-defaults=[load helper default settings]:helper:->helpers' \
|
||||
'(--zone -q --quiet)--info-helper=[print information about an helper]:helper:->helpers' \
|
||||
'--path-helper=[print file path of an helper]:helper:->helpers' \
|
||||
'--get-policies[print predefined policies]' \
|
||||
'--get-active-policies[print currently active policies]' \
|
||||
'--list-all-policies[list everything added for or enabled in all policies]' \
|
||||
'--new-policy=[add a new empty policy]:policy:->policies' \
|
||||
'--new-policy-from-file=[add a new policy from file with optional name override]:file:_files' \
|
||||
'--delete-policy=[delete an existing policy]:policy:->policies' \
|
||||
'--load-policy-defaults=[load policy default settings]:policy:->policies' \
|
||||
'--policy=[use this policy to set or query options]:policy:->policies' \
|
||||
'--info-policy=[print information about a policy]:policy:->policies' \
|
||||
'--path-policy=[print file path of a policy]:policy:->policies' \
|
||||
'(--zone -q --quiet)--get-helpers[print predefined helpers]' \
|
||||
'--set-module=[set module to helper]:module' \
|
||||
'--get-module[get module from helper]' \
|
||||
'--set-family=[set family for helper]:family' \
|
||||
'--get-family[get family from helper]' \
|
||||
'(aux --permanent --zone)--lockdown-on[enable lockdown]' \
|
||||
'(aux --permanent --zone)--lockdown-off[disable lockdown]' \
|
||||
'(aux --permanent --zone)--query-lockdown[query whether lockdown is enabled]' \
|
||||
'(-q --quiet)--list-lockdown-whitelist-commands[list all command lines that are on the whitelist]' \
|
||||
'*--add-lockdown-whitelist-command=[add a command to the whitelist]:command:_cmdstring' \
|
||||
'*--remove-lockdown-whitelist-command=[remove the command from the whitelist]:command' \
|
||||
'*--query-lockdown-whitelist-command=[query whether a command is on the whitelist]:command' \
|
||||
'(-q --quiet)--list-lockdown-whitelist-contexts[list all contexts that are on the whitelist]' \
|
||||
'*--add-lockdown-whitelist-context=[add the specified context to the whitelist]:context' \
|
||||
'*--remove-lockdown-whitelist-context=[remove a context from the whitelist]:context' \
|
||||
'*--query-lockdown-whitelist-context=[query whether a context is on the whitelist]:context' \
|
||||
'(-q --quiet)--list-lockdown-whitelist-uids[list all user ids that are on the whitelist]' \
|
||||
'*--add-lockdown-whitelist-uid=[add the specified user id to the whitelist]:uid' \
|
||||
'*--remove-lockdown-whitelist-uid=[remove the specified user id from the whitelist]:uid' \
|
||||
'*--query-lockdown-whitelist-uid=[query whether a user id is on the whitelist]:uid' \
|
||||
'(-q --quiet)--list-lockdown-whitelist-users[list all user names that are on the whitelist]' \
|
||||
'*--add-lockdown-whitelist-user=[add the specified user to the whitelist]:user:_users' \
|
||||
'*--remove-lockdown-whitelist-user=[remove the specified user from the whitelist]:user:_users' \
|
||||
'*--query-lockdown-whitelist-user=[query whether the specified user is on the whitelist]:user:_users' \
|
||||
'--direct[first option for all direct options]'
|
||||
|
||||
|
||||
# add sub option for policy.
|
||||
if [[ ${words[@]/'--policy'/} != ${words[@]} ]]
|
||||
then
|
||||
_arguments \
|
||||
'--get-priority[get the priority]' \
|
||||
'--set-priority=[set the priority]' \
|
||||
'--list-ingress-zones[list ingress zones that are bound to a policy]' \
|
||||
'--add-ingress-zone=[add the ingress zone to a policy]:zone:->zones' \
|
||||
'--remove-ingress-zone=[remove the ingress zone from a policy]:zone:->zones' \
|
||||
'--query-ingress-zone=[wuery whether the ingress zone has been adedd to a policy]:zone:->zones' \
|
||||
'--list-egress-zones[list egress zones that are bound to a policy]' \
|
||||
'--add-egress-zone=[add the egress zone to a policy]:zone:->zones' \
|
||||
'--remove-egress-zone=[remove the egress zone from a policy]:zone:->zones' \
|
||||
'--query-egress-zone=[query whether the egress zone has been adedd to a policy]:zone:->zones'
|
||||
fi
|
||||
|
||||
[[ $state = sources ]] && compset -P 'ipset:' && state=ipsets
|
||||
case $state in
|
||||
sources)
|
||||
_message -e sources "source[/mask]|MAC|ipset:ipset"
|
||||
;;
|
||||
chains)
|
||||
_description chains expl 'chain'
|
||||
compadd "$expl[@]" - ${${(f)"$(_call_program chains $words[1] ${(k)opt_args[--permanent]} --direct --get-all-chains)"}##* }
|
||||
;;
|
||||
destinations)
|
||||
if compset -P 1 '*:'; then
|
||||
if compset -P 1 '*/'; then
|
||||
_message -e masks "mask"
|
||||
else
|
||||
_message -e addresses "address"
|
||||
fi
|
||||
else
|
||||
compset -S ':*' || suf=( -qS : )
|
||||
_description ipvs expl 'ipv'
|
||||
compadd "$expl[@]" $suf - ipv4 ipv6
|
||||
fi
|
||||
;;
|
||||
helpers)
|
||||
_description helpers expl 'helper'
|
||||
compadd "$expl[@]" - $(_call_program helpers $words[1] ${(k)opt_args[--permanent]} --get-helpers)
|
||||
;;
|
||||
icmp-types)
|
||||
_description icmp-types expl 'icmp type'
|
||||
compadd "$expl[@]" - $(_call_program icmp-types $words[1] --get-icmptypes)
|
||||
;;
|
||||
ipsets)
|
||||
_description ipsets expl 'ipset'
|
||||
compadd "$expl[@]" - $(_call_program ipsets $words[1] ${(k)opt_args[--permanent]} --get-ipsets)
|
||||
;;
|
||||
ipset-types)
|
||||
_description ipset-types expl 'ipset type'
|
||||
compadd "$expl[@]" - $(_call_program ipset-types $words[1] --get-ipset-types)
|
||||
;;
|
||||
ports)
|
||||
if compset -P 1 '*/'; then
|
||||
_description protocols expl 'protocol'
|
||||
compadd "$expl[@]" - tcp udp sctp dccp
|
||||
else
|
||||
_message -e ports 'port number'
|
||||
fi
|
||||
;;
|
||||
port-forwards)
|
||||
_values -S = -s : 'port forward' \
|
||||
'port[specify port]:port range:_sequence -n 2 -s - _ports' \
|
||||
'proto[specify protocol]:protocol:(tcp udp sctp dccp)' \
|
||||
'toport[specify port]:port range:_sequence -n 2 -s - _ports' \
|
||||
'toaddr[specify destination address]:address[/mask]'
|
||||
;;
|
||||
services)
|
||||
_description services expl 'service'
|
||||
compadd "$expl[@]" - $(_call_program services $words[1] --get-services)
|
||||
;;
|
||||
tables)
|
||||
_description services expl 'service'
|
||||
compadd "$expl[@]" - security raw mangle nat filter
|
||||
;;
|
||||
zones)
|
||||
_description zones expl 'zone'
|
||||
compadd "$expl[@]" - $(_call_program zones $words[1] --get-zones)
|
||||
;;
|
||||
policies)
|
||||
_description policies expl 'policies'
|
||||
compadd "$expl[@]" - $(_call_program policies $words[1] --get-policies)
|
||||
;;
|
||||
esac
|
||||
|
||||
# return whether matches were added
|
||||
[[ nm -ne compstate[nmatches] ]] && return 0
|
||||
return 1
|
||||
|
@ -1,3 +0,0 @@
|
||||
#compdef gh
|
||||
|
||||
source <(gh completion -s zsh)
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
#compdef j
|
||||
cur=${words[2, -1]}
|
||||
|
||||
autojump --complete ${=cur[*]} | while read i; do
|
||||
compadd -U "$i";
|
||||
done
|
@ -1,3 +0,0 @@
|
||||
#compdef kind
|
||||
|
||||
source <(kind completion zsh)
|
@ -1,3 +0,0 @@
|
||||
#compdef kubectl
|
||||
|
||||
source <(kubectl completion zsh)
|
@ -1 +0,0 @@
|
||||
source <(minikube completion zsh)
|
@ -1,250 +0,0 @@
|
||||
#compdef mpv
|
||||
|
||||
# ZSH completion for mpv
|
||||
#
|
||||
# For customization, see:
|
||||
# https://github.com/mpv-player/mpv/wiki/Zsh-completion-customization
|
||||
|
||||
#
|
||||
# This file is part of mpv.
|
||||
#
|
||||
# mpv is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# mpv is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with mpv. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
local curcontext="$curcontext" state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
local -a match mbegin mend
|
||||
local MATCH MBEGIN MEND
|
||||
|
||||
# By default, don't complete URLs unless no files match
|
||||
local -a tag_order
|
||||
zstyle -a ":completion:*:*:$service:*" tag-order tag_order ||
|
||||
zstyle ":completion:*:*:$service:*" tag-order '!urls'
|
||||
|
||||
typeset -ga _mpv_completion_arguments _mpv_completion_protocols
|
||||
|
||||
function _mpv_generate_arguments {
|
||||
|
||||
_mpv_completion_arguments=()
|
||||
|
||||
local -a option_aliases=()
|
||||
|
||||
local list_options_line
|
||||
for list_options_line in "${(@f)$($~words[1] --list-options)}"; do
|
||||
|
||||
[[ $list_options_line =~ $'^[ \t]+--([^ \t]+)[ \t]*(.*)' ]] || continue
|
||||
|
||||
local name=$match[1] desc=$match[2]
|
||||
|
||||
if [[ $desc == Flag* ]]; then
|
||||
|
||||
_mpv_completion_arguments+="$name"
|
||||
if [[ $name != (\{|\}|v|list-options) ]]; then
|
||||
# Negated version
|
||||
_mpv_completion_arguments+="no-$name"
|
||||
fi
|
||||
|
||||
elif [[ -z $desc ]]; then
|
||||
|
||||
# Sub-option for list option
|
||||
|
||||
if [[ $name == *-(clr|help) ]]; then
|
||||
# Like a flag
|
||||
_mpv_completion_arguments+="$name"
|
||||
else
|
||||
# Find the parent option and use that with this option's name
|
||||
_mpv_completion_arguments+="${_mpv_completion_arguments[(R)${name%-*}=*]/*=/$name=}"
|
||||
fi
|
||||
|
||||
elif [[ $desc == Print* ]]; then
|
||||
|
||||
_mpv_completion_arguments+="$name"
|
||||
|
||||
elif [[ $desc =~ $'^alias for (--)?([^ \t]+)' ]]; then
|
||||
|
||||
# Save this for later; we might not have parsed the target option yet
|
||||
option_aliases+="$name $match[2]"
|
||||
|
||||
else
|
||||
|
||||
# Option takes argument
|
||||
|
||||
local entry="$name=-:${desc//:/\\:}:"
|
||||
|
||||
if [[ $desc =~ '^Choices: ([^(]*)' ]]; then
|
||||
|
||||
local -a choices=(${(s: :)match[1]})
|
||||
entry+="($choices)"
|
||||
# If "no" is one of the choices, it can also be negated like a flag
|
||||
# (--no-whatever is equivalent to --whatever=no).
|
||||
if (( ${+choices[(r)no]} )); then
|
||||
_mpv_completion_arguments+="no-$name"
|
||||
fi
|
||||
|
||||
elif [[ $desc == *'[file]'* ]]; then
|
||||
|
||||
entry+='->files'
|
||||
|
||||
elif [[ $name == (ao|vo|af|vf|profile|audio-device|vulkan-device) ]]; then
|
||||
|
||||
entry+="->parse-help-$name"
|
||||
|
||||
elif [[ $name == show-profile ]]; then
|
||||
|
||||
entry+="->parse-help-profile"
|
||||
|
||||
fi
|
||||
|
||||
_mpv_completion_arguments+="$entry"
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
# Process aliases
|
||||
local to_from real_name arg_spec
|
||||
for to_from in $option_aliases; do
|
||||
# to_from='alias-name real-name'
|
||||
real_name=${to_from##* }
|
||||
for arg_spec in "$real_name" "$real_name=*" "no-$real_name"; do
|
||||
arg_spec=${_mpv_completion_arguments[(r)$arg_spec]}
|
||||
[[ -n $arg_spec ]] &&
|
||||
_mpv_completion_arguments+="${arg_spec/$real_name/${to_from%% *}}"
|
||||
done
|
||||
done
|
||||
|
||||
# Older versions of zsh have a bug where they won't complete an option listed
|
||||
# after one that's a prefix of it. To work around this, we can sort the
|
||||
# options by length, longest first, so that any prefix of an option will be
|
||||
# listed after it. On newer versions of zsh where the bug is fixed, we skip
|
||||
# this to avoid slowing down the first tab press any more than we have to.
|
||||
autoload -Uz is-at-least
|
||||
if ! is-at-least 5.2; then
|
||||
# If this were a real language, we wouldn't have to sort by prepending the
|
||||
# length, sorting the whole thing numerically, and then removing it again.
|
||||
local -a sort_tmp=()
|
||||
for arg_spec in $_mpv_completion_arguments; do
|
||||
sort_tmp+=${#arg_spec%%=*}_$arg_spec
|
||||
done
|
||||
_mpv_completion_arguments=(${${(On)sort_tmp}/#*_})
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function _mpv_generate_protocols {
|
||||
_mpv_completion_protocols=()
|
||||
local list_protos_line
|
||||
for list_protos_line in "${(@f)$($~words[1] --list-protocols)}"; do
|
||||
if [[ $list_protos_line =~ $'^[ \t]+(.*)' ]]; then
|
||||
_mpv_completion_protocols+="$match[1]"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function _mpv_generate_if_changed {
|
||||
# Called with $1 = 'arguments' or 'protocols'. Generates the respective list
|
||||
# on the first run and re-generates it if the executable being completed for
|
||||
# is different than the one we used to generate the cached list.
|
||||
typeset -gA _mpv_completion_binary
|
||||
local current_binary=${~words[1]:c}
|
||||
zmodload -F zsh/stat b:zstat
|
||||
current_binary+=T$(zstat +mtime $current_binary)
|
||||
if [[ $_mpv_completion_binary[$1] != $current_binary ]]; then
|
||||
# Use PCRE for regular expression matching if possible. This approximately
|
||||
# halves the execution time of generate_arguments compared to the default
|
||||
# POSIX regex, which translates to a more responsive first tab press.
|
||||
# However, we can't rely on PCRE being available, so we keep all our
|
||||
# patterns POSIX-compatible.
|
||||
zmodload -s -F zsh/pcre C:pcre-match && setopt re_match_pcre
|
||||
_mpv_generate_$1
|
||||
_mpv_completion_binary[$1]=$current_binary
|
||||
fi
|
||||
}
|
||||
|
||||
# Only consider generating arguments if the argument being completed looks like
|
||||
# an option. This way, the user should never see a delay when just completing a
|
||||
# filename.
|
||||
if [[ $words[$CURRENT] == -* ]]; then
|
||||
_mpv_generate_if_changed arguments
|
||||
fi
|
||||
|
||||
local rc=1
|
||||
|
||||
_arguments -C -S \*--$_mpv_completion_arguments '*:files:->mfiles' && rc=0
|
||||
|
||||
case $state in
|
||||
|
||||
parse-help-*)
|
||||
local option_name=${state#parse-help-}
|
||||
# Can't do non-capturing groups without pcre, so we index the ones we want
|
||||
local pattern name_group=1 desc_group=2
|
||||
case $option_name in
|
||||
audio-device|vulkan-device)
|
||||
pattern=$'^[ \t]+'\''([^'\'']*)'\'$'[ \t]+''\((.*)\)'
|
||||
;;
|
||||
profile)
|
||||
# The generic pattern would actually work in most cases for --profile,
|
||||
# but would break if a profile name contained spaces. This stricter one
|
||||
# only breaks if a profile name contains tabs.
|
||||
pattern=$'^\t([^\t]*)\t(.*)'
|
||||
;;
|
||||
*)
|
||||
pattern=$'^[ \t]+(--'${option_name}$'=)?([^ \t]+)[ \t]*[-:]?[ \t]*(.*)'
|
||||
name_group=2 desc_group=3
|
||||
;;
|
||||
esac
|
||||
local -a values
|
||||
local current
|
||||
for current in "${(@f)$($~words[1] --${option_name}=help)}"; do
|
||||
[[ $current =~ $pattern ]] || continue;
|
||||
local name=${match[name_group]//:/\\:} desc=${match[desc_group]}
|
||||
if [[ -n $desc ]]; then
|
||||
values+="${name}:${desc}"
|
||||
else
|
||||
values+="${name}"
|
||||
fi
|
||||
done
|
||||
(( $#values )) && {
|
||||
compset -P '*,'
|
||||
compset -S ',*'
|
||||
_describe "$state_descr" values -r ',=: \t\n\-' && rc=0
|
||||
}
|
||||
;;
|
||||
|
||||
files)
|
||||
compset -P '*,'
|
||||
compset -S ',*'
|
||||
_files -r ',/ \t\n\-' && rc=0
|
||||
;;
|
||||
|
||||
mfiles)
|
||||
local expl
|
||||
_tags files urls
|
||||
while _tags; do
|
||||
_requested files expl 'media file' _files && rc=0
|
||||
if _requested urls; then
|
||||
while _next_label urls expl URL; do
|
||||
_urls "$expl[@]" && rc=0
|
||||
_mpv_generate_if_changed protocols
|
||||
compadd -S '' "$expl[@]" $_mpv_completion_protocols && rc=0
|
||||
done
|
||||
fi
|
||||
(( rc )) || return 0
|
||||
done
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
return rc
|
@ -1,72 +0,0 @@
|
||||
#compdef ninja
|
||||
# Copyright 2011 Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Add the following to your .zshrc to tab-complete ninja targets
|
||||
# fpath=(path/to/ninja/misc/zsh-completion $fpath)
|
||||
|
||||
__get_targets() {
|
||||
dir="."
|
||||
if [ -n "${opt_args[-C]}" ];
|
||||
then
|
||||
eval dir="${opt_args[-C]}"
|
||||
fi
|
||||
file="build.ninja"
|
||||
if [ -n "${opt_args[-f]}" ];
|
||||
then
|
||||
eval file="${opt_args[-f]}"
|
||||
fi
|
||||
targets_command="ninja -f \"${file}\" -C \"${dir}\" -t targets all"
|
||||
eval ${targets_command} 2>/dev/null | cut -d: -f1
|
||||
}
|
||||
|
||||
__get_tools() {
|
||||
ninja -t list 2>/dev/null | while read -r a b; do echo $a; done | tail -n +2
|
||||
}
|
||||
|
||||
__get_modes() {
|
||||
ninja -d list 2>/dev/null | while read -r a b; do echo $a; done | tail -n +2 | sed '$d'
|
||||
}
|
||||
|
||||
__modes() {
|
||||
local -a modes
|
||||
modes=(${(fo)"$(__get_modes)"})
|
||||
_describe 'modes' modes
|
||||
}
|
||||
|
||||
__tools() {
|
||||
local -a tools
|
||||
tools=(${(fo)"$(__get_tools)"})
|
||||
_describe 'tools' tools
|
||||
}
|
||||
|
||||
__targets() {
|
||||
local -a targets
|
||||
targets=(${(fo)"$(__get_targets)"})
|
||||
_describe 'targets' targets
|
||||
}
|
||||
|
||||
_arguments \
|
||||
{-h,--help}'[Show help]' \
|
||||
'--version[Print ninja version]' \
|
||||
'-C+[Change to directory before doing anything else]:directories:_directories' \
|
||||
'-f+[Specify input build file (default=build.ninja)]:files:_files' \
|
||||
'-j+[Run N jobs in parallel (default=number of CPUs available)]:number of jobs' \
|
||||
'-l+[Do not start new jobs if the load average is greater than N]:number of jobs' \
|
||||
'-k+[Keep going until N jobs fail (default=1)]:number of jobs' \
|
||||
'-n[Dry run (do not run commands but act like they succeeded)]' \
|
||||
'-v[Show all command lines while building]' \
|
||||
'-d+[Enable debugging (use -d list to list modes)]:modes:__modes' \
|
||||
'-t+[Run a subtool (use -t list to list subtools)]:tools:__tools' \
|
||||
'*::targets:__targets'
|
@ -1,4 +0,0 @@
|
||||
#compdef nvim-env
|
||||
|
||||
local file_name_comp='*: :_files -W ${NVIM_ENVS_DIR} -g "*.norg(:r)" -S " "'
|
||||
_arguments "${file_name_comp}"
|
File diff suppressed because it is too large
Load Diff
@ -1,131 +0,0 @@
|
||||
#compdef passage
|
||||
#autoload
|
||||
|
||||
# Copyright (C) 2012 - 2014:
|
||||
# Johan Venant <jvenant@invicem.pro>
|
||||
# Brian Mattern <rephorm@rephorm.com>
|
||||
# Jason A. Donenfeld <Jason@zx2c4.com>.
|
||||
# All Rights Reserved.
|
||||
# This file is licensed under the GPLv2+. Please see COPYING for more information.
|
||||
|
||||
|
||||
# If you use multiple repositories, you can configure completion like this:
|
||||
#
|
||||
# compdef _passage workpass
|
||||
# zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
|
||||
# workpass() {
|
||||
# PASSAGE_DIR=$HOME/work/pass passage $@
|
||||
# }
|
||||
|
||||
|
||||
_passage () {
|
||||
local cmd
|
||||
if (( CURRENT > 2)); then
|
||||
cmd=${words[2]}
|
||||
# Set the context for the subcommand.
|
||||
curcontext="${curcontext%:*:*}:passage-$cmd"
|
||||
# Narrow the range of words we are looking at to exclude `pass'
|
||||
(( CURRENT-- ))
|
||||
shift words
|
||||
# Run the completion for the subcommand
|
||||
case "${cmd}" in
|
||||
ls|list|edit)
|
||||
_passage_complete_entries_with_subdirs
|
||||
;;
|
||||
insert)
|
||||
_arguments : \
|
||||
"-e[echo password to console]" \
|
||||
"--echo[echo password to console]" \
|
||||
"-m[multiline]" \
|
||||
"--multiline[multiline]"
|
||||
_passage_complete_entries_with_subdirs
|
||||
;;
|
||||
generate)
|
||||
_arguments : \
|
||||
"-n[don't include symbols in password]" \
|
||||
"--no-symbols[don't include symbols in password]" \
|
||||
"-c[copy password to the clipboard]" \
|
||||
"--clip[copy password to the clipboard]" \
|
||||
"-f[force overwrite]" \
|
||||
"--force[force overwrite]" \
|
||||
"-i[replace first line]" \
|
||||
"--in-place[replace first line]"
|
||||
_passage_complete_entries_with_subdirs
|
||||
;;
|
||||
cp|copy|mv|rename)
|
||||
_arguments : \
|
||||
"-f[force rename]" \
|
||||
"--force[force rename]"
|
||||
_passage_complete_entries_with_subdirs
|
||||
;;
|
||||
rm)
|
||||
_arguments : \
|
||||
"-f[force deletion]" \
|
||||
"--force[force deletion]" \
|
||||
"-r[recursively delete]" \
|
||||
"--recursive[recursively delete]"
|
||||
_passage_complete_entries_with_subdirs
|
||||
;;
|
||||
git)
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
"init:Initialize git repository"
|
||||
"push:Push to remote repository"
|
||||
"pull:Pull from remote repository"
|
||||
"config:Show git config"
|
||||
"log:Show git log"
|
||||
"reflog:Show git reflog"
|
||||
)
|
||||
_describe -t commands 'passage git' subcommands
|
||||
;;
|
||||
show|*)
|
||||
_passage_cmd_show
|
||||
;;
|
||||
esac
|
||||
else
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
"ls:List passwords"
|
||||
"find:Find password files or directories based on pattern"
|
||||
"grep:Search inside decrypted password files for matching pattern"
|
||||
"show:Decrypt and print a password"
|
||||
"insert:Insert a new password"
|
||||
"generate:Generate a new password using pwgen"
|
||||
"edit:Edit a password with \$EDITOR"
|
||||
"mv:Rename the password"
|
||||
"cp:Copy the password"
|
||||
"rm:Remove the password"
|
||||
"git:Call git on the password store"
|
||||
"version:Output version information"
|
||||
"help:Output help message"
|
||||
)
|
||||
_describe -t commands 'passage' subcommands
|
||||
_arguments : \
|
||||
"--version[Output version information]" \
|
||||
"--help[Output help message]"
|
||||
_passage_cmd_show
|
||||
fi
|
||||
}
|
||||
|
||||
_passage_cmd_show () {
|
||||
_arguments : \
|
||||
"-c[put it on the clipboard]" \
|
||||
"--clip[put it on the clipboard]"
|
||||
_passage_complete_entries
|
||||
}
|
||||
_passage_complete_entries_helper () {
|
||||
local IFS=$'\n'
|
||||
local prefix
|
||||
zstyle -s ":completion:${curcontext}:" prefix prefix || prefix="${PASSAGE_DIR:-$HOME/.passage/store}"
|
||||
_values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .age-recipients \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.age##' -e 's#\\#\\\\#g' -e 's#:#\\:#g' | sort):-""}
|
||||
}
|
||||
|
||||
_passage_complete_entries_with_subdirs () {
|
||||
_passage_complete_entries_helper
|
||||
}
|
||||
|
||||
_passage_complete_entries () {
|
||||
_passage_complete_entries_helper -type f
|
||||
}
|
||||
|
||||
_passage
|
@ -1,521 +0,0 @@
|
||||
#compdef psql pg_dump pg_dumpall pg_restore createdb dropdb vacuumdb createuser dropuser initdb
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2016 Github zsh-users - http://github.com/zsh-users, Dominic Mitchell, Johann 'Myrkraverk' Oskarsson, Daniel Serodio, J Smith
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for PostgreSQL utils (http://postgresql.org).
|
||||
#
|
||||
# Source: http://www.zsh.org/mla/users/2004/msg01006.html
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Dominic Mitchell <dom+zsh@happygiraffe.net>
|
||||
#
|
||||
# * Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com>
|
||||
#
|
||||
# * Daniel Serodio <dserodio@gmail.com> pg_dumpall completion
|
||||
#
|
||||
# * J Smith <dark.panda@gmail.com> various completion additions
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
_pgsql_get_identity () {
|
||||
_pgsql_user=${(v)opt_args[(i)-U|--username]}
|
||||
_pgsql_port=${(v)opt_args[(i)-p|--port]}
|
||||
_pgsql_host=${(v)opt_args[(i)-h|--host]}
|
||||
|
||||
_pgsql_params=(
|
||||
${_pgsql_user:+"--username=$_pgsql_user"}
|
||||
${_pgsql_port:+"--port=$_pgsql_port"}
|
||||
${_pgsql_host:+"--host=$_pgsql_host"}
|
||||
)
|
||||
}
|
||||
|
||||
# Postgres Allows specifying the path to the directory containing the
|
||||
# socket as well as a hostname.
|
||||
_pgsql_host_or_dir() {
|
||||
_alternative \
|
||||
'hosts:host:_hosts' \
|
||||
'directories:directory:_directories'
|
||||
}
|
||||
|
||||
# This creates a port completion list based on socket files on the
|
||||
# local computer. Be default, Postgres puts them in /tmp/ but Debian
|
||||
# changed that to /var/run/postgresql/ in their packages.
|
||||
_pgsql_ports() {
|
||||
compadd "$@" - /tmp/.s.PGSQL.<->(N:e) /var/run/postgresql/.s.PGSQL.<->(N:e)
|
||||
}
|
||||
|
||||
_pgsql_users () {
|
||||
local _pgsql_user _pgsql_port _pgsql_host _pgsql_params
|
||||
local _pgsql_user_sql
|
||||
_pgsql_get_identity
|
||||
|
||||
# We use _pgsql_port and _pgsql_host directly here instead of
|
||||
# _pgsql_params so as to not pick up a partially completed
|
||||
# username.
|
||||
_pgsql_params=(
|
||||
${_pgsql_port:+"--port=$_pgsql_port"}
|
||||
${_pgsql_host:+"--host=$_pgsql_host"}
|
||||
)
|
||||
|
||||
_pgsql_user_sql='select r.rolname from pg_catalog.pg_roles r where r.rolcanlogin = true'
|
||||
|
||||
compadd "$@" - $( psql $_pgsql_params[@] -XAqt -c $_pgsql_user_sql template1 2>/dev/null )
|
||||
|
||||
}
|
||||
|
||||
_pgsql_tables () {
|
||||
local _pgsql_user _pgsql_port _pgsql_host _pgsql_params
|
||||
_pgsql_get_identity
|
||||
|
||||
# Need to pull out the database name from the existing arguments.
|
||||
# This is going to vary between commands. Thankfully, it's only
|
||||
# used by pg_dump, which always has the dbname in arg1. If it's
|
||||
# not present it defaults to ${PGDATABASE:-$LOGNAME}, which
|
||||
# matches (I think) the PostgreSQL behaviour.
|
||||
|
||||
local db
|
||||
db=${line[1]:-${PGDATABASE:-$LOGNAME}}
|
||||
|
||||
## Instead of parsing the output of the psql \ commands, we look
|
||||
## up the tables ourselves. The following query has been tested
|
||||
## with Postgres 8.2 - 9.2.
|
||||
|
||||
local _pgsql_table_sql
|
||||
_pgsql_table_sql="select n.nspname || '.' || c.relname \
|
||||
from pg_catalog.pg_class c \
|
||||
left join pg_catalog.pg_namespace n on n.oid = c.relnamespace \
|
||||
where c.relkind in ('r', '') \
|
||||
and n.nspname <> 'pg_catalog' \
|
||||
and n.nspname <> 'information_schema' \
|
||||
and n.nspname !~ '^pg_toast' \
|
||||
and pg_catalog.pg_table_is_visible( c.oid ) \
|
||||
order by 1"
|
||||
|
||||
compadd "$@" - \
|
||||
$( psql $_pgsql_params[@] -AXqt -c $_pgsql_table_sql $db 2>/dev/null )
|
||||
}
|
||||
|
||||
_pgsql_schemas () {
|
||||
local _pgsql_user _pgsql_port _pgsql_host _pgsql_params
|
||||
_pgsql_get_identity
|
||||
|
||||
local db
|
||||
db=${line[1]:-${PGDATABASE:-$LOGNAME}}
|
||||
|
||||
local _pgsql_schema_sql="select n.nspname \
|
||||
from pg_catalog.pg_namespace n \
|
||||
where n.nspname !~ '^pg_' \
|
||||
and n.nspname <> 'information_schema' \
|
||||
order by 1;"
|
||||
|
||||
compadd "$@" - \
|
||||
$( psql $_pgsql_params[@] -AXqt -c $_pgsql_schema_sql $db 2>/dev/null )
|
||||
}
|
||||
|
||||
_pgsql_databases () {
|
||||
local _pgsql_user _pgsql_port _pgsql_host _pgsql_params
|
||||
_pgsql_get_identity
|
||||
|
||||
local _pgsql_services _pgsql_service_files
|
||||
_pgsql_service_files=(~/.pg_service.conf)
|
||||
(( $+commands[pg_config] )) && _pgsql_service_files+=$(pg_config --sysconfdir)/pg_service.conf
|
||||
|
||||
_pgsql_services=$( grep -h '^\[.*\]' $_pgsql_service_files 2>/dev/null \
|
||||
| sed -e 's/^\[/service=/' -e 's/\].*$//' )
|
||||
|
||||
local _pgsql_db_sql
|
||||
_pgsql_db_sql="select d.datname from pg_catalog.pg_database d \
|
||||
where d.datname <> 'template0'"
|
||||
|
||||
compadd "$@" - \
|
||||
${(f)_pgsql_services} \
|
||||
$( psql $_pgsql_params[@] -AXtq -c $_pgsql_db_sql template1 2>/dev/null )
|
||||
}
|
||||
|
||||
_pgsql_encodings () {
|
||||
local _pgsql_user
|
||||
_pgsql_get_identity
|
||||
|
||||
local _pgsql_db_sql
|
||||
_pgsql_db_sql="select pg_encoding_to_char(i) from generate_series(0,100) i;"
|
||||
|
||||
compadd "$@" - $( psql $_pgsql_params[@] -AXtq -c $_pgsql_db_sql template1 )
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
## The actual completion code for the commands
|
||||
##
|
||||
|
||||
_psql () {
|
||||
local curcontext="$curcontext" state line expl
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C -s "-*" \
|
||||
"$_pgsql_common_opts[@]" \
|
||||
{-V,--version}'[display client version]' \
|
||||
{-a,--echo-all}'[print commands read]' \
|
||||
{-A,--no-align}'[unaligned output mode]' \
|
||||
{-c+,--command=}':execute SQL command:' \
|
||||
{-d+,--dbname=}':database to connect to:_pgsql_databases' \
|
||||
{-b,--echo-errors}'[echo failed commands]' \
|
||||
{-e,--echo-queries}'[display queries submitted]' \
|
||||
{-E,--echo-hidden}'[display hidden queries]' \
|
||||
{-L,--log-file=}'[send session log to file]' \
|
||||
{-n,--no-readline}'[disable enhanced command line editing (readline)]' \
|
||||
{-f+,--file=}':SQL file to read:_files' \
|
||||
{-F+,--field-separator=}':field separator char:' \
|
||||
{-H,--html}'[HTML output]' \
|
||||
{-l,--list}'[list databases]' \
|
||||
{-o+,--output=}':query output:_files' \
|
||||
{-P+,--pset=}':set psql variable:' \
|
||||
{-q,--quiet}'[non verbose mode]' \
|
||||
{-R+,--record-separator=}':record separator char:' \
|
||||
{-s,--single-step}'[prompt before each query]' \
|
||||
{-S,--single-line}'[newline sends query]' \
|
||||
{-t,--tuples-only}'[don'\''t display header/footer]' \
|
||||
{-T+,--table-attr=}':HTML table options:' \
|
||||
-u'[prompt for username/password]' \
|
||||
{-v+,--set=,--variable=}':set SQL variable:' \
|
||||
{-x,--expanded}'[one column per line]' \
|
||||
{-z,--field-separator-zero}'[set field separator for unaligned output to zero byte]' \
|
||||
{-0,--record-separator-zero}'[set record separator for unaligned output to zero byte]' \
|
||||
{-X,--no-psqlrc}'[don'\''t read ~/.psqlrc]' \
|
||||
':PostgreSQL database:_pgsql_databases' \
|
||||
':PostgreSQL user:_pgsql_users'
|
||||
}
|
||||
|
||||
_pg_dump () {
|
||||
local curcontext="$curcontext" state line expl
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C -s \
|
||||
"$_pgsql_common_opts[@]" \
|
||||
{-a,--data-only}'[dump only data]' \
|
||||
{-b,--blobs}'[dump blobs as well]' \
|
||||
{-c,--clean}'[include clean cmds in dump]' \
|
||||
{-C,--create}'[include createdb cmds in dump]' \
|
||||
{-E+,--encoding=}':database encoding:_pgsql_encodings' \
|
||||
{-d,--inserts}'[use INSERT not COPY]' \
|
||||
{-D,--{attribute,column}-inserts}'[use INSERT (cols) not COPY]' \
|
||||
{-f+,--file=}':output file:_files' \
|
||||
{-F+,--format=}':output format:_values "format" "p[plain text]" "t[tar]" "c[custom]"' \
|
||||
{-j,--jobs=}'[use this many parallel jobs to dump]' \
|
||||
{-i,--ignore-version}'[ignore version mismatch]' \
|
||||
{-n+,--schema=}':schema to dump:_pgsql_schemas' \
|
||||
{-N+,--exclude-schema=}':schema to NOT dump:_pgsql_schemas' \
|
||||
{-o,--oids}'[dump objects identifiers for every table]' \
|
||||
{-O,--no-owner}'[don'\''t recreate as same owner]' \
|
||||
{-R,--no-reconnect}'[don'\''t output connect]' \
|
||||
{-s,--schema-only}'[no data, only schema]' \
|
||||
{-S+,--superuser=}':superuser name:_pgsql_users' \
|
||||
{-t+,--table=}':table to dump:_pgsql_tables' \
|
||||
{-T+,--exclude-table=}':table to NOT dump:_pgsql_tables' \
|
||||
{-v,--verbose}'[verbose mode]' \
|
||||
{-V,--version}'[display client version]' \
|
||||
{-x,--no-{acl,privileges}}'[don'\''t dump ACLs]' \
|
||||
-X+':option:_values "option" use-set-session-authorization disable-triggers' \
|
||||
{-Z+,--compress=}':compression level:_values "level" 9 8 7 6 5 4 3 2 1 0' \
|
||||
':PostgreSQL database:_pgsql_databases' \
|
||||
--section=':dump named section:_values "section" pre-data data post-data' \
|
||||
--binary-upgrade'[for use by upgrade utilities only]' \
|
||||
--column-inserts'[dump data as INSERT commands with column names]' \
|
||||
--disable-dollar-quoting'[disable dollar quoting, use SQL standard quoting]' \
|
||||
--disable-triggers'[disable triggers during data-only restore]' \
|
||||
--enable-row-security'[enable row security (dump only content user has access to)]' \
|
||||
--exclude-table-data='[do NOT dump data for the named table(s)]' \
|
||||
--if-exists'[use IF EXISTS when dropping objects]' \
|
||||
--inserts'[dump data as INSERT commands, rather than COPY]' \
|
||||
--lock-wait-timeout='[fail after waiting TIMEOUT for a table lock]' \
|
||||
--load-via-partition-root'[load partitions via the root table]' \
|
||||
--no-comments'[do not dump comments]' \
|
||||
--no-publications'[do not dump publications]' \
|
||||
--no-security-labels'[do not dump security label assignments]' \
|
||||
--no-synchronized-snapshots'[do not use synchronized snapshots in parallel jobs]' \
|
||||
--no-tablespaces'[do not dump tablespace assignments]' \
|
||||
--no-unlogged-table-data'[do not dump unlogged table data]' \
|
||||
--on-conflict-do-nothing'[add ON CONFLICT DO NOTHING to INSERT commands]' \
|
||||
--quote-all-identifiers'[quote all identifiers, even if not key words]' \
|
||||
--serializable-deferrable'[wait until the dump can run without anomalies]' \
|
||||
--snapshot='[use given snapshot for the dump]' \
|
||||
--strict-names'[require table and/or schema include patterns to match at least one entity each]' \
|
||||
--use-set-session-authorization'[use SET SESSION AUTHORIZATION commands instead of ALTER OWNER]'
|
||||
}
|
||||
|
||||
_pg_restore () {
|
||||
local curcontext="$curcontext" state line expl
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C -s \
|
||||
"$_pgsql_common_opts[@]" \
|
||||
{-d+,--dbname=}':database to connect to:_pgsql_databases' \
|
||||
{-f+,--file=}':output file:_files' \
|
||||
{-F+,--format=}':output format:_values "format" "p[plain text]" "t[tar]" "c[custom]"' \
|
||||
{-l,--list}'[list databases]' \
|
||||
{-a,--data-only}'[dump only data]' \
|
||||
{-b,--blobs}'[include large objects in dump]' \
|
||||
{-B,--no-blobs}'[exclude large objects in dump]' \
|
||||
{-c,--clean}'[include clean (drop) cmds before recreating]' \
|
||||
{-C,--create}'[include createdb cmds in dump]' \
|
||||
{-e,--exit-on-error}'[exit on error, default is to continue]' \
|
||||
{-I,--index=}':index name:' \
|
||||
{-j,--jobs=}':use this many parallel jobs to restore:' \
|
||||
{-L,--use-list=}':use table of contents from this file for selecting/ordering output:' \
|
||||
{-n,--schema=}':restore only objects in this schema:' \
|
||||
{-O,--no-owner}'[skip restoration of object ownership]' \
|
||||
{-P,--function=}':restore named function:' \
|
||||
{-s,--schema-only}'[restore only the schema, no data]' \
|
||||
{-S,--superuser=}':superuser user name to use for disabling triggers:' \
|
||||
{-t,--table=}':restore named table:' \
|
||||
{-T,--trigger=}':restore named trigger:' \
|
||||
{-x,--no-privileges}'[skip restoration of access privileges (grant/revoke)]' \
|
||||
{-1,--single-transaction}'[restore as a single transaction]' \
|
||||
{-v,--verbose}'[verbose mode]' \
|
||||
{-V,--version}'[display client version]' \
|
||||
--disable-triggers'[disable triggers during data-only restore]' \
|
||||
--enable-row-security'[enable row security]' \
|
||||
--if-exists'[use IF EXISTS when dropping objects]' \
|
||||
--no-comments'[do not restore comments]' \
|
||||
--no-data-for-failed-tables'[do not restore data of tables that could not be created]' \
|
||||
--no-publications'[do not restore publications]' \
|
||||
--no-security-labels'[do not restore security labels]' \
|
||||
--no-subscriptions'[do not restore subscriptions]' \
|
||||
--no-tablespaces'[do not restore tablespace assignments]' \
|
||||
--section=':dump named section:_values "section" pre-data data post-data' \
|
||||
--use-set-session-authorization'[use SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to set ownership]' \
|
||||
"1: :_files"
|
||||
}
|
||||
|
||||
_pg_dumpall () {
|
||||
local curcontext="$curcontext" state line expl
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C -s \
|
||||
"$_pgsql_common_opts[@]" \
|
||||
{-a,--data-only}'[dump only data]' \
|
||||
{-c,--clean}'[include clean (drop) cmds before recreating]' \
|
||||
{-g,--globals-only}'[dump only global objects, no databases]' \
|
||||
{-f+,--file=}':output file:_files' \
|
||||
{-o,--oids}'[dump objects identifiers for every table]' \
|
||||
{-O,--no-owner}'[don'\''t recreate as same owner]' \
|
||||
{-r,--roles-only}'[no databases or tablespaces, only roles]' \
|
||||
{-s,--schema-only}'[no data, only schema]' \
|
||||
{-S+,--superuser=}':superuser name:_pgsql_users' \
|
||||
{-t,--tablespaces-only}'[no databases or roles, only tablespaces]' \
|
||||
{-x,--no-privileges}'[don'\''t dump ACLs]' \
|
||||
--binary-upgrade'[for use by upgrade utilities only]' \
|
||||
--column-inserts'[use INSERT with column names not COPY]' \
|
||||
--disable-dollar-quoting'[disable dollar quoting, use SQL standard quoting]' \
|
||||
--disable-triggers'[disable triggers during data-only restore]' \
|
||||
--inserts'[use INSERT not COPY]' \
|
||||
--no-security-labels'[do not dump security label assignments]' \
|
||||
--no-tablespaces'[do not dump tablespace assignments]' \
|
||||
--no-unlogged-table-data'[do not dump unlogged table data]' \
|
||||
--quote-all-identifiers'[quote all identifiers, even if not key words]' \
|
||||
--use-set-session-authorization'[use SET SESSION AUTHORIZATION cmds instead of ALTER OWNER]'
|
||||
}
|
||||
|
||||
_createdb () {
|
||||
local curcontext="$curcontext" state line expl
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C -s \
|
||||
"$_pgsql_common_opts[@]" \
|
||||
{-e,--echo}'[display SQL queries]' \
|
||||
{-q,--quiet}'[non verbose mode]' \
|
||||
{-D+,--location=}':database location:_directories' \
|
||||
{-T+,--template=}':database template:_pgsql_databases' \
|
||||
{-E+,--encoding=}':database encoding:_pgsql_encodings' \
|
||||
':PostgreSQL database:' \
|
||||
':comment:'
|
||||
}
|
||||
|
||||
_dropdb () {
|
||||
local curcontext="$curcontext" state line expl
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C -s \
|
||||
"$_pgsql_common_opts[@]" \
|
||||
{-e,--echo}'[display SQL queries]' \
|
||||
{-q,--quiet}'[non verbose mode]' \
|
||||
{-i,--interactive}'[confirm before drop]' \
|
||||
':PostgreSQL database:_pgsql_databases'
|
||||
}
|
||||
|
||||
_vacuumdb () {
|
||||
local curcontext="$curcontext" state line expl
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C -s \
|
||||
"$_pgsql_common_opts[@]" \
|
||||
{-a,--all}'[vacuum all databases]' \
|
||||
{-d+,--dbname=}':database to connect to:_pgsql_databases' \
|
||||
{-t+,--table=}':table to dump:_pgsql_tables' \
|
||||
{-f,--full}'[do full vacuuming]' \
|
||||
{-z,--analyze}'[update optimizer hints]' \
|
||||
{-Z,--analyze-only}'[only update optimizer statistics; no vacuum]' \
|
||||
{-e,--echo}'[show the commands being sent to the server]' \
|
||||
{-q,--quiet}'[do not write any messages]' \
|
||||
{-v,--verbose}'[write a lot of output]' \
|
||||
'--min-mxid-age=[minimum multixact ID age of tables to vacuum]' \
|
||||
'--min-xid-age=[minimum transaction ID age of tables to vacuum]' \
|
||||
'--skip-locked[skip relations that cannot be immediately locked]' \
|
||||
'--analyze-in-stages[only update optimizer statistics, in multiple]' \
|
||||
'--help[show this help, then exit]' \
|
||||
'--version[output version information, then exit]' \
|
||||
'--maintenance-db=[alternate maintenance database]' \
|
||||
'1:PostgreSQL database:_pgsql_databases'
|
||||
}
|
||||
|
||||
_createuser () {
|
||||
local curcontext="$curcontext" state line expl
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C -s \
|
||||
"$_pgsql_common_opts[@]" \
|
||||
{-e,--echo}'[display SQL queries]' \
|
||||
{-c,--connection-limit=}'[connection limit for role (default: no limit)]' \
|
||||
{-d,--createdb}'[role can create new databases]' \
|
||||
{-D,--no-createdb}'[role cannot create databases]' \
|
||||
{-E,--encrypted}'[encrypt stored password]' \
|
||||
{-g,--role=}'[new role will be a member of this role]' \
|
||||
{-i,--inherit}'[role inherits privileges of roles it is a member of (default)]' \
|
||||
{-I,--no-inherit}'[role does not inherit privileges]' \
|
||||
{-l,--login}'[role can login (default)]' \
|
||||
{-L,--no-login}'[role cannot login]' \
|
||||
{-N,--unencrypted}'[do not encrypt stored password]' \
|
||||
{-P,--pwprompt}'[assign a password to new role]' \
|
||||
{-r,--createrole}'[role can create new roles]' \
|
||||
{-R,--no-createrole}'[role cannot create roles]' \
|
||||
{-s,--superuser}'[role will be superuser]' \
|
||||
{-S,--no-superuser}'[role will not be superuser]' \
|
||||
--interactive'[prompt for missing role name and attributes rather than using defaults]' \
|
||||
--replication'[role can initiate replication]' \
|
||||
--no-replication'[role cannot initiate replication]' \
|
||||
}
|
||||
|
||||
_dropuser () {
|
||||
local curcontext="$curcontext" state line expl
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C -s \
|
||||
"$_pgsql_common_opts[@]" \
|
||||
{-e,--echo}'[display SQL queries]' \
|
||||
{-q,--quiet}'[non verbose mode]' \
|
||||
{-i,--interactive}'[prompt before deleting anything, and prompt for role name if not specified]' \
|
||||
':PostgreSQL user:_pgsql_users'
|
||||
}
|
||||
|
||||
_initdb () {
|
||||
local curcontext="$curcontext" state line expl
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C -s \
|
||||
{--auth=,-A+}':default authentication method for local connections:_values "auth methods" $_pgsql_auth_methods[@]' \
|
||||
--auth-host=':default authentication method for local TCP/IP connections:_values "auth methods" $_pgsql_auth_methods[@]' \
|
||||
--auth-local=':default authentication method for local-socket connections:_values "auth methods" $_pgsql_auth_methods[@]' \
|
||||
{-D+,--pgdata=}':location for this database cluster:_files' \
|
||||
{-E+,--encoding=}':set default encoding for new databases:' \
|
||||
--locale=':set default locale for new databases:' \
|
||||
--lc-collate=':set the default locale for collate:' \
|
||||
--lc-ctype=':set the default locale for ctype:' \
|
||||
--lc-messages=':set the default locale for messages:' \
|
||||
--lc-monetary=':set the default locale for monetary:' \
|
||||
--lc-numeric=':set the default locale for numeric:' \
|
||||
--lc-time=':set the default local for time:' \
|
||||
--no-locale'[equivalent to --locale=C]' \
|
||||
--pwfile=':read password for the new superuser from file:_files' \
|
||||
{-T+,--text-search-config=}'[default text search configuration]' \
|
||||
{-U+,--username=NAME}':database superuser name:' \
|
||||
{-W,--pwprompt}'[prompt for a password for the new superuser]' \
|
||||
{-X+,--xlogdir=}':location for the transaction log directory:_files' \
|
||||
{-d,--debug}'[generate lots of debugging output]' \
|
||||
-L+':where to find the input files:_files' \
|
||||
{-k,--data-checksums}':use data page checksums:' \
|
||||
{-n,--noclean}'[do not clean up after errors]' \
|
||||
{-N,--nosync}':do not wait for changes to be written safely to disk:' \
|
||||
{-s,--show}'[show internal settings]' \
|
||||
{-S,--sync-only}'[only sync data directory]' \
|
||||
':location for this database cluster:_files'
|
||||
}
|
||||
|
||||
_pgsql_utils () {
|
||||
local _pgsql_common_opts _pgsql_auth_methods
|
||||
|
||||
_pgsql_common_opts=(
|
||||
{-\?,--help}'[display help]'
|
||||
{-h+,--host=}':database host:_pgsql_host_or_dir'
|
||||
{-p+,--port=}':database port number:_pgsql_ports'
|
||||
{-U+,--username=}':connect as user:_pgsql_users'
|
||||
{-W,--password}'[prompt for password]'
|
||||
--role='[do SET ROLE before restore]'
|
||||
)
|
||||
|
||||
_pgsql_auth_methods=(
|
||||
trust
|
||||
reject
|
||||
md5
|
||||
password
|
||||
gss
|
||||
sspi
|
||||
krb5
|
||||
ident
|
||||
peer
|
||||
ldap
|
||||
radius
|
||||
cert
|
||||
pam
|
||||
)
|
||||
|
||||
case "$service" in
|
||||
psql) _psql "$@" ;;
|
||||
pg_dump) _pg_dump "$@" ;;
|
||||
pg_restore) _pg_restore "$@" ;;
|
||||
createdb) _createdb "$@" ;;
|
||||
dropdb) _dropdb "$@" ;;
|
||||
vacuumdb) _vacuumdb "$@" ;;
|
||||
createuser) _createuser "$@" ;;
|
||||
dropuser) _dropuser "$@" ;;
|
||||
initdb) _initdb "$@" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
_pgsql_utils "$@"
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
@ -1,197 +0,0 @@
|
||||
#compdef poetry
|
||||
|
||||
_poetry_5acd8debc5f3f55a_complete()
|
||||
{
|
||||
local state com cur
|
||||
local -a opts
|
||||
local -a coms
|
||||
|
||||
cur=${words[${#words[@]}]}
|
||||
|
||||
# lookup for command
|
||||
for word in ${words[@]:1}; do
|
||||
if [[ $word != -* ]]; then
|
||||
com=$word
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${cur} == --* ]]; then
|
||||
state="option"
|
||||
opts+=("--ansi:Force ANSI output." "--directory:The working directory for the Poetry command \(defaults to the current working directory\)." "--help:Display help for the given command. When no command is given display help for the list command." "--no-ansi:Disable ANSI output." "--no-cache:Disables Poetry source caches." "--no-interaction:Do not ask any interactive question." "--no-plugins:Disables plugins." "--quiet:Do not output any message." "--verbose:Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug." "--version:Display this application version.")
|
||||
elif [[ $cur == $com ]]; then
|
||||
state="command"
|
||||
coms+=("about:Shows information about Poetry." "add:Adds a new dependency to pyproject.toml." "build:Builds a package, as a tarball and a wheel by default." "'cache clear':Clears a Poetry cache by name." "'cache list':List Poetry\'s caches." "check:Checks the validity of the pyproject.toml file." "config:Manages configuration settings." "'debug info':Shows debug information." "'debug resolve':Debugs dependency resolution." "'env info':Displays information about the current environment." "'env list':Lists all virtualenvs associated with the current project." "'env remove':Remove virtual environments associated with the project." "'env use':Activates or creates a new virtualenv for the current project." "export:Exports the lock file to alternative formats." "help:Displays help for a command." "init:Creates a basic pyproject.toml file in the current directory." "install:Installs the project dependencies." "list:Lists commands." "lock:Locks the project dependencies." "new:Creates a new Python project at <path\>." "publish:Publishes a package to a remote repository." "remove:Removes a package from the project dependencies." "run:Runs a command in the appropriate environment." "search:Searches for packages on remote repositories." "'self add':Add additional packages to Poetry\'s runtime environment." "'self install':Install locked packages \(incl. addons\) required by this Poetry installation." "'self lock':Lock the Poetry installation\'s system requirements." "'self remove':Remove additional packages from Poetry\'s runtime environment." "'self show':Show packages from Poetry\'s runtime environment." "'self show plugins':Shows information about the currently installed plugins." "'self update':Updates Poetry to the latest version." "shell:Spawns a shell within the virtual environment." "show:Shows information about packages." "'source add':Add source configuration for project." "'source remove':Remove source configured for the project." "'source show':Show information about sources configured for the project." "update:Update the dependencies as according to the pyproject.toml file." "version:Shows the version of the project or bumps it when a valid bump rule is provided.")
|
||||
fi
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
_describe 'command' coms
|
||||
;;
|
||||
(option)
|
||||
case "$com" in
|
||||
|
||||
(about)
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
(add)
|
||||
opts+=("--allow-prereleases:Accept prereleases." "--dev:Add as a development dependency. \(Deprecated\)" "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--editable:Add vcs/path dependencies as editable." "--extras:Extras to activate for the dependency." "--group:The group to add the dependency to." "--lock:Do not perform operations \(only update the lockfile\)." "--optional:Add as an optional dependency." "--platform:Platforms for which the dependency must be installed." "--python:Python version for which the dependency must be installed." "--source:Name of the source to use to install the package.")
|
||||
;;
|
||||
|
||||
(build)
|
||||
opts+=("--format:Limit the format to either sdist or wheel.")
|
||||
;;
|
||||
|
||||
('cache clear')
|
||||
opts+=("--all:Clear all entries in the cache.")
|
||||
;;
|
||||
|
||||
('cache list')
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
(check)
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
(config)
|
||||
opts+=("--list:List configuration settings." "--local:Set/Get from the project\'s local configuration." "--unset:Unset configuration setting.")
|
||||
;;
|
||||
|
||||
('debug info')
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
('debug resolve')
|
||||
opts+=("--extras:Extras to activate for the dependency." "--install:Show what would be installed for the current system." "--python:Python version\(s\) to use for resolution." "--tree:Display the dependency tree.")
|
||||
;;
|
||||
|
||||
('env info')
|
||||
opts+=("--path:Only display the environment\'s path.")
|
||||
;;
|
||||
|
||||
('env list')
|
||||
opts+=("--full-path:Output the full paths of the virtualenvs.")
|
||||
;;
|
||||
|
||||
('env remove')
|
||||
opts+=("--all:Remove all managed virtual environments associated with the project.")
|
||||
;;
|
||||
|
||||
('env use')
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
(export)
|
||||
opts+=("--dev:Include development dependencies. \(Deprecated\)" "--extras:Extra sets of dependencies to include." "--format:Format to export to. Currently, only constraints.txt and requirements.txt are supported." "--only:The only dependency groups to include." "--output:The name of the output file." "--with:The optional dependency groups to include." "--with-credentials:Include credentials for extra indices." "--without:The dependency groups to ignore." "--without-hashes:Exclude hashes from the exported file." "--without-urls:Exclude source repository urls from the exported file.")
|
||||
;;
|
||||
|
||||
(help)
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
(init)
|
||||
opts+=("--author:Author name of the package." "--dependency:Package to require, with an optional version constraint, e.g. requests:\^2.10.0 or requests=2.11.1." "--description:Description of the package." "--dev-dependency:Package to require for development, with an optional version constraint, e.g. requests:\^2.10.0 or requests=2.11.1." "--license:License of the package." "--name:Name of the package." "--python:Compatible Python versions.")
|
||||
;;
|
||||
|
||||
(install)
|
||||
opts+=("--all-extras:Install all extra dependencies." "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--extras:Extra sets of dependencies to install." "--no-dev:Do not install the development dependencies. \(Deprecated\)" "--no-root:Do not install the root package \(the current project\)." "--only:The only dependency groups to include." "--only-root:Exclude all dependencies." "--remove-untracked:Removes packages not present in the lock file. \(Deprecated\)" "--sync:Synchronize the environment with the locked packages and the specified groups." "--with:The optional dependency groups to include." "--without:The dependency groups to ignore.")
|
||||
;;
|
||||
|
||||
(list)
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
(lock)
|
||||
opts+=("--check:Check that the poetry.lock file corresponds to the current version of pyproject.toml." "--no-update:Do not update locked versions, only refresh lock file.")
|
||||
;;
|
||||
|
||||
(new)
|
||||
opts+=("--name:Set the resulting package name." "--readme:Specify the readme file format. One of md \(default\) or rst" "--src:Use the src layout for the project.")
|
||||
;;
|
||||
|
||||
(publish)
|
||||
opts+=("--build:Build the package before publishing." "--cert:Certificate authority to access the repository." "--client-cert:Client certificate to access the repository." "--dry-run:Perform all actions except upload the package." "--password:The password to access the repository." "--repository:The repository to publish the package to." "--skip-existing:Ignore errors from files already existing in the repository." "--username:The username to access the repository.")
|
||||
;;
|
||||
|
||||
(remove)
|
||||
opts+=("--dev:Remove a package from the development dependencies. \(Deprecated\)" "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--group:The group to remove the dependency from.")
|
||||
;;
|
||||
|
||||
(run)
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
(search)
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
('self add')
|
||||
opts+=("--allow-prereleases:Accept prereleases." "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--editable:Add vcs/path dependencies as editable." "--extras:Extras to activate for the dependency." "--source:Name of the source to use to install the package.")
|
||||
;;
|
||||
|
||||
('self install')
|
||||
opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--sync:Synchronize the environment with the locked packages and the specified groups.")
|
||||
;;
|
||||
|
||||
('self lock')
|
||||
opts+=("--check:Check that the poetry.lock file corresponds to the current version of pyproject.toml." "--no-update:Do not update locked versions, only refresh lock file.")
|
||||
;;
|
||||
|
||||
('self remove')
|
||||
opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\).")
|
||||
;;
|
||||
|
||||
('self show')
|
||||
opts+=("--addons:List only add-on packages installed." "--latest:Show the latest version." "--outdated:Show the latest version but only for packages that are outdated." "--tree:List the dependencies as a tree.")
|
||||
;;
|
||||
|
||||
('self show plugins')
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
('self update')
|
||||
opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--preview:Allow the installation of pre-release versions.")
|
||||
;;
|
||||
|
||||
(shell)
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
(show)
|
||||
opts+=("--all:Show all packages \(even those not compatible with current system\)." "--latest:Show the latest version." "--no-dev:Do not list the development dependencies. \(Deprecated\)" "--only:The only dependency groups to include." "--outdated:Show the latest version but only for packages that are outdated." "--tree:List the dependencies as a tree." "--why:When showing the full list, or a --tree for a single package, also display why it\'s included." "--with:The optional dependency groups to include." "--without:The dependency groups to ignore.")
|
||||
;;
|
||||
|
||||
('source add')
|
||||
opts+=("--default:Set this source as the default \(disable PyPI\). A default source will also be the fallback source if you add other sources." "--secondary:Set this source as secondary.")
|
||||
;;
|
||||
|
||||
('source remove')
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
('source show')
|
||||
opts+=()
|
||||
;;
|
||||
|
||||
(update)
|
||||
opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--lock:Do not perform operations \(only update the lockfile\)." "--no-dev:Do not update the development dependencies. \(Deprecated\)" "--only:The only dependency groups to include." "--with:The optional dependency groups to include." "--without:The dependency groups to ignore.")
|
||||
;;
|
||||
|
||||
(version)
|
||||
opts+=("--dry-run:Do not update pyproject.toml file" "--short:Output the version number only")
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
_describe 'option' opts
|
||||
;;
|
||||
*)
|
||||
# fallback to file completion
|
||||
_arguments '*:file:_files'
|
||||
esac
|
||||
}
|
||||
|
||||
_poetry_5acd8debc5f3f55a_complete "$@"
|
||||
compdef _poetry_5acd8debc5f3f55a_complete /home/sam/.local/share/poetry/venv/bin/poetry
|
@ -1,647 +0,0 @@
|
||||
#compdef rg
|
||||
|
||||
##
|
||||
# zsh completion function for ripgrep
|
||||
#
|
||||
# Run ci/test-complete after building to ensure that the options supported by
|
||||
# this function stay in synch with the `rg` binary.
|
||||
#
|
||||
# For convenience, a completion reference guide is included at the bottom of
|
||||
# this file.
|
||||
#
|
||||
# Originally based on code from the zsh-users project — see copyright notice
|
||||
# below.
|
||||
|
||||
_rg() {
|
||||
local curcontext=$curcontext no='!' descr ret=1
|
||||
local -a context line state state_descr args tmp suf
|
||||
local -A opt_args
|
||||
|
||||
# ripgrep has many options which negate the effect of a more common one — for
|
||||
# example, `--no-column` to negate `--column`, and `--messages` to negate
|
||||
# `--no-messages`. There are so many of these, and they're so infrequently
|
||||
# used, that some users will probably find it irritating if they're completed
|
||||
# indiscriminately, so let's not do that unless either the current prefix
|
||||
# matches one of those negation options or the user has the `complete-all`
|
||||
# style set. Note that this prefix check has to be updated manually to account
|
||||
# for all of the potential negation options listed below!
|
||||
if
|
||||
# We also want to list all of these options during testing
|
||||
[[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] ||
|
||||
# (--[imnp]* => --ignore*, --messages, --no-*, --pcre2-unicode)
|
||||
[[ $PREFIX$SUFFIX == --[imnp]* ]] ||
|
||||
zstyle -t ":completion:${curcontext}:" complete-all
|
||||
then
|
||||
no=
|
||||
fi
|
||||
|
||||
# We make heavy use of argument groups here to prevent the option specs from
|
||||
# growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip
|
||||
# them out below if necessary. This makes the exclusions inaccurate on those
|
||||
# older versions, but oh well — it's not that big a deal
|
||||
args=(
|
||||
+ '(exclusive)' # Misc. fully exclusive options
|
||||
'(: * -)'{-h,--help}'[display help information]'
|
||||
'(: * -)'{-V,--version}'[display version information]'
|
||||
'(: * -)'--pcre2-version'[print the version of PCRE2 used by ripgrep, if available]'
|
||||
|
||||
+ '(buffered)' # buffering options
|
||||
'--line-buffered[force line buffering]'
|
||||
$no"--no-line-buffered[don't force line buffering]"
|
||||
'--block-buffered[force block buffering]'
|
||||
$no"--no-block-buffered[don't force block buffering]"
|
||||
|
||||
+ '(case)' # Case-sensitivity options
|
||||
{-i,--ignore-case}'[search case-insensitively]'
|
||||
{-s,--case-sensitive}'[search case-sensitively]'
|
||||
{-S,--smart-case}'[search case-insensitively if pattern is all lowercase]'
|
||||
|
||||
+ '(context-a)' # Context (after) options
|
||||
'(context-c)'{-A+,--after-context=}'[specify lines to show after each match]:number of lines'
|
||||
|
||||
+ '(context-b)' # Context (before) options
|
||||
'(context-c)'{-B+,--before-context=}'[specify lines to show before each match]:number of lines'
|
||||
|
||||
+ '(context-c)' # Context (combined) options
|
||||
'(context-a context-b)'{-C+,--context=}'[specify lines to show before and after each match]:number of lines'
|
||||
|
||||
+ '(column)' # Column options
|
||||
'--column[show column numbers for matches]'
|
||||
$no"--no-column[don't show column numbers for matches]"
|
||||
|
||||
+ '(count)' # Counting options
|
||||
{-c,--count}'[only show count of matching lines for each file]'
|
||||
'--count-matches[only show count of individual matches for each file]'
|
||||
'--include-zero[include files with zero matches in summary]'
|
||||
|
||||
+ '(encoding)' # Encoding options
|
||||
{-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings'
|
||||
$no'--no-encoding[use default text encoding]'
|
||||
|
||||
+ '(engine)' # Engine choice options
|
||||
'--engine=[select which regex engine to use]:when:((
|
||||
default\:"use default engine"
|
||||
pcre2\:"identical to --pcre2"
|
||||
auto\:"identical to --auto-hybrid-regex"
|
||||
))'
|
||||
|
||||
+ file # File-input options
|
||||
'(1)*'{-f+,--file=}'[specify file containing patterns to search for]: :_files'
|
||||
|
||||
+ '(file-match)' # Files with/without match options
|
||||
'(stats)'{-l,--files-with-matches}'[only show names of files with matches]'
|
||||
'(stats)--files-without-match[only show names of files without matches]'
|
||||
|
||||
+ '(file-name)' # File-name options
|
||||
{-H,--with-filename}'[show file name for matches]'
|
||||
{-I,--no-filename}"[don't show file name for matches]"
|
||||
|
||||
+ '(file-system)' # File system options
|
||||
"--one-file-system[don't descend into directories on other file systems]"
|
||||
$no'--no-one-file-system[descend into directories on other file systems]'
|
||||
|
||||
+ '(fixed)' # Fixed-string options
|
||||
{-F,--fixed-strings}'[treat pattern as literal string instead of regular expression]'
|
||||
$no"--no-fixed-strings[don't treat pattern as literal string]"
|
||||
|
||||
+ '(follow)' # Symlink-following options
|
||||
{-L,--follow}'[follow symlinks]'
|
||||
$no"--no-follow[don't follow symlinks]"
|
||||
|
||||
+ glob # File-glob options
|
||||
'*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob'
|
||||
'*--iglob=[include/exclude files matching specified case-insensitive glob]:glob'
|
||||
|
||||
+ '(glob-case-insensitive)' # File-glob case sensitivity options
|
||||
'--glob-case-insensitive[treat -g/--glob patterns case insensitively]'
|
||||
$no'--no-glob-case-insensitive[treat -g/--glob patterns case sensitively]'
|
||||
|
||||
+ '(heading)' # Heading options
|
||||
'(pretty-vimgrep)--heading[show matches grouped by file name]'
|
||||
"(pretty-vimgrep)--no-heading[don't show matches grouped by file name]"
|
||||
|
||||
+ '(hidden)' # Hidden-file options
|
||||
{-.,--hidden}'[search hidden files and directories]'
|
||||
$no"--no-hidden[don't search hidden files and directories]"
|
||||
|
||||
+ '(hybrid)' # hybrid regex options
|
||||
'--auto-hybrid-regex[dynamically use PCRE2 if necessary]'
|
||||
$no"--no-auto-hybrid-regex[don't dynamically use PCRE2 if necessary]"
|
||||
|
||||
+ '(ignore)' # Ignore-file options
|
||||
"(--no-ignore-global --no-ignore-parent --no-ignore-vcs --no-ignore-dot)--no-ignore[don't respect ignore files]"
|
||||
$no'(--ignore-global --ignore-parent --ignore-vcs --ignore-dot)--ignore[respect ignore files]'
|
||||
|
||||
+ '(ignore-file-case-insensitive)' # Ignore-file case sensitivity options
|
||||
'--ignore-file-case-insensitive[process ignore files case insensitively]'
|
||||
$no'--no-ignore-file-case-insensitive[process ignore files case sensitively]'
|
||||
|
||||
+ '(ignore-exclude)' # Local exclude (ignore)-file options
|
||||
"--no-ignore-exclude[don't respect local exclude (ignore) files]"
|
||||
$no'--ignore-exclude[respect local exclude (ignore) files]'
|
||||
|
||||
+ '(ignore-global)' # Global ignore-file options
|
||||
"--no-ignore-global[don't respect global ignore files]"
|
||||
$no'--ignore-global[respect global ignore files]'
|
||||
|
||||
+ '(ignore-parent)' # Parent ignore-file options
|
||||
"--no-ignore-parent[don't respect ignore files in parent directories]"
|
||||
$no'--ignore-parent[respect ignore files in parent directories]'
|
||||
|
||||
+ '(ignore-vcs)' # VCS ignore-file options
|
||||
"--no-ignore-vcs[don't respect version control ignore files]"
|
||||
$no'--ignore-vcs[respect version control ignore files]'
|
||||
|
||||
+ '(require-git)' # git specific settings
|
||||
"--no-require-git[don't require git repository to respect gitignore rules]"
|
||||
$no'--require-git[require git repository to respect gitignore rules]'
|
||||
|
||||
+ '(ignore-dot)' # .ignore options
|
||||
"--no-ignore-dot[don't respect .ignore files]"
|
||||
$no'--ignore-dot[respect .ignore files]'
|
||||
|
||||
+ '(ignore-files)' # custom global ignore file options
|
||||
"--no-ignore-files[don't respect --ignore-file flags]"
|
||||
$no'--ignore-files[respect --ignore-file files]'
|
||||
|
||||
+ '(json)' # JSON options
|
||||
'--json[output results in JSON Lines format]'
|
||||
$no"--no-json[don't output results in JSON Lines format]"
|
||||
|
||||
+ '(line-number)' # Line-number options
|
||||
{-n,--line-number}'[show line numbers for matches]'
|
||||
{-N,--no-line-number}"[don't show line numbers for matches]"
|
||||
|
||||
+ '(line-terminator)' # Line-terminator options
|
||||
'--crlf[use CRLF as line terminator]'
|
||||
$no"--no-crlf[don't use CRLF as line terminator]"
|
||||
'(text)--null-data[use NUL as line terminator]'
|
||||
|
||||
+ '(max-columns-preview)' # max column preview options
|
||||
'--max-columns-preview[show preview for long lines (with -M)]'
|
||||
$no"--no-max-columns-preview[don't show preview for long lines (with -M)]"
|
||||
|
||||
+ '(max-depth)' # Directory-depth options
|
||||
'--max-depth=[specify max number of directories to descend]:number of directories'
|
||||
'!--maxdepth=:number of directories'
|
||||
|
||||
+ '(messages)' # Error-message options
|
||||
'(--no-ignore-messages)--no-messages[suppress some error messages]'
|
||||
$no"--messages[don't suppress error messages affected by --no-messages]"
|
||||
|
||||
+ '(messages-ignore)' # Ignore-error message options
|
||||
"--no-ignore-messages[don't show ignore-file parse error messages]"
|
||||
$no'--ignore-messages[show ignore-file parse error messages]'
|
||||
|
||||
+ '(mmap)' # mmap options
|
||||
'--mmap[search using memory maps when possible]'
|
||||
"--no-mmap[don't search using memory maps]"
|
||||
|
||||
+ '(multiline)' # Multiline options
|
||||
{-U,--multiline}'[permit matching across multiple lines]'
|
||||
$no'(multiline-dotall)--no-multiline[restrict matches to at most one line each]'
|
||||
|
||||
+ '(multiline-dotall)' # Multiline DOTALL options
|
||||
'(--no-multiline)--multiline-dotall[allow "." to match newline (with -U)]'
|
||||
$no"(--no-multiline)--no-multiline-dotall[don't allow \".\" to match newline (with -U)]"
|
||||
|
||||
+ '(only)' # Only-match options
|
||||
{-o,--only-matching}'[show only matching part of each line]'
|
||||
|
||||
+ '(passthru)' # Pass-through options
|
||||
'(--vimgrep)--passthru[show both matching and non-matching lines]'
|
||||
'!(--vimgrep)--passthrough'
|
||||
|
||||
+ '(pcre2)' # PCRE2 options
|
||||
{-P,--pcre2}'[enable matching with PCRE2]'
|
||||
$no'(pcre2-unicode)--no-pcre2[disable matching with PCRE2]'
|
||||
|
||||
+ '(pcre2-unicode)' # PCRE2 Unicode options
|
||||
$no'(--no-pcre2 --no-pcre2-unicode)--pcre2-unicode[enable PCRE2 Unicode mode (with -P)]'
|
||||
'(--no-pcre2 --pcre2-unicode)--no-pcre2-unicode[disable PCRE2 Unicode mode (with -P)]'
|
||||
|
||||
+ '(pre)' # Preprocessing options
|
||||
'(-z --search-zip)--pre=[specify preprocessor utility]:preprocessor utility:_command_names -e'
|
||||
$no'--no-pre[disable preprocessor utility]'
|
||||
|
||||
+ pre-glob # Preprocessing glob options
|
||||
'*--pre-glob[include/exclude files for preprocessing with --pre]'
|
||||
|
||||
+ '(pretty-vimgrep)' # Pretty/vimgrep display options
|
||||
'(heading)'{-p,--pretty}'[alias for --color=always --heading -n]'
|
||||
'(heading passthru)--vimgrep[show results in vim-compatible format]'
|
||||
|
||||
+ regexp # Explicit pattern options
|
||||
'(1 file)*'{-e+,--regexp=}'[specify pattern]:pattern'
|
||||
|
||||
+ '(replace)' # Replacement options
|
||||
{-r+,--replace=}'[specify string used to replace matches]:replace string'
|
||||
|
||||
+ '(sort)' # File-sorting options
|
||||
'(threads)--sort=[sort results in ascending order (disables parallelism)]:sort method:((
|
||||
none\:"no sorting"
|
||||
path\:"sort by file path"
|
||||
modified\:"sort by last modified time"
|
||||
accessed\:"sort by last accessed time"
|
||||
created\:"sort by creation time"
|
||||
))'
|
||||
'(threads)--sortr=[sort results in descending order (disables parallelism)]:sort method:((
|
||||
none\:"no sorting"
|
||||
path\:"sort by file path"
|
||||
modified\:"sort by last modified time"
|
||||
accessed\:"sort by last accessed time"
|
||||
created\:"sort by creation time"
|
||||
))'
|
||||
'!(threads)--sort-files[sort results by file path (disables parallelism)]'
|
||||
|
||||
+ '(stats)' # Statistics options
|
||||
'(--files file-match)--stats[show search statistics]'
|
||||
$no"--no-stats[don't show search statistics]"
|
||||
|
||||
+ '(text)' # Binary-search options
|
||||
{-a,--text}'[search binary files as if they were text]'
|
||||
"--binary[search binary files, don't print binary data]"
|
||||
$no"--no-binary[don't search binary files]"
|
||||
$no"(--null-data)--no-text[don't search binary files as if they were text]"
|
||||
|
||||
+ '(threads)' # Thread-count options
|
||||
'(sort)'{-j+,--threads=}'[specify approximate number of threads to use]:number of threads'
|
||||
|
||||
+ '(trim)' # Trim options
|
||||
'--trim[trim any ASCII whitespace prefix from each line]'
|
||||
$no"--no-trim[don't trim ASCII whitespace prefix from each line]"
|
||||
|
||||
+ type # Type options
|
||||
'*'{-t+,--type=}'[only search files matching specified type]: :_rg_types'
|
||||
'*--type-add=[add new glob for specified file type]: :->typespec'
|
||||
'*--type-clear=[clear globs previously defined for specified file type]: :_rg_types'
|
||||
# This should actually be exclusive with everything but other type options
|
||||
'(: *)--type-list[show all supported file types and their associated globs]'
|
||||
'*'{-T+,--type-not=}"[don't search files matching specified file type]: :_rg_types"
|
||||
|
||||
+ '(word-line)' # Whole-word/line match options
|
||||
{-w,--word-regexp}'[only show matches surrounded by word boundaries]'
|
||||
{-x,--line-regexp}'[only show matches surrounded by line boundaries]'
|
||||
|
||||
+ '(unicode)' # Unicode options
|
||||
$no'--unicode[enable Unicode mode]'
|
||||
'--no-unicode[disable Unicode mode]'
|
||||
|
||||
+ '(zip)' # Compression options
|
||||
'(--pre)'{-z,--search-zip}'[search in compressed files]'
|
||||
$no"--no-search-zip[don't search in compressed files]"
|
||||
|
||||
+ misc # Other options — no need to separate these at the moment
|
||||
'(-b --byte-offset)'{-b,--byte-offset}'[show 0-based byte offset for each matching line]'
|
||||
'--color=[specify when to use colors in output]:when:((
|
||||
never\:"never use colors"
|
||||
auto\:"use colors or not based on stdout, TERM, etc."
|
||||
always\:"always use colors"
|
||||
ansi\:"always use ANSI colors (even on Windows)"
|
||||
))'
|
||||
'*--colors=[specify color and style settings]: :->colorspec'
|
||||
'--context-separator=[specify string used to separate non-continuous context lines in output]:separator'
|
||||
$no"--no-context-separator[don't print context separators]"
|
||||
'--debug[show debug messages]'
|
||||
'--field-context-separator[set string to delimit fields in context lines]'
|
||||
'--field-match-separator[set string to delimit fields in matching lines]'
|
||||
'--hostname-bin=[executable for getting system hostname]:hostname executable:_command_names -e'
|
||||
'--hyperlink-format=[specify pattern for hyperlinks]:pattern'
|
||||
'--trace[show more verbose debug messages]'
|
||||
'--dfa-size-limit=[specify upper size limit of generated DFA]:DFA size (bytes)'
|
||||
"(1 stats)--files[show each file that would be searched (but don't search)]"
|
||||
'*--ignore-file=[specify additional ignore file]:ignore file:_files'
|
||||
'(-v --invert-match)'{-v,--invert-match}'[invert matching]'
|
||||
'(-M --max-columns)'{-M+,--max-columns=}'[specify max length of lines to print]:number of bytes'
|
||||
'(-m --max-count)'{-m+,--max-count=}'[specify max number of matches per file]:number of matches'
|
||||
'--max-filesize=[specify size above which files should be ignored]:file size (bytes)'
|
||||
"--no-config[don't load configuration files]"
|
||||
'(-0 --null)'{-0,--null}'[print NUL byte after file names]'
|
||||
'--path-separator=[specify path separator to use when printing file names]:separator'
|
||||
'(-q --quiet)'{-q,--quiet}'[suppress normal output]'
|
||||
'--regex-size-limit=[specify upper size limit of compiled regex]:regex size (bytes)'
|
||||
'*'{-u,--unrestricted}'[reduce level of "smart" searching]'
|
||||
'--stop-on-nonmatch[stop on first non-matching line after a matching one]'
|
||||
|
||||
+ operand # Operands
|
||||
'(--files --type-list file regexp)1: :_guard "^-*" pattern'
|
||||
'(--type-list)*: :_files'
|
||||
)
|
||||
|
||||
# This is used with test-complete to verify that there are no options
|
||||
# listed in the help output that aren't also defined here
|
||||
[[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] && {
|
||||
print -rl - $args
|
||||
return 0
|
||||
}
|
||||
|
||||
# Strip out argument groups where unsupported (see above)
|
||||
[[ $ZSH_VERSION == (4|5.<0-3>)(.*)# ]] &&
|
||||
args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} )
|
||||
|
||||
_arguments -C -s -S : $args && ret=0
|
||||
|
||||
case $state in
|
||||
colorspec)
|
||||
if [[ ${IPREFIX#--*=}$PREFIX == [^:]# ]]; then
|
||||
suf=( -qS: )
|
||||
tmp=(
|
||||
'column:specify coloring for column numbers'
|
||||
'line:specify coloring for line numbers'
|
||||
'match:specify coloring for match text'
|
||||
'path:specify coloring for file names'
|
||||
)
|
||||
descr='color/style type'
|
||||
elif [[ ${IPREFIX#--*=}$PREFIX == (column|line|match|path):[^:]# ]]; then
|
||||
suf=( -qS: )
|
||||
tmp=(
|
||||
'none:clear color/style for type'
|
||||
'bg:specify background color'
|
||||
'fg:specify foreground color'
|
||||
'style:specify text style'
|
||||
)
|
||||
descr='color/style attribute'
|
||||
elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:(bg|fg):[^:]# ]]; then
|
||||
tmp=( black blue green red cyan magenta yellow white )
|
||||
descr='color name or r,g,b'
|
||||
elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:style:[^:]# ]]; then
|
||||
tmp=( {,no}bold {,no}intense {,no}underline )
|
||||
descr='style name'
|
||||
else
|
||||
_message -e colorspec 'no more arguments'
|
||||
fi
|
||||
|
||||
(( $#tmp )) && {
|
||||
compset -P '*:'
|
||||
_describe -t colorspec $descr tmp $suf && ret=0
|
||||
}
|
||||
;;
|
||||
|
||||
typespec)
|
||||
if compset -P '[^:]##:include:'; then
|
||||
_sequence -s , _rg_types && ret=0
|
||||
# @todo This bit in particular could be better, but it's a little
|
||||
# complex, and attempting to solve it seems to run us up against a crash
|
||||
# bug — zsh # 40362
|
||||
elif compset -P '[^:]##:'; then
|
||||
_message 'glob or include directive' && ret=1
|
||||
elif [[ ! -prefix *:* ]]; then
|
||||
_rg_types -qS : && ret=0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
# Complete encodings
|
||||
_rg_encodings() {
|
||||
local -a expl
|
||||
local -aU _encodings
|
||||
|
||||
# This is impossible to read, but these encodings rarely if ever change, so it
|
||||
# probably doesn't matter. They are derived from the list given here:
|
||||
# https://encoding.spec.whatwg.org/#concept-encoding-get
|
||||
_encodings=(
|
||||
{{,us-}ascii,arabic,chinese,cyrillic,greek{,8},hebrew,korean}
|
||||
logical visual mac {,cs}macintosh x-mac-{cyrillic,roman,ukrainian}
|
||||
866 ibm{819,866} csibm866
|
||||
big5{,-hkscs} {cn-,cs}big5 x-x-big5
|
||||
cp{819,866,125{0..8}} x-cp125{0..8}
|
||||
csiso2022{jp,kr} csiso8859{6,8}{e,i}
|
||||
csisolatin{{1..6},9} csisolatin{arabic,cyrillic,greek,hebrew}
|
||||
ecma-{114,118} asmo-708 elot_928 sun_eu_greek
|
||||
euc-{jp,kr} x-euc-jp cseuckr cseucpkdfmtjapanese
|
||||
{,x-}gbk csiso58gb231280 gb18030 {,cs}gb2312 gb_2312{,-80} hz-gb-2312
|
||||
iso-2022-{cn,cn-ext,jp,kr}
|
||||
iso8859{,-}{{1..11},13,14,15}
|
||||
iso-8859-{{1..11},{6,8}-{e,i},13,14,15,16} iso_8859-{{1..9},15}
|
||||
iso_8859-{1,2,6,7}:1987 iso_8859-{3,4,5,8}:1988 iso_8859-9:1989
|
||||
iso-ir-{58,100,101,109,110,126,127,138,144,148,149,157}
|
||||
koi{,8,8-r,8-ru,8-u,8_r} cskoi8r
|
||||
ks_c_5601-{1987,1989} ksc{,_}5691 csksc56011987
|
||||
latin{1..6} l{{1..6},9}
|
||||
shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932
|
||||
utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8
|
||||
windows-{31j,874,949,125{0..8}} dos-874 tis-620 ansi_x3.4-1968
|
||||
x-user-defined auto none
|
||||
)
|
||||
|
||||
_wanted encodings expl encoding compadd -a "$@" - _encodings
|
||||
}
|
||||
|
||||
# Complete file types
|
||||
_rg_types() {
|
||||
local -a expl
|
||||
local -aU _types
|
||||
|
||||
_types=( ${(@)${(f)"$( _call_program types $words[1] --type-list )"}//:[[:space:]]##/:} )
|
||||
|
||||
if zstyle -t ":completion:${curcontext}:types" extra-verbose; then
|
||||
_describe -t types 'file type' _types
|
||||
else
|
||||
_wanted types expl 'file type' compadd "$@" - ${(@)_types%%:*}
|
||||
fi
|
||||
}
|
||||
|
||||
_rg "$@"
|
||||
|
||||
################################################################################
|
||||
# ZSH COMPLETION REFERENCE
|
||||
#
|
||||
# For the convenience of developers who aren't especially familiar with zsh
|
||||
# completion functions, a brief reference guide follows. This is in no way
|
||||
# comprehensive; it covers just enough of the basic structure, syntax, and
|
||||
# conventions to help someone make simple changes like adding new options. For
|
||||
# more complete documentation regarding zsh completion functions, please see the
|
||||
# following:
|
||||
#
|
||||
# * http://zsh.sourceforge.net/Doc/Release/Completion-System.html
|
||||
# * https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide
|
||||
#
|
||||
# OVERVIEW
|
||||
#
|
||||
# Most zsh completion functions are defined in terms of `_arguments`, which is a
|
||||
# shell function that takes a series of argument specifications. The specs for
|
||||
# `rg` are stored in an array, which is common for more complex functions; the
|
||||
# elements of the array are passed to `_arguments` on invocation.
|
||||
#
|
||||
# ARGUMENT-SPECIFICATION SYNTAX
|
||||
#
|
||||
# The following is a contrived example of the argument specs for a simple tool:
|
||||
#
|
||||
# '(: * -)'{-h,--help}'[display help information]'
|
||||
# '(-q -v --quiet --verbose)'{-q,--quiet}'[decrease output verbosity]'
|
||||
# '!(-q -v --quiet --verbose)--silent'
|
||||
# '(-q -v --quiet --verbose)'{-v,--verbose}'[increase output verbosity]'
|
||||
# '--color=[specify when to use colors]:when:(always never auto)'
|
||||
# '*:example file:_files'
|
||||
#
|
||||
# Although there may appear to be six specs here, there are actually nine; we
|
||||
# use brace expansion to combine specs for options that go by multiple names,
|
||||
# like `-q` and `--quiet`. This is customary, and ties in with the fact that zsh
|
||||
# merges completion possibilities together when they have the same description.
|
||||
#
|
||||
# The first line defines the option `-h`/`--help`. With most tools, it isn't
|
||||
# useful to complete anything after `--help` because it effectively overrides
|
||||
# all others; the `(: * -)` at the beginning of the spec tells zsh not to
|
||||
# complete any other operands (`:` and `*`) or options (`-`) after this one has
|
||||
# been used. The `[...]` at the end associates a description with `-h`/`--help`;
|
||||
# as mentioned, zsh will see the identical descriptions and merge these options
|
||||
# together when offering completion possibilities.
|
||||
#
|
||||
# The next line defines `-q`/`--quiet`. Here we don't want to suppress further
|
||||
# completions entirely, but we don't want to offer `-q` if `--quiet` has been
|
||||
# given (since they do the same thing), nor do we want to offer `-v` (since it
|
||||
# doesn't make sense to be quiet and verbose at the same time). We don't need to
|
||||
# tell zsh not to offer `--quiet` a second time, since that's the default
|
||||
# behaviour, but since this line expands to two specs describing `-q` *and*
|
||||
# `--quiet` we do need to explicitly list all of them here.
|
||||
#
|
||||
# The next line defines a hidden option `--silent` — maybe it's a deprecated
|
||||
# synonym for `--quiet`. The leading `!` indicates that zsh shouldn't offer this
|
||||
# option during completion. The benefit of providing a spec for an option that
|
||||
# shouldn't be completed is that, if someone *does* use it, we can correctly
|
||||
# suppress completion of other options afterwards.
|
||||
#
|
||||
# The next line defines `-v`/`--verbose`; this works just like `-q`/`--quiet`.
|
||||
#
|
||||
# The next line defines `--color`. In this example, `--color` doesn't have a
|
||||
# corresponding short option, so we don't need to use brace expansion. Further,
|
||||
# there are no other options it's exclusive with (just itself), so we don't need
|
||||
# to define those at the beginning. However, it does take a mandatory argument.
|
||||
# The `=` at the end of `--color=` indicates that the argument may appear either
|
||||
# like `--color always` or like `--color=always`; this is how most GNU-style
|
||||
# command-line tools work. The corresponding short option would normally use `+`
|
||||
# — for example, `-c+` would allow either `-c always` or `-calways`. For this
|
||||
# option, the arguments are known ahead of time, so we can simply list them in
|
||||
# parentheses at the end (`when` is used as the description for the argument).
|
||||
#
|
||||
# The last line defines an operand (a non-option argument). In this example, the
|
||||
# operand can be used any number of times (the leading `*`), and it should be a
|
||||
# file path, so we tell zsh to call the `_files` function to complete it. The
|
||||
# `example file` in the middle is the description to use for this operand; we
|
||||
# could use a space instead to accept the default provided by `_files`.
|
||||
#
|
||||
# GROUPING ARGUMENT SPECIFICATIONS
|
||||
#
|
||||
# Newer versions of zsh support grouping argument specs together. All specs
|
||||
# following a `+` and then a group name are considered to be members of the
|
||||
# named group. Grouping is useful mostly for organisational purposes; it makes
|
||||
# the relationship between different options more obvious, and makes it easier
|
||||
# to specify exclusions.
|
||||
#
|
||||
# We could rewrite our example above using grouping as follows:
|
||||
#
|
||||
# '(: * -)'{-h,--help}'[display help information]'
|
||||
# '--color=[specify when to use colors]:when:(always never auto)'
|
||||
# '*:example file:_files'
|
||||
# + '(verbosity)'
|
||||
# {-q,--quiet}'[decrease output verbosity]'
|
||||
# '!--silent'
|
||||
# {-v,--verbose}'[increase output verbosity]'
|
||||
#
|
||||
# Here we take advantage of a useful feature of spec grouping — when the group
|
||||
# name is surrounded by parentheses, as in `(verbosity)`, it tells zsh that all
|
||||
# of the options in that group are exclusive with each other. As a result, we
|
||||
# don't need to manually list out the exclusions at the beginning of each
|
||||
# option.
|
||||
#
|
||||
# Groups can also be referred to by name in other argument specs; for example:
|
||||
#
|
||||
# '(xyz)--aaa' '*: :_files'
|
||||
# + xyz --xxx --yyy --zzz
|
||||
#
|
||||
# Here we use the group name `xyz` to tell zsh that `--xxx`, `--yyy`, and
|
||||
# `--zzz` are not to be completed after `--aaa`. This makes the exclusion list
|
||||
# much more compact and reusable.
|
||||
#
|
||||
# CONVENTIONS
|
||||
#
|
||||
# zsh completion functions generally adhere to the following conventions:
|
||||
#
|
||||
# * Use two spaces for indentation
|
||||
# * Combine specs for options with different names using brace expansion
|
||||
# * In combined specs, list the short option first (as in `{-a,--text}`)
|
||||
# * Use `+` or `=` as described above for options that take arguments
|
||||
# * Provide a description for all options, option-arguments, and operands
|
||||
# * Capitalise/punctuate argument descriptions as phrases, not complete
|
||||
# sentences — 'display help information', never 'Display help information.'
|
||||
# (but still capitalise acronyms and proper names)
|
||||
# * Write argument descriptions as verb phrases — 'display x', 'enable y',
|
||||
# 'use z'
|
||||
# * Word descriptions to make it clear when an option expects an argument;
|
||||
# usually this is done with the word 'specify', as in 'specify x' or
|
||||
# 'use specified x')
|
||||
# * Write argument descriptions as tersely as possible — for example, articles
|
||||
# like 'a' and 'the' should be omitted unless it would be confusing
|
||||
#
|
||||
# Other conventions currently used by this function:
|
||||
#
|
||||
# * Order argument specs alphabetically by group name, then option name
|
||||
# * Group options that are directly related, mutually exclusive, or frequently
|
||||
# referenced by other argument specs
|
||||
# * Use only characters in the set [a-z0-9_-] in group names
|
||||
# * Order exclusion lists as follows: short options, long options, groups
|
||||
# * Use American English in descriptions
|
||||
# * Use 'don't' in descriptions instead of 'do not'
|
||||
# * Word descriptions for related options as similarly as possible. For example,
|
||||
# `--foo[enable foo]` and `--no-foo[disable foo]`, or `--foo[use foo]` and
|
||||
# `--no-foo[don't use foo]`
|
||||
# * Word descriptions to make it clear when an option only makes sense with
|
||||
# another option, usually by adding '(with -x)' to the end
|
||||
# * Don't quote strings or variables unnecessarily. When quotes are required,
|
||||
# prefer single-quotes to double-quotes
|
||||
# * Prefix option specs with `$no` when the option serves only to negate the
|
||||
# behaviour of another option that must be provided explicitly by the user.
|
||||
# This prevents rarely used options from cluttering up the completion menu
|
||||
################################################################################
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for ripgrep
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * arcizan <ghostrevery@gmail.com>
|
||||
# * MaskRay <i@maskray.me>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# coding: utf-8-unix
|
||||
# indent-tabs-mode: nil
|
||||
# sh-indentation: 2
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
@ -1,3 +0,0 @@
|
||||
#compdef rustup
|
||||
|
||||
source <(rustup completions zsh)
|
@ -1,65 +0,0 @@
|
||||
#compdef shellcheck
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2021 Github zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for shellcheck (https://github.com/koalaman/shellcheck)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Khue Nguyen (https://github.com/Z5483)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_arguments \
|
||||
{-a,--check-sourced}'[include warnings from sourced file]' \
|
||||
{-C,--color=}'[specify color]:color:(auto always never)' \
|
||||
{-i,--include=}'[consider only given types of warnings]:error code' \
|
||||
{-e,--exclude=}'[exclude given types of warnings]:error code' \
|
||||
{-f,--format=}'[specify output format]:format:(checkstyle diff gcc json json1 quiet tty)' \
|
||||
'--list-optional[list checks disabled by default]' \
|
||||
"--norc[don't look for .shellcheckrc files]" \
|
||||
{-o,--enable=}"[give list of optional checks to enable (or 'all')]:error code" \
|
||||
{-P,--source-path=}'[specify path when looking for sourced files]:_files -/' \
|
||||
{-s,--shell=}'[specify dialect]:dialect:(sh bash dash ksh)' \
|
||||
{-S,--severity=}'[specify minimum severity of errors to consider]:severity:(error warning info style)' \
|
||||
{-V,--version}'[print version information]' \
|
||||
{-W,--wiki-link-count=}'[specify number of wiki links to show, when applicable]:number' \
|
||||
{-x,--external-sources}'[allow outside sources]' \
|
||||
'--help[show this usage summary and exit]' \
|
||||
'*: :_files'
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
@ -1,260 +0,0 @@
|
||||
#compdef vagrant
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2009-2015 Robby Russell and contributors (see
|
||||
# https://github.com/robbyrussell/oh-my-zsh/contributors)
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for Vagrant (http://vagrantup.com).
|
||||
#
|
||||
# Source: https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/vagrant
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Nikita Fedyashev (https://github.com/nfedyashev)
|
||||
# * Mark Cornick (https://github.com/markcornick)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# vagrant zsh completion
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'box:Box commands'
|
||||
'connect:Connects to a shared, remote Vagrant environment'
|
||||
'destroy:Destroys the vagrant environment'
|
||||
'docker-logs:Shows Docker logs'
|
||||
'docker-run:Run one-off commands against a Docker container'
|
||||
'global-status:Reports the status of all active Vagrant environments on the system'
|
||||
'halt:Halts the currently running vagrant environment'
|
||||
'help:[TASK] Describe available tasks or one specific task'
|
||||
'init:[box_name] [box_url] Initializes current folder for Vagrant usage'
|
||||
'list-commands:Outputs all available Vagrant subcommands'
|
||||
'login:Authenticates against a Vagrant Cloud server to access protected boxes'
|
||||
'package:Packages a vagrant environment for distribution'
|
||||
'plugin:Manage plugins'
|
||||
'provision:Run the provisioner'
|
||||
'push:Deploys code in this environment to a configured destination'
|
||||
'rdp:Connects to machine via RDP'
|
||||
'reload:Reload the vagrant environment'
|
||||
'resume:Resumes a suspend vagrant environment'
|
||||
'rsync:Syncs rsync synced folders to remote machine'
|
||||
'rsync-auto:Syncs rsync synced folders automatically when files change'
|
||||
'share:Shares the Vagrant environment and allows remote access'
|
||||
'ssh:SSH into the currently running environment'
|
||||
'ssh-config:Outputs .ssh/config valid syntax for connecting to this environment via ssh'
|
||||
'status:Shows the status of the current Vagrant environment'
|
||||
'suspend:Suspends the currently running vagrant environment'
|
||||
'up:Creates the vagrant environment'
|
||||
'version:Prints the currently installed Vagrant version and checks for new updates'
|
||||
'--version:Prints the Vagrant version information'
|
||||
)
|
||||
|
||||
local -a _box_arguments
|
||||
_box_arguments=(
|
||||
'add:NAME URI Add a box to the system'
|
||||
'help:COMMAND Describe subcommands or one specific subcommand'
|
||||
'list:Lists all installed boxes'
|
||||
'outdated:Checks if there is a new version available for the box'
|
||||
'remove:NAME Remove a box from the system'
|
||||
'repackage:NAME Repackage an installed box into a `.box` file.'
|
||||
'update:Updates the box, if there any updates available'
|
||||
)
|
||||
|
||||
local -a _plugin_arguments
|
||||
_plugin_arguments=(
|
||||
'install:NAME Install a plugin to the system'
|
||||
'license:NAME LICENSE_FILE Add a license for an installed plugin'
|
||||
'list:Lists all installed plugins'
|
||||
'uninstall:NAME Uninstall a plugin from the system'
|
||||
'update:[NAMES...] Update all or specified plugins'
|
||||
)
|
||||
|
||||
__task_list ()
|
||||
{
|
||||
local expl
|
||||
declare -a tasks
|
||||
|
||||
tasks=(box destroy global-status halt init package plugin provision \
|
||||
reload resume ssh ssh_config status suspend up version)
|
||||
|
||||
_wanted tasks expl 'help' compadd $tasks
|
||||
}
|
||||
|
||||
__box_list ()
|
||||
{
|
||||
_wanted application expl 'command' compadd $(command vagrant box list | \
|
||||
awk '{print $1}' | \
|
||||
sed -e 's/ /\\ /g')
|
||||
}
|
||||
|
||||
__plugin_list ()
|
||||
{
|
||||
_wanted application expl 'command' compadd $(command vagrant plugin list \
|
||||
2>/dev/null| cut -d' ' -f1)
|
||||
}
|
||||
|
||||
_vagrant_caching_policy()
|
||||
{
|
||||
local reg_time comp_time check_file
|
||||
|
||||
case "${1##*/}" in
|
||||
VAGRANT_VMS)
|
||||
if [[ -z $VAGRANT_CWD ]]; then
|
||||
check_file=./Vagrantfile
|
||||
else
|
||||
check_file=$VAGRANT_CWD/Vagrantfile
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "unknown type: $1"
|
||||
return -1
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$OSTYPE" in
|
||||
darwin*) STATCMD="/usr/bin/stat -f '%c'" ;;
|
||||
*) STATCMD="stat -c '%Z'" ;;
|
||||
esac
|
||||
reg_time=${$(${(z)STATCMD} $check_file):Q}
|
||||
comp_time=${$(${(z)STATCMD} $1):Q}
|
||||
|
||||
return $(( reg_time < comp_time ))
|
||||
}
|
||||
|
||||
__vm_list ()
|
||||
{
|
||||
local cache_policy
|
||||
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
|
||||
zstyle ":completion:${curcontext}:" cache-policy \
|
||||
${cache_policy:-_vagrant_caching_policy}
|
||||
|
||||
# Cache the list of VMs available
|
||||
if ( [[ ${+_vagrant_vms} -eq 0 ]] || _cache_invalid VAGRANT_VMS ) &&
|
||||
! _retrieve_cache VAGRANT_VMS;
|
||||
then
|
||||
_vagrant_vms=( $(_call_program path-all "vagrant status | \
|
||||
awk '{print \$1}' | \
|
||||
egrep -v '^$|^(Current|This|above|VM,)$'" ) )
|
||||
_store_cache VAGRANT_VMS _vagrant_vms
|
||||
fi
|
||||
|
||||
_wanted application expl 'command' compadd $_vagrant_vms
|
||||
}
|
||||
|
||||
__vagrant-box ()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
_describe -t commands "gem subcommand" _box_arguments
|
||||
return
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
(repackage|remove)
|
||||
_arguments ':feature:__box_list'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__vagrant-plugin ()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
local -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
_describe -t commands "gem subcommand" _plugin_arguments
|
||||
return
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
(license)
|
||||
_arguments ':feature:__plugin_list' '*:file:_files'
|
||||
;;
|
||||
(uninstall)
|
||||
_arguments ':feature:__plugin_list'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
local expl
|
||||
local -a boxes installed_boxes
|
||||
|
||||
local curcontext="$curcontext" state line
|
||||
local -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
_describe -t commands "gem subcommand" _1st_arguments
|
||||
return
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
(help)
|
||||
_arguments ':feature:__task_list'
|
||||
;;
|
||||
|
||||
(box)
|
||||
__vagrant-box
|
||||
;;
|
||||
|
||||
(plugin)
|
||||
__vagrant-plugin
|
||||
;;
|
||||
(up|provision|package|destroy|reload|ssh|halt|resume|status|suspend)
|
||||
_arguments ':feature:__vm_list'
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
@ -1,3 +0,0 @@
|
||||
#compdef wezterm
|
||||
|
||||
source <(wezterm shell-completion --shell zsh)
|
@ -1,502 +0,0 @@
|
||||
#compdef yarn
|
||||
# ------------------------------------------------------------------------------
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for yarn (https://yarnpkg.com/)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
|
||||
# * Shohei YOSHIDA <syohex@gmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
declare -g _yarn_run_cwd
|
||||
|
||||
_commands=(
|
||||
'access'
|
||||
'audit:Checks for known security issues with the installed packages'
|
||||
'autoclean:Clean and remove unnecessary files from package dependencies'
|
||||
'cache:List or clean every cached package'
|
||||
"check:Verify package dependencies against yarn's lock file"
|
||||
'config:Manages the yarn configuration files'
|
||||
'create:Creates new projects from any create-* starter kits'
|
||||
'exec'
|
||||
'generate-lock-entry:Generates a lock file entry'
|
||||
'global:Install packages globally on your operating system'
|
||||
'help:Show information about a command'
|
||||
'import:Generate yarn.lock from an existing npm-installed node_modules folder'
|
||||
'info:Show information about a package'
|
||||
'init:Interactively creates or updates a package.json file'
|
||||
'install:Install all the dependencies listed within package.json'
|
||||
'licenses:List licenses for installed packages'
|
||||
'link:Symlink a package folder during development'
|
||||
'login:Store registry username and email'
|
||||
'logout:Clear registry username and email'
|
||||
'node:Runs Node with the same version that the one used by Yarn itself'
|
||||
'outdated:Check for outdated package dependencies'
|
||||
'owner:Manage package owners'
|
||||
'pack:Create a compressed gzip archive of package dependencies'
|
||||
'policies:Defines project-wide policies for your project'
|
||||
'publish:Publish a package to the npm registry'
|
||||
'run:Run a defined package script'
|
||||
'tag:Add, remove, or list tags on a package'
|
||||
'team:Maintain team memberships'
|
||||
'unlink:Unlink a previously created symlink for a package'
|
||||
'unplug:Temporarily copies a package outside of the global cache for debugging purposes'
|
||||
'version:Update the package version'
|
||||
'versions:Display version information of currently installed Yarn, Node.js, and its dependencies'
|
||||
'why:Show information about why a package is installed'
|
||||
'workspace'
|
||||
'workspaces:Show information about your workspaces'
|
||||
)
|
||||
|
||||
_global_commands=(
|
||||
'add:Installs a package and any packages that it depends on'
|
||||
'bin:Displays the location of the yarn bin folder'
|
||||
'list:List installed packages'
|
||||
'remove:Remove installed package from dependencies updating package.json'
|
||||
'upgrade:Upgrades packages to their latest version based on the specified range'
|
||||
'upgrade-interactive:Interactively upgrade packages'
|
||||
)
|
||||
|
||||
_yarn_find_package_json() {
|
||||
local dir=$(cd "$1" && pwd)
|
||||
|
||||
while true
|
||||
do
|
||||
if [[ -e "${dir}/package.json" ]]; then
|
||||
echo "${dir}/package.json"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ $dir == '/' ]]; then
|
||||
break
|
||||
fi
|
||||
|
||||
dir=$(dirname $dir)
|
||||
done
|
||||
}
|
||||
|
||||
_yarn_commands_scripts() {
|
||||
local -a scripts binaries
|
||||
local packageJson
|
||||
|
||||
if [[ -n $opt_args[--cwd] ]]; then
|
||||
packageJson=$(_yarn_find_package_json $opt_args[--cwd])
|
||||
binaries=($(cd $opt_args[--cwd] && echo node_modules/.bin/*(x:t)))
|
||||
else
|
||||
packageJson=$(_yarn_find_package_json $pwd)
|
||||
binaries=($(echo node_modules/.bin/*(x:t)))
|
||||
fi
|
||||
|
||||
if [[ -n $packageJson ]]; then
|
||||
scripts=($(cat "$packageJson" | perl -0777 -MJSON::PP -n -E '$r=decode_json($_); do{($k=$_)=~s/:/\\:/g;say $k}for sort keys %{$r->{scripts}}'))
|
||||
fi
|
||||
|
||||
_describe 'command or script' _commands -- _global_commands -- scripts -- binaries
|
||||
}
|
||||
|
||||
_yarn_scripts() {
|
||||
local -a binaries scripts
|
||||
local -a commands
|
||||
local packageJson
|
||||
|
||||
if [[ -n $_yarn_run_cwd ]]; then
|
||||
packageJson=$(_yarn_find_package_json $_yarn_run_cwd)
|
||||
if [[ -d "${_yarn_run_cwd}/node_modules" ]]; then
|
||||
binaries=($(cd $_yarn_run_cwd && echo node_modules/.bin/*(x:t)))
|
||||
else
|
||||
binaries=($(cd $_yarn_run_cwd && yarn bin | perl -wln -e 'm{^[^:]+: (\S+)$} and print $1'))
|
||||
fi
|
||||
else
|
||||
packageJson=$(_yarn_find_package_json $pwd)
|
||||
if [[ -d node_modules ]]; then
|
||||
binaries=($(echo node_modules/.bin/*(x:t)))
|
||||
else
|
||||
binaries=($(yarn bin | perl -wln -e 'm{^[^:]+: (\S+)$} and print $1'))
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n $packageJson ]]; then
|
||||
scripts=("${(@f)$(cat ${packageJson} | perl -0777 -MJSON::PP -n -E '%r=%{decode_json($_)->{scripts}}; do{$k=$_;($e=$k)=~s/:/\\:/g; printf "$e:$r{$k}\n"} for sort keys %r')}")
|
||||
fi
|
||||
|
||||
commands=('env' $scripts $binaries)
|
||||
_describe 'command' commands
|
||||
}
|
||||
|
||||
_yarn_global_commands() {
|
||||
local -a cmds
|
||||
cmds=('ls:List installed packages')
|
||||
_describe 'command' _global_commands
|
||||
}
|
||||
|
||||
_yarn_commands() {
|
||||
_describe 'command' _commands -- _global_commands
|
||||
}
|
||||
|
||||
_yarn_add_files() {
|
||||
if compset -P "(file|link):"; then
|
||||
_files
|
||||
fi
|
||||
}
|
||||
|
||||
_yarn_workspaces() {
|
||||
local version=$(yarn --version |sed -n 's|\([0-9]*\).*|\1|p')
|
||||
local -a workspaces
|
||||
if [[ $version == "1" ]]; then
|
||||
workspaces=(${(@f)$(yarn workspaces info |sed -n -e 's/^ "\([^"]*\)": {/\1/p')})
|
||||
else
|
||||
workspaces=(${(@f)$(yarn workspaces list --json | sed -n 's|.*"name":"\([^"]*\)"}|\1|p')})
|
||||
fi
|
||||
_describe 'workspace' workspaces
|
||||
}
|
||||
|
||||
_yarn() {
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments \
|
||||
'(-h --help)'{-h,--help}'[output usage information]' \
|
||||
'(-V --version)'{-V,--version}'[output the version number]' \
|
||||
'--verbose[output verbose messages on internal operations]' \
|
||||
'--cache-folder=[specify a custom folder to store the yarn cache]:folder:_files -/' \
|
||||
'--check-files[install will verify file tree of packages for consistency]' \
|
||||
'--cwd=[working directory to use]:path:_files -/' \
|
||||
"(--enable-pnp --pnp)--disable-pnp[disable the Plug'n'Play installation]" \
|
||||
'(--no-emoji)--emoji=[enable emoji in output(default: false)]:enabled:(true false)' \
|
||||
'(--emoji)--no-emoji[disable emoji in output]' \
|
||||
'(--disable-pnp)'{--enable-pnp,--pnp}"[enable the Plug'n'Play installation]" \
|
||||
'--flat[only allow one version of a package]' \
|
||||
'--focus[Focus on a single workspace by installing remote copies of its sibling workspaces]' \
|
||||
'--force[install and build packages even if they were built before, overwrite lockfile]' \
|
||||
"--frozen-lockfile[don't generate a lockfile and fail if an update is needed]" \
|
||||
'--global-folder=[modules folder]:folder:_files -/' \
|
||||
'--har[save HAR output of network traffic]' \
|
||||
'--https-proxy=[HTTPS proxy]:host:_hosts' \
|
||||
'--ignore-engines[ignore engines check]' \
|
||||
"--ignore-scripts[don't run lifecycle scripts]" \
|
||||
'--ignore-optional[ignore optional dependencies]' \
|
||||
'--ignore-platform[ignore platform checks]' \
|
||||
'--json[format Yarn log messages as lines of JSON]' \
|
||||
'--link-duplicates[create hardlinks to the repeated modules in node_modules]' \
|
||||
'--link-folder=[specify a custom folder to store global links]' \
|
||||
'--modules-folder=[rather than installing modules into the node_modules folder relative to the cwd, output them here]:folder:_files -/' \
|
||||
'--mutex=[use a mutex to ensure only one yarn instance is executing]:type[\:specifier]' \
|
||||
'--network-concurrency=[maximum number of concurrent network requests]:number' \
|
||||
'--network-timeout=[TCP timeout for network requests]:milliseconds' \
|
||||
"--no-bin-links[don't generate bin links when setting up packages]" \
|
||||
'--no-default-rc[prevent Yarn from automatically detecting yarnrc and npmrc files]' \
|
||||
"--no-lockfile[don't read or generate a lockfile]" \
|
||||
'--non-interactive[do not show interactive prompts]' \
|
||||
'--no-node-version-check[do not warn when using a potentially unsupported Node version]' \
|
||||
'--no-progress[disable progress bar]' \
|
||||
'--offline[trigger an error if any required dependencies are not available in local cache]' \
|
||||
'--otp=[one-time password for two factor authentication]:otpcode' \
|
||||
'--prefer-offline[use network only if dependencies are not available in local cache]' \
|
||||
'--preferred-cache-folder=[specify a custom folder to store the yarn cache if possible]:folder:_files -/' \
|
||||
'(--prod --production)'{--prod,--production}'[install only production dependencies]' \
|
||||
'--proxy=[HTTP proxy]:host:_hosts' \
|
||||
"--pure-lockfile[don't generate a lockfile]" \
|
||||
'--registry=[override configuration registry]:url:_urls' \
|
||||
'(-s --silent)'{-s,--silent}'[skip Yarn console logs, other types of logs (script output) will be printed]' \
|
||||
'--scripts-prepend-node-path=[prepend the node executable dir to the PATH in scripts]:bool:(true false)' \
|
||||
'--skip-integrity-check[run install without checking if node_modules is installed]' \
|
||||
"--strict-semver[don't compare semver loosely]" \
|
||||
'--update-checksum[update package checksums from current repository]' \
|
||||
'--use-yarnrc=[specifies a yarnrc that Yarn should use]:yarnrc:_files' \
|
||||
'1: :_yarn_commands_scripts' \
|
||||
'*:: :->command_args'
|
||||
|
||||
|
||||
case $state in
|
||||
command_args)
|
||||
case $words[1] in
|
||||
help)
|
||||
_arguments \
|
||||
'1: :_yarn_commands' \
|
||||
;;
|
||||
|
||||
access)
|
||||
_arguments \
|
||||
'1: :(public restricted grant revoke ls-packages ls-collaborators edit)'
|
||||
;;
|
||||
|
||||
add)
|
||||
_arguments \
|
||||
'(-D --dev)'{-D,--dev}'[install packages in devDependencies]' \
|
||||
'(-P --peer)'{-P,--peer}'[install packages in peerDependencies]' \
|
||||
'(-O --optional)'{-O,--optional}'[install packages in optionalDependencies]' \
|
||||
'(-E --exact)'{-E,--exact}'[install packages as exact versions]' \
|
||||
'(-T --tilde)'{-T,--tilde}'[install the most recent release of the packages that have the same minor version]' \
|
||||
'(--ignore-workspace-root-check -W)'{--ignore-workspace-root-check,-W}'[allows a package to be installed at the workspaces root]' \
|
||||
'--audit[checks for known security issues with the installed packages]' \
|
||||
'*:package-name:_yarn_add_files'
|
||||
;;
|
||||
|
||||
audit)
|
||||
_arguments \
|
||||
'--verbose[output verbose message]' \
|
||||
'--json[format Yarn log messages as lines of JSON]' \
|
||||
'--level=[only print advisories with severity greater than or equal to]:level:(info low moderate high critical)' \
|
||||
'--groups=[only audit dependencies from listed groups]:groups:->groups_args'
|
||||
;;
|
||||
|
||||
cache)
|
||||
_arguments \
|
||||
'1: :(list dir clean)' \
|
||||
'*:: :->cache_args'
|
||||
;;
|
||||
|
||||
check)
|
||||
_arguments \
|
||||
'--integrity[Verifies that versions and hashed values of the package contents in package.json]' \
|
||||
'--verify-tree[Recursively verifies that the dependencies in package.json are present in node_modules]'
|
||||
;;
|
||||
|
||||
config)
|
||||
_arguments \
|
||||
'1: :(set get delete list)' \
|
||||
'*:: :->config_args'
|
||||
;;
|
||||
|
||||
global)
|
||||
_arguments \
|
||||
'--prefix=[bin prefix to use to install binaries]' \
|
||||
'1: :_yarn_global_commands' \
|
||||
'*:: :->command_args'
|
||||
;;
|
||||
|
||||
info)
|
||||
_arguments \
|
||||
'1:package:' \
|
||||
'2:field'
|
||||
;;
|
||||
|
||||
init)
|
||||
_arguments \
|
||||
'(-y --yes)'{-y,--yes}'[install packages in devDependencies]'
|
||||
;;
|
||||
|
||||
licenses)
|
||||
_arguments \
|
||||
'1: :(ls generate-disclaimer)' \
|
||||
;;
|
||||
|
||||
link|unlink|outdated)
|
||||
_arguments \
|
||||
'1:package' \
|
||||
;;
|
||||
|
||||
list)
|
||||
_arguments \
|
||||
'--depth=[Limit the depth of the shown dependencies]:depth' \
|
||||
'--pattern=[filter the list of dependencies by the pattern]'
|
||||
;;
|
||||
|
||||
owner)
|
||||
_arguments \
|
||||
'1: :(list add rm)' \
|
||||
'*:: :->owner_args'
|
||||
;;
|
||||
|
||||
pack)
|
||||
_arguments \
|
||||
'(-f --filename)'{-f,--filename}':filename:_files'
|
||||
;;
|
||||
|
||||
publish)
|
||||
_arguments \
|
||||
'--new-version:version:' \
|
||||
'--message:message:' \
|
||||
'--no-git-tag-version' \
|
||||
'--access:access:' \
|
||||
'--tag:tag:' \
|
||||
'1: :_files'
|
||||
;;
|
||||
|
||||
policies)
|
||||
_arguments \
|
||||
'1: :(set-version)'
|
||||
;;
|
||||
|
||||
remove|upgrade)
|
||||
_arguments \
|
||||
'*:package:'
|
||||
;;
|
||||
|
||||
run)
|
||||
if [[ -n $opt_args[--cwd] ]]; then
|
||||
_yarn_run_cwd=$opt_args[--cwd]
|
||||
else
|
||||
_yarn_run_cwd=''
|
||||
fi
|
||||
_arguments \
|
||||
'1: :_yarn_scripts' \
|
||||
'*:: :_default'
|
||||
;;
|
||||
|
||||
tag)
|
||||
_arguments \
|
||||
'1: :(lists add rm)' \
|
||||
'*:: :->tag_args'
|
||||
;;
|
||||
|
||||
team)
|
||||
_arguments \
|
||||
'1: :(create destroy add rm list)' \
|
||||
'*:: :->team_args'
|
||||
;;
|
||||
|
||||
upgrade-interactive)
|
||||
_arguments \
|
||||
'--latest[use the version tagged latest in the registry]'
|
||||
;;
|
||||
|
||||
version)
|
||||
_arguments \
|
||||
'--new-version[create a new version using an interactive session to prompt you]:version:' \
|
||||
'--major[creates a new version by incrementing the major version]' \
|
||||
'--minor[creates a new version by incrementing the minor version]' \
|
||||
'--patch[creates a new version by incrementing the patch version]' \
|
||||
'--premajor[creates a new prerelease version by incrementing the major version]' \
|
||||
'--preminor[creates a new prerelease version by incrementing the minor version]' \
|
||||
'--prepatch[creates a new prerelease version by incrementing the patch version]' \
|
||||
'--prerelease[increments the prerelease version number keeping the main version]' \
|
||||
'--no-git-tag-version[creates a new version without creating a git tag]' \
|
||||
'--no-commit-hooks[bypasses running commit hooks when committing the new version]'
|
||||
;;
|
||||
|
||||
why)
|
||||
_arguments \
|
||||
'1:query:_files'
|
||||
;;
|
||||
|
||||
workspace)
|
||||
_arguments \
|
||||
'1:workspace:_yarn_workspaces' \
|
||||
'*:: :_yarn_global_commands'
|
||||
;;
|
||||
|
||||
workspaces)
|
||||
_arguments \
|
||||
'--json[format Yarn log messages as lines of JSON]' \
|
||||
'1:commands:(info run)'
|
||||
;;
|
||||
|
||||
*)
|
||||
_default
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
case $state in
|
||||
cache_args)
|
||||
if [[ $words[1] == "list" ]]; then
|
||||
_arguments \
|
||||
'--pattern=[print out every cached package that matches the pattern]:pattern:'
|
||||
fi
|
||||
;;
|
||||
config_args)
|
||||
case $words[1] in
|
||||
get|delete)
|
||||
_arguments \
|
||||
'1:key:'
|
||||
;;
|
||||
|
||||
set)
|
||||
_arguments \
|
||||
'(-g --global)'{-g,--global} \
|
||||
'1:key:' \
|
||||
'2:value:'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
groups_args)
|
||||
local dependency_groups=(devDependencies dependencies optionalDependencies peerDependencies bundledDependencies)
|
||||
_values -s ',' 'groups' $dependency_groups
|
||||
;;
|
||||
|
||||
owner_args)
|
||||
case $words[1] in
|
||||
ls)
|
||||
_arguments \
|
||||
'1:package:'
|
||||
;;
|
||||
|
||||
add|rm)
|
||||
_arguments \
|
||||
'1:user:' \
|
||||
'2:package:'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
tag_args)
|
||||
case $words[1] in
|
||||
ls)
|
||||
_arguments \
|
||||
'1:package'
|
||||
;;
|
||||
|
||||
add|rm)
|
||||
_arguments \
|
||||
'1:package:' \
|
||||
'2:tag:'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
team_args)
|
||||
case $words[1] in
|
||||
create|destroy|ls)
|
||||
_arguments \
|
||||
'1:scope\:team:'
|
||||
;;
|
||||
|
||||
add|rm)
|
||||
_arguments \
|
||||
'1:scope\:team:' \
|
||||
'2:user:'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_yarn "$@"
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
@ -1,30 +0,0 @@
|
||||
#compdef yt-dlp
|
||||
|
||||
__yt_dlp() {
|
||||
local curcontext="$curcontext" fileopts diropts cur prev
|
||||
typeset -A opt_args
|
||||
fileopts="--download-archive|-a|--batch-file|--load-info-json|--load-info|--cookies|--no-cookies"
|
||||
diropts="--cache-dir"
|
||||
cur=$words[CURRENT]
|
||||
case $cur in
|
||||
:)
|
||||
_arguments '*: :(::ytfavorites ::ytrecommended ::ytsubscriptions ::ytwatchlater ::ythistory)'
|
||||
;;
|
||||
*)
|
||||
prev=$words[CURRENT-1]
|
||||
if [[ ${prev} =~ ${fileopts} ]]; then
|
||||
_path_files
|
||||
elif [[ ${prev} =~ ${diropts} ]]; then
|
||||
_path_files -/
|
||||
elif [[ ${prev} == "--remux-video" ]]; then
|
||||
_arguments '*: :(mp4 mkv)'
|
||||
elif [[ ${prev} == "--recode-video" ]]; then
|
||||
_arguments '*: :(mp4 flv ogg webm mkv)'
|
||||
else
|
||||
_arguments '*: :(--help --version --update --ignore-errors --no-abort-on-error --abort-on-error --dump-user-agent --list-extractors --extractor-descriptions --force-generic-extractor --default-search --ignore-config --config-location --flat-playlist --no-flat-playlist --live-from-start --no-live-from-start --wait-for-video --no-wait-for-video --mark-watched --no-mark-watched --no-colors --compat-options --proxy --socket-timeout --source-address --force-ipv4 --force-ipv6 --geo-verification-proxy --cn-verification-proxy --geo-bypass --no-geo-bypass --geo-bypass-country --geo-bypass-ip-block --playlist-start --playlist-end --playlist-items --match-title --reject-title --min-filesize --max-filesize --date --datebefore --dateafter --min-views --max-views --match-filter --no-match-filter --no-playlist --yes-playlist --age-limit --download-archive --no-download-archive --max-downloads --break-on-existing --break-on-reject --break-per-input --no-break-per-input --skip-playlist-after-errors --include-ads --no-include-ads --concurrent-fragments --limit-rate --throttled-rate --retries --file-access-retries --fragment-retries --skip-unavailable-fragments --abort-on-unavailable-fragment --keep-fragments --no-keep-fragments --buffer-size --resize-buffer --no-resize-buffer --http-chunk-size --test --playlist-reverse --no-playlist-reverse --playlist-random --xattr-set-filesize --hls-prefer-native --hls-prefer-ffmpeg --hls-use-mpegts --no-hls-use-mpegts --downloader --downloader-args --batch-file --no-batch-file --id --paths --output --output-na-placeholder --autonumber-size --autonumber-start --restrict-filenames --no-restrict-filenames --windows-filenames --no-windows-filenames --trim-filenames --no-overwrites --force-overwrites --no-force-overwrites --continue --no-continue --part --no-part --mtime --no-mtime --write-description --no-write-description --write-info-json --no-write-info-json --write-annotations --no-write-annotations --write-playlist-metafiles --no-write-playlist-metafiles --clean-infojson --no-clean-infojson --write-comments --no-write-comments --load-info-json --cookies --no-cookies --cookies-from-browser --no-cookies-from-browser --cache-dir --no-cache-dir --rm-cache-dir --write-thumbnail --no-write-thumbnail --write-all-thumbnails --list-thumbnails --write-link --write-url-link --write-webloc-link --write-desktop-link --quiet --no-warnings --simulate --no-simulate --ignore-no-formats-error --no-ignore-no-formats-error --skip-download --print --get-url --get-title --get-id --get-thumbnail --get-description --get-duration --get-filename --get-format --dump-json --dump-single-json --print-json --force-write-archive --newline --no-progress --progress --console-title --progress-template --verbose --dump-pages --write-pages --youtube-print-sig-code --print-traffic --call-home --no-call-home --encoding --no-check-certificates --prefer-insecure --user-agent --referer --add-header --bidi-workaround --sleep-requests --sleep-interval --max-sleep-interval --sleep-subtitles --format --format-sort --format-sort-force --no-format-sort-force --video-multistreams --no-video-multistreams --audio-multistreams --no-audio-multistreams --all-formats --prefer-free-formats --no-prefer-free-formats --check-formats --check-all-formats --no-check-formats --list-formats --list-formats-as-table --list-formats-old --merge-output-format --allow-unplayable-formats --no-allow-unplayable-formats --write-subs --no-write-subs --write-auto-subs --no-write-auto-subs --all-subs --list-subs --sub-format --sub-langs --username --password --twofactor --netrc --netrc-location --video-password --ap-mso --ap-username --ap-password --ap-list-mso --extract-audio --audio-format --audio-quality --remux-video --recode-video --postprocessor-args --keep-video --no-keep-video --post-overwrites --no-post-overwrites --embed-subs --no-embed-subs --embed-thumbnail --no-embed-thumbnail --embed-metadata --no-embed-metadata --embed-chapters --no-embed-chapters --embed-info-json --no-embed-info-json --metadata-from-title --parse-metadata --replace-in-metadata --xattrs --fixup --prefer-avconv --prefer-ffmpeg --ffmpeg-location --exec --no-exec --exec-before-download --no-exec-before-download --convert-subs --convert-thumbnails --split-chapters --no-split-chapters --remove-chapters --no-remove-chapters --force-keyframes-at-cuts --no-force-keyframes-at-cuts --use-postprocessor --sponsorblock-mark --sponsorblock-remove --sponsorblock-chapter-title --no-sponsorblock --sponsorblock-api --sponskrub --no-sponskrub --sponskrub-cut --no-sponskrub-cut --sponskrub-force --no-sponskrub-force --sponskrub-location --sponskrub-args --extractor-retries --allow-dynamic-mpd --ignore-dynamic-mpd --hls-split-discontinuity --no-hls-split-discontinuity --extractor-args --youtube-include-dash-manifest --youtube-skip-dash-manifest --youtube-include-hls-manifest --youtube-skip-hls-manifest)'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__yt_dlp
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
init() {
|
||||
local wkdir="${BASE_ZSH_CONFIG_DIR}/config/completions"
|
||||
FPATH="${FPATH}:${wkdir}/completions"
|
||||
|
||||
autoload -Uz compinit bashcompinit
|
||||
export ZSH_COMP_DUMPFILE="${XDG_CACHE_HOME}/zcompdump"
|
||||
compinit -d "${ZSH_COMP_DUMPFILE}"
|
||||
|
||||
if command -v aws_completer >/dev/null 2>&1; then
|
||||
complete -C "$(command -v aws_completer)" aws
|
||||
fi
|
||||
}
|
||||
|
||||
init
|
@ -15,10 +15,9 @@ init() {
|
||||
source "${wkdir}/style/init.zsh"
|
||||
source "${wkdir}/omz/init.zsh"
|
||||
source "${wkdir}/plugins/init.zsh"
|
||||
source "${wkdir}/completions/init.zsh"
|
||||
source "${wkdir}/themes/init.zsh"
|
||||
}
|
||||
|
||||
init
|
||||
unset -f init
|
||||
unset -f configure
|
||||
unset -f configure
|
||||
|
Loading…
Reference in New Issue
Block a user