remove superfluous completions
This commit is contained in:
parent
e3fdacd760
commit
42598090d0
|
@ -1,206 +0,0 @@
|
|||
#compdef helm
|
||||
|
||||
# zsh completion for helm -*- shell-script -*-
|
||||
|
||||
__helm_debug()
|
||||
{
|
||||
local file="$BASH_COMP_DEBUG_FILE"
|
||||
if [[ -n ${file} ]]; then
|
||||
echo "$*" >> "${file}"
|
||||
fi
|
||||
}
|
||||
|
||||
_helm()
|
||||
{
|
||||
local shellCompDirectiveError=1
|
||||
local shellCompDirectiveNoSpace=2
|
||||
local shellCompDirectiveNoFileComp=4
|
||||
local shellCompDirectiveFilterFileExt=8
|
||||
local shellCompDirectiveFilterDirs=16
|
||||
|
||||
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace
|
||||
local -a completions
|
||||
|
||||
__helm_debug "\n========= starting completion logic =========="
|
||||
__helm_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
|
||||
|
||||
# The user could have moved the cursor backwards on the command-line.
|
||||
# We need to trigger completion from the $CURRENT location, so we need
|
||||
# to truncate the command-line ($words) up to the $CURRENT location.
|
||||
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
||||
words=("${=words[1,CURRENT]}")
|
||||
__helm_debug "Truncated words[*]: ${words[*]},"
|
||||
|
||||
lastParam=${words[-1]}
|
||||
lastChar=${lastParam[-1]}
|
||||
__helm_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
|
||||
|
||||
# For zsh, when completing a flag with an = (e.g., helm -n=<TAB>)
|
||||
# completions must be prefixed with the flag
|
||||
setopt local_options BASH_REMATCH
|
||||
if [[ "${lastParam}" =~ '-.*=' ]]; then
|
||||
# We are dealing with a flag with an =
|
||||
flagPrefix="-P ${BASH_REMATCH}"
|
||||
fi
|
||||
|
||||
# Prepare the command to obtain completions
|
||||
requestComp="${words[1]} __complete ${words[2,-1]}"
|
||||
if [ "${lastChar}" = "" ]; then
|
||||
# If the last parameter is complete (there is a space following it)
|
||||
# We add an extra empty parameter so we can indicate this to the go completion code.
|
||||
__helm_debug "Adding extra empty parameter"
|
||||
requestComp="${requestComp} \"\""
|
||||
fi
|
||||
|
||||
__helm_debug "About to call: eval ${requestComp}"
|
||||
|
||||
# Use eval to handle any environment variables and such
|
||||
out=$(eval ${requestComp} 2>/dev/null)
|
||||
__helm_debug "completion output: ${out}"
|
||||
|
||||
# Extract the directive integer following a : from the last line
|
||||
local lastLine
|
||||
while IFS='\n' read -r line; do
|
||||
lastLine=${line}
|
||||
done < <(printf "%s\n" "${out[@]}")
|
||||
__helm_debug "last line: ${lastLine}"
|
||||
|
||||
if [ "${lastLine[1]}" = : ]; then
|
||||
directive=${lastLine[2,-1]}
|
||||
# Remove the directive including the : and the newline
|
||||
local suffix
|
||||
(( suffix=${#lastLine}+2))
|
||||
out=${out[1,-$suffix]}
|
||||
else
|
||||
# There is no directive specified. Leave $out as is.
|
||||
__helm_debug "No directive found. Setting do default"
|
||||
directive=0
|
||||
fi
|
||||
|
||||
__helm_debug "directive: ${directive}"
|
||||
__helm_debug "completions: ${out}"
|
||||
__helm_debug "flagPrefix: ${flagPrefix}"
|
||||
|
||||
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
||||
__helm_debug "Completion received error. Ignoring completions."
|
||||
return
|
||||
fi
|
||||
|
||||
local activeHelpMarker="_activeHelp_ "
|
||||
local endIndex=${#activeHelpMarker}
|
||||
local startIndex=$((${#activeHelpMarker}+1))
|
||||
local hasActiveHelp=0
|
||||
while IFS='\n' read -r comp; do
|
||||
# Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
|
||||
if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
|
||||
__helm_debug "ActiveHelp found: $comp"
|
||||
comp="${comp[$startIndex,-1]}"
|
||||
if [ -n "$comp" ]; then
|
||||
compadd -x "${comp}"
|
||||
__helm_debug "ActiveHelp will need delimiter"
|
||||
hasActiveHelp=1
|
||||
fi
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -n "$comp" ]; then
|
||||
# If requested, completions are returned with a description.
|
||||
# The description is preceded by a TAB character.
|
||||
# For zsh's _describe, we need to use a : instead of a TAB.
|
||||
# We first need to escape any : as part of the completion itself.
|
||||
comp=${comp//:/\\:}
|
||||
|
||||
local tab="$(printf '\t')"
|
||||
comp=${comp//$tab/:}
|
||||
|
||||
__helm_debug "Adding completion: ${comp}"
|
||||
completions+=${comp}
|
||||
lastComp=$comp
|
||||
fi
|
||||
done < <(printf "%s\n" "${out[@]}")
|
||||
|
||||
# Add a delimiter after the activeHelp statements, but only if:
|
||||
# - there are completions following the activeHelp statements, or
|
||||
# - file completion will be performed (so there will be choices after the activeHelp)
|
||||
if [ $hasActiveHelp -eq 1 ]; then
|
||||
if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
|
||||
__helm_debug "Adding activeHelp delimiter"
|
||||
compadd -x "--"
|
||||
hasActiveHelp=0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
||||
__helm_debug "Activating nospace."
|
||||
noSpace="-S ''"
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
||||
# File extension filtering
|
||||
local filteringCmd
|
||||
filteringCmd='_files'
|
||||
for filter in ${completions[@]}; do
|
||||
if [ ${filter[1]} != '*' ]; then
|
||||
# zsh requires a glob pattern to do file filtering
|
||||
filter="\*.$filter"
|
||||
fi
|
||||
filteringCmd+=" -g $filter"
|
||||
done
|
||||
filteringCmd+=" ${flagPrefix}"
|
||||
|
||||
__helm_debug "File filtering command: $filteringCmd"
|
||||
_arguments '*:filename:'"$filteringCmd"
|
||||
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
||||
# File completion for directories only
|
||||
local subdir
|
||||
subdir="${completions[1]}"
|
||||
if [ -n "$subdir" ]; then
|
||||
__helm_debug "Listing directories in $subdir"
|
||||
pushd "${subdir}" >/dev/null 2>&1
|
||||
else
|
||||
__helm_debug "Listing directories in ."
|
||||
fi
|
||||
|
||||
local result
|
||||
_arguments '*:dirname:_files -/'" ${flagPrefix}"
|
||||
result=$?
|
||||
if [ -n "$subdir" ]; then
|
||||
popd >/dev/null 2>&1
|
||||
fi
|
||||
return $result
|
||||
else
|
||||
__helm_debug "Calling _describe"
|
||||
if eval _describe "completions" completions $flagPrefix $noSpace; then
|
||||
__helm_debug "_describe found some completions"
|
||||
|
||||
# Return the success of having called _describe
|
||||
return 0
|
||||
else
|
||||
__helm_debug "_describe did not find completions."
|
||||
__helm_debug "Checking if we should do file completion."
|
||||
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
||||
__helm_debug "deactivating file completion"
|
||||
|
||||
# We must return an error code here to let zsh know that there were no
|
||||
# completions found by _describe; this is what will trigger other
|
||||
# matching algorithms to attempt to find completions.
|
||||
# For example zsh can match letters in the middle of words.
|
||||
return 1
|
||||
else
|
||||
# Perform file completion
|
||||
__helm_debug "Activating file completion"
|
||||
|
||||
# We must return the result of this command, so it must be the
|
||||
# last command, or else we must store its result to return it.
|
||||
_arguments '*:filename:_files'" ${flagPrefix}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# don't run the completion function when being source-ed or eval-ed
|
||||
if [ "$funcstack[1]" = "_helm" ]; then
|
||||
_helm
|
||||
fi
|
||||
compdef _helm helm
|
|
@ -1,158 +0,0 @@
|
|||
#compdef just
|
||||
|
||||
autoload -U is-at-least
|
||||
|
||||
_just() {
|
||||
typeset -A opt_args
|
||||
typeset -a _arguments_options
|
||||
local ret=1
|
||||
|
||||
if is-at-least 5.2; then
|
||||
_arguments_options=(-s -S -C)
|
||||
else
|
||||
_arguments_options=(-s -C)
|
||||
fi
|
||||
|
||||
local context curcontext="$curcontext" state line
|
||||
local common=(
|
||||
'--chooser=[Override binary invoked by `--choose`]' \
|
||||
'--color=[Print colorful output]: :(auto always never)' \
|
||||
'--command-color=[Echo recipe lines in <COMMAND-COLOR>]: :(black blue cyan green purple red yellow)' \
|
||||
'--dump-format=[Dump justfile as <FORMAT>]: :(just json)' \
|
||||
'--list-heading=[Print <TEXT> before list]' \
|
||||
'--list-prefix=[Print <TEXT> before each list item]' \
|
||||
'-f+[Use <JUSTFILE> as justfile]' \
|
||||
'--justfile=[Use <JUSTFILE> as justfile]' \
|
||||
'*--set[Override <VARIABLE> with <VALUE>]: :_just_variables' \
|
||||
'--shell=[Invoke <SHELL> to run recipes]' \
|
||||
'*--shell-arg=[Invoke shell with <SHELL-ARG> as an argument]' \
|
||||
'-d+[Use <WORKING-DIRECTORY> as working directory. --justfile must also be set]' \
|
||||
'--working-directory=[Use <WORKING-DIRECTORY> as working directory. --justfile must also be set]' \
|
||||
'-c+[Run an arbitrary command with the working directory, `.env`, overrides, and exports set]' \
|
||||
'--command=[Run an arbitrary command with the working directory, `.env`, overrides, and exports set]' \
|
||||
'--completions=[Print shell completion script for <SHELL>]: :(zsh bash fish powershell elvish)' \
|
||||
'-s+[Show information about <RECIPE>]: :_just_commands' \
|
||||
'--show=[Show information about <RECIPE>]: :_just_commands' \
|
||||
'(--dotenv-path)--dotenv-filename=[Search for environment file named <DOTENV-FILENAME> instead of `.env`]' \
|
||||
'--dotenv-path=[Load environment file at <DOTENV-PATH> instead of searching for one]' \
|
||||
'--check[Run `--fmt` in '\''check'\'' mode. Exits with 0 if justfile is formatted correctly. Exits with 1 and prints a diff if formatting is required.]' \
|
||||
'--yes[Automatically confirm all recipes.]' \
|
||||
'(-q --quiet)-n[Print what just would do without doing it]' \
|
||||
'(-q --quiet)--dry-run[Print what just would do without doing it]' \
|
||||
'--highlight[Highlight echoed recipe lines in bold]' \
|
||||
'--no-deps[Don'\''t run recipe dependencies]' \
|
||||
'--no-dotenv[Don'\''t load `.env` file]' \
|
||||
'--no-highlight[Don'\''t highlight echoed recipe lines in bold]' \
|
||||
'(-n --dry-run)-q[Suppress all output]' \
|
||||
'(-n --dry-run)--quiet[Suppress all output]' \
|
||||
'--shell-command[Invoke <COMMAND> with the shell used to run recipe lines and backticks]' \
|
||||
'--clear-shell-args[Clear shell arguments]' \
|
||||
'-u[Return list and summary entries in source order]' \
|
||||
'--unsorted[Return list and summary entries in source order]' \
|
||||
'--unstable[Enable unstable features]' \
|
||||
'*-v[Use verbose output]' \
|
||||
'*--verbose[Use verbose output]' \
|
||||
'--changelog[Print changelog]' \
|
||||
'--choose[Select one or more recipes to run using a binary chooser. If `--chooser` is not passed the chooser defaults to the value of $JUST_CHOOSER, falling back to `fzf`]' \
|
||||
'--dump[Print justfile]' \
|
||||
'-e[Edit justfile with editor given by $VISUAL or $EDITOR, falling back to `vim`]' \
|
||||
'--edit[Edit justfile with editor given by $VISUAL or $EDITOR, falling back to `vim`]' \
|
||||
'--evaluate[Evaluate and print all variables. If a variable name is given as an argument, only print that variable'\''s value.]' \
|
||||
'--fmt[Format and overwrite justfile]' \
|
||||
'--init[Initialize new justfile in project root]' \
|
||||
'-l[List available recipes and their arguments]' \
|
||||
'--list[List available recipes and their arguments]' \
|
||||
'--summary[List names of available recipes]' \
|
||||
'--variables[List names of variables]' \
|
||||
'-h[Print help information]' \
|
||||
'--help[Print help information]' \
|
||||
'-V[Print version information]' \
|
||||
'--version[Print version information]' \
|
||||
)
|
||||
|
||||
_arguments "${_arguments_options[@]}" $common \
|
||||
'1: :_just_commands' \
|
||||
'*: :->args' \
|
||||
&& ret=0
|
||||
|
||||
case $state in
|
||||
args)
|
||||
curcontext="${curcontext%:*}-${words[2]}:"
|
||||
|
||||
local lastarg=${words[${#words}]}
|
||||
local recipe
|
||||
|
||||
local cmds; cmds=(
|
||||
${(s: :)$(_call_program commands just --summary)}
|
||||
)
|
||||
|
||||
# Find first recipe name
|
||||
for ((i = 2; i < $#words; i++ )) do
|
||||
if [[ ${cmds[(I)${words[i]}]} -gt 0 ]]; then
|
||||
recipe=${words[i]}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $lastarg = */* ]]; then
|
||||
# Arguments contain slash would be recognised as a file
|
||||
_arguments -s -S $common '*:: :_files'
|
||||
elif [[ $lastarg = *=* ]]; then
|
||||
# Arguments contain equal would be recognised as a variable
|
||||
_message "value"
|
||||
elif [[ $recipe ]]; then
|
||||
# Show usage message
|
||||
_message "`just --show $recipe`"
|
||||
# Or complete with other commands
|
||||
#_arguments -s -S $common '*:: :_just_commands'
|
||||
else
|
||||
_arguments -s -S $common '*:: :_just_commands'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
(( $+functions[_just_commands] )) ||
|
||||
_just_commands() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
local variables; variables=(
|
||||
${(s: :)$(_call_program commands just --variables)}
|
||||
)
|
||||
local commands; commands=(
|
||||
${${${(M)"${(f)$(_call_program commands just --list)}":# *}/ ##/}/ ##/:Args: }
|
||||
)
|
||||
|
||||
if compset -P '*='; then
|
||||
case "${${words[-1]%=*}#*=}" in
|
||||
*) _message 'value' && ret=0 ;;
|
||||
esac
|
||||
else
|
||||
_describe -t variables 'variables' variables -qS "=" && ret=0
|
||||
_describe -t commands 'just commands' commands "$@"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
(( $+functions[_just_variables] )) ||
|
||||
_just_variables() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
local variables; variables=(
|
||||
${(s: :)$(_call_program commands just --variables)}
|
||||
)
|
||||
|
||||
if compset -P '*='; then
|
||||
case "${${words[-1]%=*}#*=}" in
|
||||
*) _message 'value' && ret=0 ;;
|
||||
esac
|
||||
else
|
||||
_describe -t variables 'variables' variables && ret=0
|
||||
fi
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_just "$@"
|
|
@ -1,193 +0,0 @@
|
|||
#compdef kubectl
|
||||
compdef _kubectl kubectl
|
||||
|
||||
# Copyright 2016 The Kubernetes Authors.
|
||||
#
|
||||
# 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.
|
||||
#compdef _kubectl kubectl
|
||||
|
||||
# zsh completion for kubectl -*- shell-script -*-
|
||||
|
||||
__kubectl_debug()
|
||||
{
|
||||
local file="$BASH_COMP_DEBUG_FILE"
|
||||
if [[ -n ${file} ]]; then
|
||||
echo "$*" >> "${file}"
|
||||
fi
|
||||
}
|
||||
|
||||
_kubectl()
|
||||
{
|
||||
local shellCompDirectiveError=1
|
||||
local shellCompDirectiveNoSpace=2
|
||||
local shellCompDirectiveNoFileComp=4
|
||||
local shellCompDirectiveFilterFileExt=8
|
||||
local shellCompDirectiveFilterDirs=16
|
||||
|
||||
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace
|
||||
local -a completions
|
||||
|
||||
__kubectl_debug "\n========= starting completion logic =========="
|
||||
__kubectl_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
|
||||
|
||||
# The user could have moved the cursor backwards on the command-line.
|
||||
# We need to trigger completion from the $CURRENT location, so we need
|
||||
# to truncate the command-line ($words) up to the $CURRENT location.
|
||||
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
||||
words=("${=words[1,CURRENT]}")
|
||||
__kubectl_debug "Truncated words[*]: ${words[*]},"
|
||||
|
||||
lastParam=${words[-1]}
|
||||
lastChar=${lastParam[-1]}
|
||||
__kubectl_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
|
||||
|
||||
# For zsh, when completing a flag with an = (e.g., kubectl -n=<TAB>)
|
||||
# completions must be prefixed with the flag
|
||||
setopt local_options BASH_REMATCH
|
||||
if [[ "${lastParam}" =~ '-.*=' ]]; then
|
||||
# We are dealing with a flag with an =
|
||||
flagPrefix="-P ${BASH_REMATCH}"
|
||||
fi
|
||||
|
||||
# Prepare the command to obtain completions
|
||||
requestComp="${words[1]} __complete ${words[2,-1]}"
|
||||
if [ "${lastChar}" = "" ]; then
|
||||
# If the last parameter is complete (there is a space following it)
|
||||
# We add an extra empty parameter so we can indicate this to the go completion code.
|
||||
__kubectl_debug "Adding extra empty parameter"
|
||||
requestComp="${requestComp} \"\""
|
||||
fi
|
||||
|
||||
__kubectl_debug "About to call: eval ${requestComp}"
|
||||
|
||||
# Use eval to handle any environment variables and such
|
||||
out=$(eval ${requestComp} 2>/dev/null)
|
||||
__kubectl_debug "completion output: ${out}"
|
||||
|
||||
# Extract the directive integer following a : from the last line
|
||||
local lastLine
|
||||
while IFS='\n' read -r line; do
|
||||
lastLine=${line}
|
||||
done < <(printf "%s\n" "${out[@]}")
|
||||
__kubectl_debug "last line: ${lastLine}"
|
||||
|
||||
if [ "${lastLine[1]}" = : ]; then
|
||||
directive=${lastLine[2,-1]}
|
||||
# Remove the directive including the : and the newline
|
||||
local suffix
|
||||
(( suffix=${#lastLine}+2))
|
||||
out=${out[1,-$suffix]}
|
||||
else
|
||||
# There is no directive specified. Leave $out as is.
|
||||
__kubectl_debug "No directive found. Setting do default"
|
||||
directive=0
|
||||
fi
|
||||
|
||||
__kubectl_debug "directive: ${directive}"
|
||||
__kubectl_debug "completions: ${out}"
|
||||
__kubectl_debug "flagPrefix: ${flagPrefix}"
|
||||
|
||||
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
||||
__kubectl_debug "Completion received error. Ignoring completions."
|
||||
return
|
||||
fi
|
||||
|
||||
while IFS='\n' read -r comp; do
|
||||
if [ -n "$comp" ]; then
|
||||
# If requested, completions are returned with a description.
|
||||
# The description is preceded by a TAB character.
|
||||
# For zsh's _describe, we need to use a : instead of a TAB.
|
||||
# We first need to escape any : as part of the completion itself.
|
||||
comp=${comp//:/\\:}
|
||||
|
||||
local tab=$(printf '\t')
|
||||
comp=${comp//$tab/:}
|
||||
|
||||
__kubectl_debug "Adding completion: ${comp}"
|
||||
completions+=${comp}
|
||||
lastComp=$comp
|
||||
fi
|
||||
done < <(printf "%s\n" "${out[@]}")
|
||||
|
||||
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
||||
__kubectl_debug "Activating nospace."
|
||||
noSpace="-S ''"
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
||||
# File extension filtering
|
||||
local filteringCmd
|
||||
filteringCmd='_files'
|
||||
for filter in ${completions[@]}; do
|
||||
if [ ${filter[1]} != '*' ]; then
|
||||
# zsh requires a glob pattern to do file filtering
|
||||
filter="\*.$filter"
|
||||
fi
|
||||
filteringCmd+=" -g $filter"
|
||||
done
|
||||
filteringCmd+=" ${flagPrefix}"
|
||||
|
||||
__kubectl_debug "File filtering command: $filteringCmd"
|
||||
_arguments '*:filename:'"$filteringCmd"
|
||||
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
||||
# File completion for directories only
|
||||
local subdir
|
||||
subdir="${completions[1]}"
|
||||
if [ -n "$subdir" ]; then
|
||||
__kubectl_debug "Listing directories in $subdir"
|
||||
pushd "${subdir}" >/dev/null 2>&1
|
||||
else
|
||||
__kubectl_debug "Listing directories in ."
|
||||
fi
|
||||
|
||||
local result
|
||||
_arguments '*:dirname:_files -/'" ${flagPrefix}"
|
||||
result=$?
|
||||
if [ -n "$subdir" ]; then
|
||||
popd >/dev/null 2>&1
|
||||
fi
|
||||
return $result
|
||||
else
|
||||
__kubectl_debug "Calling _describe"
|
||||
if eval _describe "completions" completions $flagPrefix $noSpace; then
|
||||
__kubectl_debug "_describe found some completions"
|
||||
|
||||
# Return the success of having called _describe
|
||||
return 0
|
||||
else
|
||||
__kubectl_debug "_describe did not find completions."
|
||||
__kubectl_debug "Checking if we should do file completion."
|
||||
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
||||
__kubectl_debug "deactivating file completion"
|
||||
|
||||
# We must return an error code here to let zsh know that there were no
|
||||
# completions found by _describe; this is what will trigger other
|
||||
# matching algorithms to attempt to find completions.
|
||||
# For example zsh can match letters in the middle of words.
|
||||
return 1
|
||||
else
|
||||
# Perform file completion
|
||||
__kubectl_debug "Activating file completion"
|
||||
|
||||
# We must return the result of this command, so it must be the
|
||||
# last command, or else we must store its result to return it.
|
||||
_arguments '*:filename:_files'" ${flagPrefix}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# don't run the completion function when being source-ed or eval-ed
|
||||
if [ "$funcstack[1]" = "_kubectl" ]; then
|
||||
_kubectl
|
||||
fi
|
|
@ -1,22 +0,0 @@
|
|||
#compdef lf
|
||||
|
||||
local arguments
|
||||
|
||||
arguments=(
|
||||
'-command[command to execute on client initialization]'
|
||||
'-config[path to the config file (instead of the usual paths)]'
|
||||
'-cpuprofile[path to the file to write the CPU profile]'
|
||||
'-doc[show documentation]'
|
||||
'-last-dir-path[path to the file to write the last dir on exit (to use for cd)]'
|
||||
'-log[path to the log file to write messages]'
|
||||
'-memprofile[path to the file to write the memory profile]'
|
||||
'-remote[send remote command to server]'
|
||||
'-selection-path[path to the file to write selected files on open (to use as open file dialog)]'
|
||||
'-server[start server (automatic)]'
|
||||
'-single[start a client without server]'
|
||||
'-version[show version]'
|
||||
'-help[show help]'
|
||||
'*:filename:_files'
|
||||
)
|
||||
|
||||
_arguments -s $arguments
|
|
@ -1,212 +0,0 @@
|
|||
#compdef pv-migrate
|
||||
compdef _pv-migrate pv-migrate
|
||||
|
||||
# zsh completion for pv-migrate -*- shell-script -*-
|
||||
|
||||
__pv-migrate_debug()
|
||||
{
|
||||
local file="$BASH_COMP_DEBUG_FILE"
|
||||
if [[ -n ${file} ]]; then
|
||||
echo "$*" >> "${file}"
|
||||
fi
|
||||
}
|
||||
|
||||
_pv-migrate()
|
||||
{
|
||||
local shellCompDirectiveError=1
|
||||
local shellCompDirectiveNoSpace=2
|
||||
local shellCompDirectiveNoFileComp=4
|
||||
local shellCompDirectiveFilterFileExt=8
|
||||
local shellCompDirectiveFilterDirs=16
|
||||
local shellCompDirectiveKeepOrder=32
|
||||
|
||||
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
|
||||
local -a completions
|
||||
|
||||
__pv-migrate_debug "\n========= starting completion logic =========="
|
||||
__pv-migrate_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
|
||||
|
||||
# The user could have moved the cursor backwards on the command-line.
|
||||
# We need to trigger completion from the $CURRENT location, so we need
|
||||
# to truncate the command-line ($words) up to the $CURRENT location.
|
||||
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
||||
words=("${=words[1,CURRENT]}")
|
||||
__pv-migrate_debug "Truncated words[*]: ${words[*]},"
|
||||
|
||||
lastParam=${words[-1]}
|
||||
lastChar=${lastParam[-1]}
|
||||
__pv-migrate_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
|
||||
|
||||
# For zsh, when completing a flag with an = (e.g., pv-migrate -n=<TAB>)
|
||||
# completions must be prefixed with the flag
|
||||
setopt local_options BASH_REMATCH
|
||||
if [[ "${lastParam}" =~ '-.*=' ]]; then
|
||||
# We are dealing with a flag with an =
|
||||
flagPrefix="-P ${BASH_REMATCH}"
|
||||
fi
|
||||
|
||||
# Prepare the command to obtain completions
|
||||
requestComp="${words[1]} __complete ${words[2,-1]}"
|
||||
if [ "${lastChar}" = "" ]; then
|
||||
# If the last parameter is complete (there is a space following it)
|
||||
# We add an extra empty parameter so we can indicate this to the go completion code.
|
||||
__pv-migrate_debug "Adding extra empty parameter"
|
||||
requestComp="${requestComp} \"\""
|
||||
fi
|
||||
|
||||
__pv-migrate_debug "About to call: eval ${requestComp}"
|
||||
|
||||
# Use eval to handle any environment variables and such
|
||||
out=$(eval ${requestComp} 2>/dev/null)
|
||||
__pv-migrate_debug "completion output: ${out}"
|
||||
|
||||
# Extract the directive integer following a : from the last line
|
||||
local lastLine
|
||||
while IFS='\n' read -r line; do
|
||||
lastLine=${line}
|
||||
done < <(printf "%s\n" "${out[@]}")
|
||||
__pv-migrate_debug "last line: ${lastLine}"
|
||||
|
||||
if [ "${lastLine[1]}" = : ]; then
|
||||
directive=${lastLine[2,-1]}
|
||||
# Remove the directive including the : and the newline
|
||||
local suffix
|
||||
(( suffix=${#lastLine}+2))
|
||||
out=${out[1,-$suffix]}
|
||||
else
|
||||
# There is no directive specified. Leave $out as is.
|
||||
__pv-migrate_debug "No directive found. Setting do default"
|
||||
directive=0
|
||||
fi
|
||||
|
||||
__pv-migrate_debug "directive: ${directive}"
|
||||
__pv-migrate_debug "completions: ${out}"
|
||||
__pv-migrate_debug "flagPrefix: ${flagPrefix}"
|
||||
|
||||
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
||||
__pv-migrate_debug "Completion received error. Ignoring completions."
|
||||
return
|
||||
fi
|
||||
|
||||
local activeHelpMarker="_activeHelp_ "
|
||||
local endIndex=${#activeHelpMarker}
|
||||
local startIndex=$((${#activeHelpMarker}+1))
|
||||
local hasActiveHelp=0
|
||||
while IFS='\n' read -r comp; do
|
||||
# Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
|
||||
if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
|
||||
__pv-migrate_debug "ActiveHelp found: $comp"
|
||||
comp="${comp[$startIndex,-1]}"
|
||||
if [ -n "$comp" ]; then
|
||||
compadd -x "${comp}"
|
||||
__pv-migrate_debug "ActiveHelp will need delimiter"
|
||||
hasActiveHelp=1
|
||||
fi
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -n "$comp" ]; then
|
||||
# If requested, completions are returned with a description.
|
||||
# The description is preceded by a TAB character.
|
||||
# For zsh's _describe, we need to use a : instead of a TAB.
|
||||
# We first need to escape any : as part of the completion itself.
|
||||
comp=${comp//:/\\:}
|
||||
|
||||
local tab="$(printf '\t')"
|
||||
comp=${comp//$tab/:}
|
||||
|
||||
__pv-migrate_debug "Adding completion: ${comp}"
|
||||
completions+=${comp}
|
||||
lastComp=$comp
|
||||
fi
|
||||
done < <(printf "%s\n" "${out[@]}")
|
||||
|
||||
# Add a delimiter after the activeHelp statements, but only if:
|
||||
# - there are completions following the activeHelp statements, or
|
||||
# - file completion will be performed (so there will be choices after the activeHelp)
|
||||
if [ $hasActiveHelp -eq 1 ]; then
|
||||
if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
|
||||
__pv-migrate_debug "Adding activeHelp delimiter"
|
||||
compadd -x "--"
|
||||
hasActiveHelp=0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
||||
__pv-migrate_debug "Activating nospace."
|
||||
noSpace="-S ''"
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
|
||||
__pv-migrate_debug "Activating keep order."
|
||||
keepOrder="-V"
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
||||
# File extension filtering
|
||||
local filteringCmd
|
||||
filteringCmd='_files'
|
||||
for filter in ${completions[@]}; do
|
||||
if [ ${filter[1]} != '*' ]; then
|
||||
# zsh requires a glob pattern to do file filtering
|
||||
filter="\*.$filter"
|
||||
fi
|
||||
filteringCmd+=" -g $filter"
|
||||
done
|
||||
filteringCmd+=" ${flagPrefix}"
|
||||
|
||||
__pv-migrate_debug "File filtering command: $filteringCmd"
|
||||
_arguments '*:filename:'"$filteringCmd"
|
||||
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
||||
# File completion for directories only
|
||||
local subdir
|
||||
subdir="${completions[1]}"
|
||||
if [ -n "$subdir" ]; then
|
||||
__pv-migrate_debug "Listing directories in $subdir"
|
||||
pushd "${subdir}" >/dev/null 2>&1
|
||||
else
|
||||
__pv-migrate_debug "Listing directories in ."
|
||||
fi
|
||||
|
||||
local result
|
||||
_arguments '*:dirname:_files -/'" ${flagPrefix}"
|
||||
result=$?
|
||||
if [ -n "$subdir" ]; then
|
||||
popd >/dev/null 2>&1
|
||||
fi
|
||||
return $result
|
||||
else
|
||||
__pv-migrate_debug "Calling _describe"
|
||||
if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then
|
||||
__pv-migrate_debug "_describe found some completions"
|
||||
|
||||
# Return the success of having called _describe
|
||||
return 0
|
||||
else
|
||||
__pv-migrate_debug "_describe did not find completions."
|
||||
__pv-migrate_debug "Checking if we should do file completion."
|
||||
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
||||
__pv-migrate_debug "deactivating file completion"
|
||||
|
||||
# We must return an error code here to let zsh know that there were no
|
||||
# completions found by _describe; this is what will trigger other
|
||||
# matching algorithms to attempt to find completions.
|
||||
# For example zsh can match letters in the middle of words.
|
||||
return 1
|
||||
else
|
||||
# Perform file completion
|
||||
__pv-migrate_debug "Activating file completion"
|
||||
|
||||
# We must return the result of this command, so it must be the
|
||||
# last command, or else we must store its result to return it.
|
||||
_arguments '*:filename:_files'" ${flagPrefix}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# don't run the completion function when being source-ed or eval-ed
|
||||
if [ "$funcstack[1]" = "_pv-migrate" ]; then
|
||||
_pv-migrate
|
||||
fi
|
|
@ -1,672 +0,0 @@
|
|||
#compdef rbw
|
||||
|
||||
autoload -U is-at-least
|
||||
|
||||
_rbw() {
|
||||
typeset -A opt_args
|
||||
typeset -a _arguments_options
|
||||
local ret=1
|
||||
|
||||
if is-at-least 5.2; then
|
||||
_arguments_options=(-s -S -C)
|
||||
else
|
||||
_arguments_options=(-s -C)
|
||||
fi
|
||||
|
||||
local context curcontext="$curcontext" state line
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
'-V[Print version]' \
|
||||
'--version[Print version]' \
|
||||
":: :_rbw_commands" \
|
||||
"*::: :->rbw" \
|
||||
&& ret=0
|
||||
case $state in
|
||||
(rbw)
|
||||
words=($line[1] "${words[@]}")
|
||||
(( CURRENT += 1 ))
|
||||
curcontext="${curcontext%:*:*}:rbw-command-$line[1]:"
|
||||
case $line[1] in
|
||||
(config)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
":: :_rbw__config_commands" \
|
||||
"*::: :->config" \
|
||||
&& ret=0
|
||||
|
||||
case $state in
|
||||
(config)
|
||||
words=($line[1] "${words[@]}")
|
||||
(( CURRENT += 1 ))
|
||||
curcontext="${curcontext%:*:*}:rbw-config-command-$line[1]:"
|
||||
case $line[1] in
|
||||
(show)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(set)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
':key -- Configuration key to set:' \
|
||||
':value -- Value to set the configuration option to:' \
|
||||
&& ret=0
|
||||
;;
|
||||
(unset)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
':key -- Configuration key to unset:' \
|
||||
&& ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
":: :_rbw__config__help_commands" \
|
||||
"*::: :->help" \
|
||||
&& ret=0
|
||||
|
||||
case $state in
|
||||
(help)
|
||||
words=($line[1] "${words[@]}")
|
||||
(( CURRENT += 1 ))
|
||||
curcontext="${curcontext%:*:*}:rbw-config-help-command-$line[1]:"
|
||||
case $line[1] in
|
||||
(show)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(set)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(unset)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(register)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help (see more with '\''--help'\'')]' \
|
||||
'--help[Print help (see more with '\''--help'\'')]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(login)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(unlock)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(unlocked)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(sync)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(list)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'*--fields=[Fields to display. Available options are id, name, user, folder. Multiple fields will be separated by tabs.]:FIELDS: ' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(get)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'--folder=[Folder name to search in]:FOLDER: ' \
|
||||
'-f+[Field to get]:FIELD: ' \
|
||||
'--field=[Field to get]:FIELD: ' \
|
||||
'--full[Display the notes in addition to the password]' \
|
||||
'--raw[Display output as JSON]' \
|
||||
'--clipboard[Copy result to clipboard]' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
':name -- Name or UUID of the entry to display:' \
|
||||
'::user -- Username of the entry to display:' \
|
||||
&& ret=0
|
||||
;;
|
||||
(code)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'--folder=[Folder name to search in]:FOLDER: ' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
':name -- Name or UUID of the entry to display:' \
|
||||
'::user -- Username of the entry to display:' \
|
||||
&& ret=0
|
||||
;;
|
||||
(add)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'*--uri=[URI for the password entry]:URI: ' \
|
||||
'--folder=[Folder for the password entry]:FOLDER: ' \
|
||||
'-h[Print help (see more with '\''--help'\'')]' \
|
||||
'--help[Print help (see more with '\''--help'\'')]' \
|
||||
':name -- Name of the password entry:' \
|
||||
'::user -- Username for the password entry:' \
|
||||
&& ret=0
|
||||
;;
|
||||
(generate)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'*--uri=[URI for the password entry]:URI: ' \
|
||||
'--folder=[Folder for the password entry]:FOLDER: ' \
|
||||
'--no-symbols[Generate a password with no special characters]' \
|
||||
'--only-numbers[Generate a password consisting of only numbers]' \
|
||||
'--nonconfusables[Generate a password without visually similar characters (useful for passwords intended to be written down)]' \
|
||||
'--diceware[Generate a password of multiple dictionary words chosen from the EFF word list. The len parameter for this option will set the number of words to generate, rather than characters.]' \
|
||||
'-h[Print help (see more with '\''--help'\'')]' \
|
||||
'--help[Print help (see more with '\''--help'\'')]' \
|
||||
':len -- Length of the password to generate:' \
|
||||
'::name -- Name of the password entry:' \
|
||||
'::user -- Username for the password entry:' \
|
||||
&& ret=0
|
||||
;;
|
||||
(edit)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'--folder=[Folder name to search in]:FOLDER: ' \
|
||||
'-h[Print help (see more with '\''--help'\'')]' \
|
||||
'--help[Print help (see more with '\''--help'\'')]' \
|
||||
':name -- Name or UUID of the password entry:' \
|
||||
'::user -- Username for the password entry:' \
|
||||
&& ret=0
|
||||
;;
|
||||
(remove)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'--folder=[Folder name to search in]:FOLDER: ' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
':name -- Name or UUID of the password entry:' \
|
||||
'::user -- Username for the password entry:' \
|
||||
&& ret=0
|
||||
;;
|
||||
(history)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'--folder=[Folder name to search in]:FOLDER: ' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
':name -- Name or UUID of the password entry:' \
|
||||
'::user -- Username for the password entry:' \
|
||||
&& ret=0
|
||||
;;
|
||||
(lock)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(purge)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(stop-agent)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
&& ret=0
|
||||
;;
|
||||
(gen-completions)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
':shell:(bash elvish fish powershell zsh)' \
|
||||
&& ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
":: :_rbw__help_commands" \
|
||||
"*::: :->help" \
|
||||
&& ret=0
|
||||
|
||||
case $state in
|
||||
(help)
|
||||
words=($line[1] "${words[@]}")
|
||||
(( CURRENT += 1 ))
|
||||
curcontext="${curcontext%:*:*}:rbw-help-command-$line[1]:"
|
||||
case $line[1] in
|
||||
(config)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
":: :_rbw__help__config_commands" \
|
||||
"*::: :->config" \
|
||||
&& ret=0
|
||||
|
||||
case $state in
|
||||
(config)
|
||||
words=($line[1] "${words[@]}")
|
||||
(( CURRENT += 1 ))
|
||||
curcontext="${curcontext%:*:*}:rbw-help-config-command-$line[1]:"
|
||||
case $line[1] in
|
||||
(show)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(set)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(unset)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(register)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(login)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(unlock)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(unlocked)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(sync)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(list)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(get)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(code)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(add)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(generate)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(edit)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(remove)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(history)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(lock)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(purge)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(stop-agent)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(gen-completions)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
&& ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
(( $+functions[_rbw_commands] )) ||
|
||||
_rbw_commands() {
|
||||
local commands; commands=(
|
||||
'config:Get or set configuration options' \
|
||||
'register:Register this device with the Bitwarden server' \
|
||||
'login:Log in to the Bitwarden server' \
|
||||
'unlock:Unlock the local Bitwarden database' \
|
||||
'unlocked:Check if the local Bitwarden database is unlocked' \
|
||||
'sync:Update the local copy of the Bitwarden database' \
|
||||
'list:List all entries in the local Bitwarden database' \
|
||||
'ls:List all entries in the local Bitwarden database' \
|
||||
'get:Display the password for a given entry' \
|
||||
'code:Display the authenticator code for a given entry' \
|
||||
'add:Add a new password to the database' \
|
||||
'generate:Generate a new password' \
|
||||
'gen:Generate a new password' \
|
||||
'edit:Modify an existing password' \
|
||||
'remove:Remove a given entry' \
|
||||
'rm:Remove a given entry' \
|
||||
'history:View the password history for a given entry' \
|
||||
'lock:Lock the password database' \
|
||||
'purge:Remove the local copy of the password database' \
|
||||
'stop-agent:Terminate the background agent' \
|
||||
'gen-completions:Generate completion script for the given shell' \
|
||||
'help:Print this message or the help of the given subcommand(s)' \
|
||||
)
|
||||
_describe -t commands 'rbw commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__add_commands] )) ||
|
||||
_rbw__add_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw add commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__add_commands] )) ||
|
||||
_rbw__help__add_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help add commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__code_commands] )) ||
|
||||
_rbw__code_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw code commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__code_commands] )) ||
|
||||
_rbw__help__code_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help code commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__config_commands] )) ||
|
||||
_rbw__config_commands() {
|
||||
local commands; commands=(
|
||||
'show:Show the values of all configuration settings' \
|
||||
'set:Set a configuration option' \
|
||||
'unset:Reset a configuration option to its default' \
|
||||
'help:Print this message or the help of the given subcommand(s)' \
|
||||
)
|
||||
_describe -t commands 'rbw config commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__config_commands] )) ||
|
||||
_rbw__help__config_commands() {
|
||||
local commands; commands=(
|
||||
'show:Show the values of all configuration settings' \
|
||||
'set:Set a configuration option' \
|
||||
'unset:Reset a configuration option to its default' \
|
||||
)
|
||||
_describe -t commands 'rbw help config commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__edit_commands] )) ||
|
||||
_rbw__edit_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw edit commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__edit_commands] )) ||
|
||||
_rbw__help__edit_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help edit commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__gen-completions_commands] )) ||
|
||||
_rbw__gen-completions_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw gen-completions commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__gen-completions_commands] )) ||
|
||||
_rbw__help__gen-completions_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help gen-completions commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__generate_commands] )) ||
|
||||
_rbw__generate_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw generate commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__generate_commands] )) ||
|
||||
_rbw__help__generate_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help generate commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__get_commands] )) ||
|
||||
_rbw__get_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw get commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__get_commands] )) ||
|
||||
_rbw__help__get_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help get commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__config__help_commands] )) ||
|
||||
_rbw__config__help_commands() {
|
||||
local commands; commands=(
|
||||
'show:Show the values of all configuration settings' \
|
||||
'set:Set a configuration option' \
|
||||
'unset:Reset a configuration option to its default' \
|
||||
'help:Print this message or the help of the given subcommand(s)' \
|
||||
)
|
||||
_describe -t commands 'rbw config help commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__config__help__help_commands] )) ||
|
||||
_rbw__config__help__help_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw config help help commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help_commands] )) ||
|
||||
_rbw__help_commands() {
|
||||
local commands; commands=(
|
||||
'config:Get or set configuration options' \
|
||||
'register:Register this device with the Bitwarden server' \
|
||||
'login:Log in to the Bitwarden server' \
|
||||
'unlock:Unlock the local Bitwarden database' \
|
||||
'unlocked:Check if the local Bitwarden database is unlocked' \
|
||||
'sync:Update the local copy of the Bitwarden database' \
|
||||
'list:List all entries in the local Bitwarden database' \
|
||||
'get:Display the password for a given entry' \
|
||||
'code:Display the authenticator code for a given entry' \
|
||||
'add:Add a new password to the database' \
|
||||
'generate:Generate a new password' \
|
||||
'edit:Modify an existing password' \
|
||||
'remove:Remove a given entry' \
|
||||
'history:View the password history for a given entry' \
|
||||
'lock:Lock the password database' \
|
||||
'purge:Remove the local copy of the password database' \
|
||||
'stop-agent:Terminate the background agent' \
|
||||
'gen-completions:Generate completion script for the given shell' \
|
||||
'help:Print this message or the help of the given subcommand(s)' \
|
||||
)
|
||||
_describe -t commands 'rbw help commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__help_commands] )) ||
|
||||
_rbw__help__help_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help help commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__history_commands] )) ||
|
||||
_rbw__help__history_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help history commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__history_commands] )) ||
|
||||
_rbw__history_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw history commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__list_commands] )) ||
|
||||
_rbw__help__list_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help list commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__list_commands] )) ||
|
||||
_rbw__list_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw list commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__lock_commands] )) ||
|
||||
_rbw__help__lock_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help lock commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__lock_commands] )) ||
|
||||
_rbw__lock_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw lock commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__login_commands] )) ||
|
||||
_rbw__help__login_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help login commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__login_commands] )) ||
|
||||
_rbw__login_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw login commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__purge_commands] )) ||
|
||||
_rbw__help__purge_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help purge commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__purge_commands] )) ||
|
||||
_rbw__purge_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw purge commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__register_commands] )) ||
|
||||
_rbw__help__register_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help register commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__register_commands] )) ||
|
||||
_rbw__register_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw register commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__remove_commands] )) ||
|
||||
_rbw__help__remove_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help remove commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__remove_commands] )) ||
|
||||
_rbw__remove_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw remove commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__config__help__set_commands] )) ||
|
||||
_rbw__config__help__set_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw config help set commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__config__set_commands] )) ||
|
||||
_rbw__config__set_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw config set commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__config__set_commands] )) ||
|
||||
_rbw__help__config__set_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help config set commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__config__help__show_commands] )) ||
|
||||
_rbw__config__help__show_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw config help show commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__config__show_commands] )) ||
|
||||
_rbw__config__show_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw config show commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__config__show_commands] )) ||
|
||||
_rbw__help__config__show_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help config show commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__stop-agent_commands] )) ||
|
||||
_rbw__help__stop-agent_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help stop-agent commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__stop-agent_commands] )) ||
|
||||
_rbw__stop-agent_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw stop-agent commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__sync_commands] )) ||
|
||||
_rbw__help__sync_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help sync commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__sync_commands] )) ||
|
||||
_rbw__sync_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw sync commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__unlock_commands] )) ||
|
||||
_rbw__help__unlock_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help unlock commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__unlock_commands] )) ||
|
||||
_rbw__unlock_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw unlock commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__unlocked_commands] )) ||
|
||||
_rbw__help__unlocked_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help unlocked commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__unlocked_commands] )) ||
|
||||
_rbw__unlocked_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw unlocked commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__config__help__unset_commands] )) ||
|
||||
_rbw__config__help__unset_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw config help unset commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__config__unset_commands] )) ||
|
||||
_rbw__config__unset_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw config unset commands' commands "$@"
|
||||
}
|
||||
(( $+functions[_rbw__help__config__unset_commands] )) ||
|
||||
_rbw__help__config__unset_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'rbw help config unset commands' commands "$@"
|
||||
}
|
||||
|
||||
if [ "$funcstack[1]" = "_rbw" ]; then
|
||||
_rbw "$@"
|
||||
else
|
||||
compdef _rbw rbw
|
||||
fi
|
Loading…
Reference in New Issue