From d6327c46f2dda8a48556bf76cf30e36fdd40fb85 Mon Sep 17 00:00:00 2001 From: Doraken Date: Wed, 2 Aug 2023 13:05:59 +0200 Subject: [PATCH] update stack trace 2 --- completion/available/aliases.completion.bash | 70 +- completion/available/apm.completion.bash | 2 +- completion/available/awless.completion.bash | 3 +- completion/available/awscli.completion.bash | 3 +- completion/available/bash-it.completion.bash | 36 +- completion/available/brew.completion.bash | 18 +- completion/available/bundler.completion.bash | 128 ++- .../available/capistrano.completion.bash | 20 +- completion/available/cargo.completion.bash | 3 +- completion/available/composer.completion.bash | 21 +- completion/available/conda.completion.bash | 6 +- completion/available/consul.completion.bash | 3 +- completion/available/dart.completion.bash | 13 +- completion/available/defaults.completion.bash | 3 +- completion/available/dirs.completion.bash | 14 +- .../available/dmidecode.completion.bash | 11 +- .../available/docker-compose.completion.bash | 599 +++++++++--- completion/available/docker.completion.bash | 5 +- completion/available/dotnet.completion.bash | 12 +- completion/available/fabric.completion.bash | 64 +- completion/available/flutter.completion.bash | 3 +- completion/available/gcloud.completion.bash | 5 +- completion/available/gem.completion.bash | 16 +- completion/available/git.completion.bash | 14 +- completion/available/git_flow.completion.bash | 126 ++- .../available/git_flow_avh.completion.bash | 139 ++- .../available/github-cli.completion.bash | 3 +- completion/available/go.completion.bash | 6 +- completion/available/gradle.completion.bash | 261 ++++-- completion/available/grunt.completion.bash | 35 +- completion/available/gulp.completion.bash | 23 +- completion/available/helm.completion.bash | 3 +- completion/available/hub.completion.bash | 323 +++++-- completion/available/invoke.completion.bash | 11 +- completion/available/jungle.completion.bash | 3 +- completion/available/kind.completion.bash | 3 +- completion/available/knife.completion.bash | 187 +++- completion/available/kontena.completion.bash | 3 +- completion/available/kubectl.completion.bash | 3 +- completion/available/laravel.completion.bash | 17 +- completion/available/lerna.completion.bash | 11 +- completion/available/makefile.completion.bash | 11 +- completion/available/maven.completion.bash | 10 +- completion/available/minikube.completion.bash | 3 +- completion/available/ng.completion.bash | 3 +- completion/available/ngrok.completion.bash | 11 +- .../available/notify-send.completion.bash | 11 +- completion/available/npm.completion.bash | 3 +- completion/available/nvm.completion.bash | 4 +- completion/available/packer.completion.bash | 3 +- completion/available/pip.completion.bash | 19 +- completion/available/pip3.completion.bash | 18 +- completion/available/pipenv.completion.bash | 3 +- completion/available/pipx.completion.bash | 3 +- completion/available/projects.completion.bash | 28 +- completion/available/rake.completion.bash | 17 +- completion/available/rustup.completion.bash | 3 +- completion/available/rvm.completion.bash | 2 +- completion/available/salt.completion.bash | 132 ++- completion/available/sdkman.completion.bash | 65 +- completion/available/sqlmap.completion.bash | 11 +- completion/available/ssh.completion.bash | 32 +- completion/available/svn.completion.bash | 14 +- completion/available/system.completion.bash | 26 +- .../available/test_kitchen.completion.bash | 25 +- completion/available/tmux.completion.bash | 107 ++- completion/available/vagrant.completion.bash | 46 +- completion/available/vault.completion.bash | 3 +- .../available/virtualbox.completion.bash | 122 ++- completion/available/vuejs.completion.bash | 11 +- completion/available/wpscan.completion.bash | 13 +- lib/appearance.bash | 13 +- lib/command_duration.bash | 55 +- lib/helpers.bash | 860 ++++++++++++++---- lib/history.bash | 29 +- lib/log.bash | 62 +- lib/preexec.bash | 68 +- lib/preview.bash | 24 +- lib/search.bash | 147 ++- lib/utilities.bash | 247 ++++- plugins/available/autojump.plugin.bash | 9 +- plugins/available/aws.plugin.bash | 133 ++- plugins/available/base.plugin.bash | 244 +++-- plugins/available/basher.plugin.bash | 8 +- plugins/available/battery.plugin.bash | 92 +- plugins/available/blesh.plugin.bash | 6 +- plugins/available/boot2docker.plugin.bash | 3 +- plugins/available/browser.plugin.bash | 51 +- plugins/available/cht-sh.plugin.bash | 40 +- .../available/cmd-returned-notify.plugin.bash | 14 +- plugins/available/colors.plugin.bash | 473 ++++++++-- plugins/available/direnv.plugin.bash | 3 +- plugins/available/dirs.plugin.bash | 52 +- plugins/available/docker-compose.plugin.bash | 14 +- plugins/available/docker.plugin.bash | 101 +- plugins/available/explain.plugin.bash | 20 +- plugins/available/extract.plugin.bash | 56 +- plugins/available/fzf.plugin.bash | 33 +- plugins/available/gif.plugin.bash | 75 +- plugins/available/git-subrepo.plugin.bash | 3 +- plugins/available/git.plugin.bash | 230 ++++- plugins/available/gitstatus.plugin.bash | 16 +- plugins/available/go.plugin.bash | 17 +- plugins/available/goenv.plugin.bash | 30 +- plugins/available/gradle.plugin.bash | 11 +- plugins/available/hg.plugin.bash | 33 +- plugins/available/history-eternal.plugin.bash | 3 +- plugins/available/history-search.plugin.bash | 3 +- .../history-substring-search.plugin.bash | 3 +- plugins/available/history.plugin.bash | 11 +- plugins/available/hub.plugin.bash | 3 +- plugins/available/javascript.plugin.bash | 41 +- plugins/available/jekyll.plugin.bash | 114 ++- plugins/available/jenv.plugin.bash | 2 +- plugins/available/jgitflow.plugin.bash | 72 +- plugins/available/jump.plugin.bash | 14 +- plugins/available/latex.plugin.bash | 3 +- plugins/available/less-pretty-cat.plugin.bash | 26 +- plugins/available/nginx.plugin.bash | 53 +- plugins/available/node.plugin.bash | 3 +- plugins/available/nodenv.plugin.bash | 5 +- plugins/available/nvm.plugin.bash | 21 +- plugins/available/osx-timemachine.plugin.bash | 88 +- plugins/available/osx.plugin.bash | 119 ++- plugins/available/pack.plugin.bash | 364 ++++++-- plugins/available/percol.plugin.bash | 13 +- plugins/available/pipsi.plugin.bash | 2 +- plugins/available/plenv.plugin.bash | 6 +- plugins/available/postgres.plugin.bash | 89 +- plugins/available/projects.plugin.bash | 16 +- plugins/available/proxy.plugin.bash | 259 +++++- plugins/available/pyenv.plugin.bash | 8 +- plugins/available/python.plugin.bash | 22 +- plugins/available/rails.plugin.bash | 13 +- plugins/available/rbenv.plugin.bash | 5 +- plugins/available/ruby.plugin.bash | 13 +- plugins/available/rvm.plugin.bash | 46 +- plugins/available/ssh.plugin.bash | 30 +- plugins/available/sshagent.plugin.bash | 91 +- plugins/available/subversion.plugin.bash | 3 +- plugins/available/sudo.plugin.bash | 16 +- plugins/available/textmate.plugin.bash | 3 +- plugins/available/thefuck.plugin.bash | 3 +- plugins/available/tmuxinator.plugin.bash | 2 +- plugins/available/virtualenv.plugin.bash | 6 +- plugins/available/xterm.plugin.bash | 56 +- plugins/available/z_autoenv.plugin.bash | 26 +- plugins/available/zoxide.plugin.bash | 3 +- scripts/reloader.bash | 18 +- themes/90210/90210.theme.bash | 11 +- themes/agnoster/agnoster.theme.bash | 311 +++++-- themes/atomic/atomic.theme.bash | 275 +++++- themes/axin/axin.theme.bash | 17 +- themes/bakke/bakke.theme.bash | 11 +- themes/barbuk/barbuk.theme.bash | 206 ++++- themes/base.theme.bash | 680 ++++++++++++-- themes/binaryanomaly/binaryanomaly.theme.bash | 76 +- themes/bira/bira.theme.bash | 14 +- themes/bobby-python/bobby-python.theme.bash | 11 +- themes/bobby/bobby.theme.bash | 25 +- themes/brainy/brainy.theme.bash | 275 +++++- themes/brunton/brunton.theme.bash | 25 +- themes/candy/candy.theme.bash | 11 +- themes/clean/clean.theme.bash | 14 +- themes/codeword/codeword.theme.bash | 33 +- themes/cooperkid/cooperkid.theme.bash | 39 +- themes/cupcake/cupcake.theme.bash | 30 +- themes/demula/demula.theme.bash | 55 +- themes/doubletime/doubletime.theme.bash | 20 +- .../doubletime_multiline.theme.bash | 13 +- .../doubletime_multiline_pyonly.theme.bash | 13 +- themes/dulcie/dulcie.theme.bash | 48 +- themes/duru/duru.theme.bash | 33 +- themes/easy/easy.theme.bash | 14 +- themes/elixr/elixr.theme.bash | 11 +- themes/emperor/emperor.theme.bash | 42 +- themes/envy/envy.theme.bash | 11 +- themes/essential/essential.theme.bash | 92 +- themes/font/font.theme.bash | 15 +- themes/gallifrey/gallifrey.theme.bash | 11 +- themes/githelpers.theme.bash | 258 +++++- themes/gitline/gitline.theme.bash | 2 +- themes/gitline/powerline.base.bash | 252 ++++- themes/hawaii50/hawaii50.theme.bash | 111 ++- themes/iterate/iterate.theme.bash | 39 +- themes/kitsune/kitsune.theme.bash | 11 +- themes/liquidprompt/liquidprompt.theme.bash | 65 +- themes/luan/luan.theme.bash | 12 +- themes/mairan/mairan.theme.bash | 72 +- themes/mbriggs/mbriggs.theme.bash | 24 +- themes/metal/metal.theme.bash | 54 +- themes/minimal/minimal.theme.bash | 12 +- themes/modern-t/modern-t.theme.bash | 24 +- themes/modern-time/modern-time.theme.bash | 36 +- themes/modern/modern.theme.bash | 48 +- themes/morris/morris.theme.bash | 12 +- themes/n0qorg/n0qorg.theme.bash | 12 +- themes/newin/newin.theme.bash | 15 +- themes/norbu/norbu.theme.bash | 25 +- themes/nwinkler/nwinkler.theme.bash | 27 +- .../nwinkler_random_colors.theme.bash | 39 +- themes/oh-my-posh/oh-my-posh.theme.bash | 3 +- themes/p4helpers.theme.bash | 26 +- themes/parrot/parrot.theme.bash | 48 +- themes/pete/pete.theme.bash | 12 +- .../powerline-multiline.base.bash | 83 +- .../powerline-multiline.theme.bash | 2 +- .../powerline-naked/powerline-naked.base.bash | 40 +- .../powerline-naked.theme.bash | 2 +- .../powerline-plain/powerline-plain.base.bash | 46 +- .../powerline-plain.theme.bash | 2 +- themes/powerline/powerline.base.bash | 439 +++++++-- themes/powerline/powerline.theme.bash | 2 +- themes/powerturk/powerturk.theme.bash | 156 +++- themes/primer/primer.theme.bash | 13 +- themes/pro/pro.theme.bash | 26 +- themes/pure/pure.theme.bash | 13 +- themes/purity/purity.theme.bash | 32 +- themes/radek/radek.theme.bash | 13 +- themes/rainbowbrite/rainbowbrite.theme.bash | 13 +- themes/ramses/ramses.theme.bash | 70 +- themes/rana/rana.theme.bash | 96 +- themes/redline/redline.theme.bash | 2 +- themes/rjorgenson/rjorgenson.theme.bash | 88 +- themes/robbyrussell/robbyrussell.theme.bash | 26 +- themes/roderik/roderik.theme.bash | 16 +- themes/sexy/sexy.theme.bash | 68 +- themes/simple/simple.theme.bash | 13 +- themes/sirup/sirup.theme.bash | 27 +- themes/slick/slick.theme.bash | 48 +- themes/standard/standard.theme.bash | 12 +- themes/tonka/tonka.theme.bash | 51 +- themes/tonotdo/tonotdo.theme.bash | 12 +- themes/tylenol/tylenol.theme.bash | 12 +- themes/wanelo/wanelo.theme.bash | 15 +- themes/zitron/zitron.theme.bash | 11 +- themes/zork/zork.theme.bash | 57 +- 237 files changed, 10838 insertions(+), 2306 deletions(-) diff --git a/completion/available/aliases.completion.bash b/completion/available/aliases.completion.bash index 3e45e960..a1dd7908 100644 --- a/completion/available/aliases.completion.bash +++ b/completion/available/aliases.completion.bash @@ -8,7 +8,12 @@ about-plugin 'Automatic completion of aliases' # http://stackoverflow.com/a/1793178/1228454 # Automatically add completion for all aliases to commands having completion functions -function _bash-it-component-completion-callback-on-init-aliases() { +function _bash-it-component-completion-callback-on-init-aliases() +{ + ############ STACK_TRACE_BUILDER ##################### + Function_Name="${FUNCNAME[0]}" + Function_PATH="${Function_PATH}/${Function_Name}" + ###################################################### local namespace="alias_completion" local tmp_file completion_loader alias_name line completions chars local alias_arg_words new_completion compl_func compl_wrapper alias_defn @@ -27,7 +32,8 @@ function _bash-it-component-completion-callback-on-init-aliases() { tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXXXXX")" || return 1 IFS=$'\n' read -r completion_loader < <(complete -p -D 2> /dev/null) - if [[ "${completion_loader#complete }" =~ '-F'[[:space:]]([[:alnum:]_]+)[[:space:]] ]]; then + if [[ "${completion_loader#complete }" =~ '-F'[[:space:]]([[:alnum:]_]+)[[:space:]] ]] + then completion_loader="${BASH_REMATCH[1]}" else completion_loader="" @@ -43,40 +49,46 @@ function _bash-it-component-completion-callback-on-init-aliases() { alias_defn="${line#*=\'}" # alias definition alias_defn="${alias_defn%\'}" alias_cmd="${alias_defn%%[[:space:]]*}" # first word of alias - if [[ ${alias_defn} == ${alias_cmd} ]]; then - alias_args='' - else - alias_args="${alias_defn#*[[:space:]]}" # everything after first word + if [[ ${alias_defn} == ${alias_cmd} ]] + then + alias_args='' + else + alias_args="${alias_defn#*[[:space:]]}" # everything after first word fi # skip aliases to pipes, boolean control structures and other command lists chars=$'|&;()<>\n' - if [[ "${alias_defn}" =~ [$chars] ]]; then - continue + if [[ "${alias_defn}" =~ [$chars] ]] + then + continue fi # avoid expanding wildcards read -ra alias_arg_words <<< "$alias_args" # skip alias if there is no completion function triggered by the aliased command - if ! _bash-it-array-contains-element "$alias_cmd" "${completions[@]}"; then - if [[ -n "$completion_loader" ]]; then - # force loading of completions for the aliased command - "${completion_loader:?}" "${alias_cmd}" - # 124 means completion loader was successful - [[ $? -eq 124 ]] || continue - completions+=("$alias_cmd") - else - continue - fi + if ! _bash-it-array-contains-element "${alias_cmd}" "${completions[@]}" + then + if [[ -n "$completion_loader" ]] + then + # force loading of completions for the aliased command + "${completion_loader:?}" "${alias_cmd}" + # 124 means completion loader was successful + [[ $? -eq 124 ]] || continue + completions+=("$alias_cmd") + else + continue + fi fi new_completion="$(complete -p "$alias_cmd" 2> /dev/null)" # create a wrapper inserting the alias arguments if any - if [[ -n $alias_args ]]; then + if [[ -n ${alias_args} ]] + then compl_func="${new_completion/#* -F /}" compl_func="${compl_func%% *}" # avoid recursive call loops by ignoring our own functions - if [[ "${compl_func#_"$namespace"::}" == "$compl_func" ]]; then + if [[ "${compl_func#_"$namespace"::}" == "$compl_func" ]] + then compl_wrapper="_${namespace}::${alias_name}" echo "function $compl_wrapper { local compl_word=\${2?} @@ -84,8 +96,9 @@ function _bash-it-component-completion-callback-on-init-aliases() { # check if prec_word is the alias itself. if so, replace it # with the last word in the unaliased form, i.e., # alias_cmd + ' ' + alias_args. - if [[ \$COMP_LINE == \"\$prec_word \$compl_word\" ]]; then - prec_word='$alias_cmd $alias_args' + if [[ \$COMP{_LINE == \"\${prec_word} \${compl_word}\" ]] + then + prec_word='${alias_cmd} $alias_args' prec_word=\${prec_word#* } fi (( COMP_CWORD += ${#alias_arg_words[@]} )) @@ -95,18 +108,23 @@ function _bash-it-component-completion-callback-on-init-aliases() { (( COMP_POINT += \${#COMP_LINE} )) \"$compl_func\" \"$alias_cmd\" \"\$compl_word\" \"\$prec_word\" }" >> "$tmp_file" - new_completion="${new_completion/ -F $compl_func / -F $compl_wrapper }" + new_completion="${new_completion}/ -F ${compl_func} / -F ${compl_wrapper} }" fi fi # replace completion trigger by alias - if [[ -n $new_completion ]]; then - new_completion="${new_completion% *} $alias_name" + if [[ -n ${new_completion} ]] + then + new_completion="${new_completion% *} ${alias_name}" echo "$new_completion" >> "$tmp_file" fi done < <(alias -p) # shellcheck source=/dev/null - source "$tmp_file" && command rm -f "$tmp_file" + source "${tmp_file}" && command rm -f "${tmp_file}" + + ############### Stack_TRACE_BUILDER ################ + Function_PATH="$( dirname ${Function_PATH} )" + #################################################### } _bash-it-component-completion-callback-on-init-aliases diff --git a/completion/available/apm.completion.bash b/completion/available/apm.completion.bash index c3dcfe45..3c4538d7 100644 --- a/completion/available/apm.completion.bash +++ b/completion/available/apm.completion.bash @@ -1,4 +1,4 @@ # shellcheck shell=bash about-completion "apm completion" # shellcheck disable=SC1090 -source "${BASH_IT}"/vendor/github.com/vigo/apm-bash-completion/apm +source "${BASH_IT}/vendor/github.com/vigo/apm-bash-completion/apm" diff --git a/completion/available/awless.completion.bash b/completion/available/awless.completion.bash index 98a5d388..f180ddc5 100644 --- a/completion/available/awless.completion.bash +++ b/completion/available/awless.completion.bash @@ -1,5 +1,6 @@ # shellcheck shell=bash -if _command_exists awless; then +if _command_exists awless + then # shellcheck disable=SC1090 source <(awless completion bash) fi diff --git a/completion/available/awscli.completion.bash b/completion/available/awscli.completion.bash index 6b2c90ff..b0be9cf8 100644 --- a/completion/available/awscli.completion.bash +++ b/completion/available/awscli.completion.bash @@ -1,5 +1,6 @@ # shellcheck shell=bash -if _command_exists aws_completer; then +if _command_exists aws_completer + then complete -C "$(command -v aws_completer)" aws fi diff --git a/completion/available/bash-it.completion.bash b/completion/available/bash-it.completion.bash index 2259e37b..9bc3c49b 100644 --- a/completion/available/bash-it.completion.bash +++ b/completion/available/bash-it.completion.bash @@ -1,12 +1,28 @@ # shellcheck shell=bash -function _compreply_candidates() { +function _compreply_candidates() +{ + ############ STACK_TRACE_BUILDER ##################### + Function_Name="${FUNCNAME[0]}" + Function_PATH="${Function_PATH}/${Function_Name}" + ###################################################### + local IFS=$'\n' read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]}" -- "${cur}") + + ############### Stack_TRACE_BUILDER ################ + Function_PATH="$( dirname ${Function_PATH} )" + #################################################### } -function _bash-it() { +function _bash-it() +{ + ############ STACK_TRACE_BUILDER ##################### + Function_Name="${FUNCNAME[0]}" + Function_PATH="${Function_PATH}/${Function_Name}" + ###################################################### + local cur prev verb file_type candidates suffix COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" @@ -20,7 +36,8 @@ function _bash-it() { _compreply_candidates ;; help) - if [[ "${prev}" == "aliases" ]]; then + if [[ "${prev}" == "aliases" ]] + then candidates=('all' "$(_bash-it-component-list "${file_type}")") _compreply_candidates else @@ -31,7 +48,8 @@ function _bash-it() { profile) case "${file_type}" in load | rm) - if [[ "${file_type}" == "$prev" ]]; then + if [[ "${file_type}" == "$prev" ]] + then candidates=("${BASH_IT}/profiles"/*.bash_it) candidates=("${candidates[@]##*/}") candidates=("${candidates[@]%%.bash_it}") @@ -51,7 +69,8 @@ function _bash-it() { _compreply_candidates ;; update) - if [[ "${cur}" == -* ]]; then + if [[ "${cur}" == -* ]] + then candidates=('-s' '--silent') else candidates=('stable' 'dev') @@ -64,7 +83,8 @@ function _bash-it() { return 0 ;; enable | disable) - if [[ "${verb}" == "enable" ]]; then + if [[ "${verb}" == "enable" ]] + then suffix="disabled" else suffix="enabled" @@ -84,6 +104,10 @@ function _bash-it() { _compreply_candidates ;; esac + + ############### Stack_TRACE_BUILDER ################ + Function_PATH="$( dirname ${Function_PATH} )" + #################################################### } # Activate completion for bash-it and its common misspellings diff --git a/completion/available/brew.completion.bash b/completion/available/brew.completion.bash index 01e5d533..440563f1 100644 --- a/completion/available/brew.completion.bash +++ b/completion/available/brew.completion.bash @@ -5,7 +5,8 @@ about-completion "brew completion" # Load late to make sure `system` completion loads first # BASH_IT_LOAD_PRIORITY: 375 -if [[ "$OSTYPE" != 'darwin'* ]]; then +if [[ "${OSTYPE}" != 'darwin'* ]]; +then _log_warning "unsupported operating system - only 'Darwin' is supported" return 0 fi @@ -13,18 +14,21 @@ fi # Make sure brew is installed _bash_it_homebrew_check || return 0 -if [[ -r "$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d/brew" ]]; then +if [[ -r "${BASH_IT_HOMEBREW_PREFIX}/etc/bash_completion.d/brew" ]] + then # shellcheck disable=1090,1091 - source "$BASH_IT_HOMEBREW_PREFIX/etc/bash_completion.d/brew" + source "${BASH_IT_HOMEBREW_PREFIX}/etc/bash_completion.d/brew" -elif [[ -r "$BASH_IT_HOMEBREW_PREFIX/Library/Contributions/brew_bash_completion.sh" ]]; then +elif [[ -r "${BASH_IT_HOMEBREW_PREFIX}/Library/Contributions/brew_bash_completion.sh" ]] + then # shellcheck disable=1090,1091 - source "$BASH_IT_HOMEBREW_PREFIX/Library/Contributions/brew_bash_completion.sh" + source "${BASH_IT_HOMEBREW_PREFIX}/Library/Contributions/brew_bash_completion.sh" -elif [[ -f "$BASH_IT_HOMEBREW_PREFIX/completions/bash/brew" ]]; then +elif [[ -f "${BASH_IT_HOMEBREW_PREFIX}/completions/bash/brew" ]] + then # For the git-clone based installation, see here for more info: # https://github.com/Bash-it/bash-it/issues/1458 # https://docs.brew.sh/Shell-Completion # shellcheck disable=1090,1091 - source "$BASH_IT_HOMEBREW_PREFIX/completions/bash/brew" + source "${BASH_IT_HOMEBREW_PREFIX}/completions/bash/brew" fi diff --git a/completion/available/bundler.completion.bash b/completion/available/bundler.completion.bash index 663a26d2..077e70cc 100644 --- a/completion/available/bundler.completion.bash +++ b/completion/available/bundler.completion.bash @@ -27,8 +27,13 @@ # To use, source this file on bash: # . completion-bundle -__bundle() { - local bundle_bin=("${_RUBY_COMMAND_PREFIX[@]}" "$1") +function __bundle() +{ + ############ STACK_TRACE_BUILDER ##################### + Function_Name="${FUNCNAME[0]}" + Function_PATH="${Function_PATH}/${Function_Name}" + ###################################################### + local bundle_bin=("${_RUBY_COMMAND_PREFIX[@]}" "${1}") local cur prev _get_comp_words_by_ref -n : cur prev local bundle_command @@ -37,45 +42,46 @@ __bundle() { COMPREPLY=() local options - if [[ $cur = -* && $bundle_command != exec ]]; then + if [[ $cur = -* && $bundle_command != exec ]] + then options="-V --help --no-color --no-no-color --verbose --no-verbose" case $bundle_command in "") - options="$options --version";; + options="${options} --version";; check) - options="$options --dry-run --gemfile --path -r --retry";; + options="${options} --dry-run --gemfile --path -r --retry";; clean) - options="$options --dry-run --force";; + options="${options} --dry-run --force";; config) - options="$options --local --global --delete";; + options="${options} --local --global --delete";; doctor) - options="$options --gemfile --quiet --no-quiet";; + options="${options} --gemfile --quiet --no-quiet";; gem) - options="$options -b -e -t --bin --coc --no-coc --edit --exe + options="${options} -b -e -t --bin --coc --no-coc --edit --exe --no-exe --ext --no-ext --mit --no-mit --test";; init) - options="$options --gemspec";; + options="${options} --gemspec";; install) - options="$options --binstubs --clean --deployment --force --frozen + options="${options} --binstubs --clean --deployment --force --frozen --full-index --gemfile --jobs --local --no-cache --no-prune --path --quiet --retry --shebang --standalone --system --trust-policy --with --without";; lock) - options="$options --add-platform --conservative --full-index + options="${options} --add-platform --conservative --full-index --local --lockfile --major --minor --patch --print --remove-platform --strict --update";; package) - options="$options --all --all-platforms";; + options="${options} --all --all-platforms";; platform) - options="$options --ruby";; + options="${options} --ruby";; show) options="$options --outdated --paths --no-paths";; update) - options="$options --bundler --conservative --force --full-index + options="${options} --bundler --conservative --force --full-index --group --jobs --local --major --minor --patch --quiet --ruby --source --strict";; viz) - options="$options -f -F -R -v -W --file --format --requirements + options="${options} -f -F -R -v -W --file --format --requirements --no-requirements --version --no-version --without";; esac else @@ -86,7 +92,7 @@ __bundle() { platform clean doctor" ;; check | install) - case $prev in + case ${prev} in --binstubs | --path) _filedir -d return;; @@ -99,7 +105,7 @@ __bundle() { esac ;; config) - case $prev in + case ${prev} in config | --*) case $cur in local.*) @@ -140,13 +146,15 @@ __bundle() { esac ;; exec) - if [[ $COMP_CWORD -eq $bundle_command_index ]]; then + if [[ $COMP_CWORD -eq $bundle_command_index ]] + then # Figure out Bundler's binaries dir local bundler_bin=$(__bundle_exec_ruby 'puts Bundler.bundle_path + "bin"') - if [[ -d $bundler_bin ]]; then - local binaries=("$bundler_bin"/*) + if [[ -d ${bundler_bin} ]] + then + local binaries=("${bundler_bin}"/*) # If there are binaries, strip directory name and use them - [[ -f "$binaries" ]] && options="${binaries[@]##*/}" + [[ -f "${binaries}" ]] && options="${binaries[@]##*/}" else # No binaries found; use full command completion COMPREPLY=($(compgen -c -- "$cur")) @@ -168,7 +176,7 @@ __bundle() { esac ;; update) - case $prev in + case ${prev} in --group) __bundle_complete_groups return;; @@ -177,7 +185,7 @@ __bundle() { esac ;; viz) - case $prev in + case ${prev} in -F | --format) options="dot jpg png svg";; -W | --without) @@ -188,16 +196,26 @@ __bundle() { esac fi COMPREPLY=($(compgen -W "${options[*]}" -- "$cur")) + + ############### Stack_TRACE_BUILDER ################ + Function_PATH="$( dirname ${Function_PATH} )" + #################################################### } -__bundle_get_command() { +function __bundle_get_command() +{ + ############ STACK_TRACE_BUILDER ##################### + Function_Name="${FUNCNAME[0]}" + Function_PATH="${Function_PATH}/${Function_Name}" + ###################################################### local i - for ((i=1; i < $COMP_CWORD; ++i)); do + for ((i=1; i < $COMP_CWORD; ++i)) + do local arg=${COMP_WORDS[$i]} - case $arg in + case ${arg} in [^-]*) - bundle_command=$arg + bundle_command=${arg} bundle_command_index=$((i + 1)) return;; --version) @@ -210,19 +228,29 @@ __bundle_get_command() { return;; esac done + + ############### Stack_TRACE_BUILDER ################ + Function_PATH="$( dirname ${Function_PATH} )" + #################################################### } # Provides completion for Bundler group names. # # Multiple groups can be entered, separated either by spaces or by colons. # Input is read from $cur, and the result is directly written to $COMPREPLY. -__bundle_complete_groups() { +function __bundle_complete_groups() +{ + ############ STACK_TRACE_BUILDER ##################### + Function_Name="${FUNCNAME[0]}" + Function_PATH="${Function_PATH}/${Function_Name}" + ###################################################### # Group being currently written local cur_group=${cur##*[ :]} # All groups written before local prefix=${cur%"$cur_group"} local groups=$(__bundle_exec_ruby 'puts Bundler.definition.dependencies.map(&:groups).reduce(:|).map(&:to_s)') - if [[ ! $groups ]]; then + if [[ ! ${groups} ]] + then COMPREPLY=() return fi @@ -230,42 +258,56 @@ __bundle_complete_groups() { # strips it; groups may be separated by ':', ' ', or '\ ' local excluded=$'\ndefault\n'${prefix//[: \'\"\\]/$'\n'} # Include them twice to ensure they are duplicates - groups=$groups$excluded$excluded - COMPREPLY=($(compgen -W "$(sort <<<"$groups" | uniq -u)" -- "$cur_group")) + groups=${groups}${excluded}${excluded} + COMPREPLY=($(compgen -W "$(sort <<<"${groups}" | uniq -u)" -- "${cur_group}")) # Prepend prefix to all entries COMPREPLY=("${COMPREPLY[@]/#/$prefix}") __ltrim_colon_completions "$cur" + + ############### Stack_TRACE_BUILDER ################ + Function_PATH="$( dirname ${Function_PATH} )" + #################################################### } # __bundle_exec_ruby