Skip to content
Myr

[bash] Fix shellcheck warnings

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #516

authored by Junegunn Choi · committed by Junegunn Choi · parent 6cf5483 · Browse files · 2 files+23 added−23 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+23 added−23 removed

  • other:+23 added−23 removed

2 files+23 added−23 removed

modified:shell/completion.bash+18 added-18 removed
73 unmodified lines
74 --margin"7576 case "${prev}" in77 --tiebreak)78 COMPREPLY=( $(compgen -W "length begin end index" -- ${cur}) )78 COMPREPLY=( $(compgen -W "length begin end index" -- "$cur") )79 return 080 ;;81 --color)82 COMPREPLY=( $(compgen -W "dark light 16 bw" -- ${cur}) )82 COMPREPLY=( $(compgen -W "dark light 16 bw" -- "$cur") )83 return 084 ;;85 --history)86 COMPREPLY=()87 return 088 ;;89 esac9091 if [[ ${cur} =~ ^-|\+ ]]; then92 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )91 if [[ "$cur" =~ ^-|\+ ]]; then92 COMPREPLY=( $(compgen -W "${opts}" -- "$cur") )93 return 094 fi9596 return 0
10 unmodified lines
107 $orig "$@"108 elif [ -n "$_fzf_completion_loader" ]; then109 _completion_loader "$@"110 ret=$?111 eval $(complete | \grep "\-F.* $orig_cmd$" | _fzf_orig_completion_filter)112 source $BASH_SOURCE111 eval "$(complete | \grep "\-F.* $orig_cmd$" | _fzf_orig_completion_filter)"112 source "${BASH_SOURCE[0]}"113 return $ret114 fi115}116117__fzf_generic_path_completion() {118 local cur base dir leftover matches trigger cmd fzf119 [ ${FZF_TMUX:-1} -eq 1 ] && fzf="fzf-tmux -d ${FZF_TMUX_HEIGHT:-40%}" || fzf="fzf"120 cmd=$(echo ${COMP_WORDS[0]} | sed 's/[^a-z0-9_=]/_/g')119 [ "${FZF_TMUX:-1}" != 0 ] && fzf="fzf-tmux -d ${FZF_TMUX_HEIGHT:-40%}" || fzf="fzf"120 cmd=$(echo "${COMP_WORDS[0]}" | sed 's/[^a-z0-9_=]/_/g')121 COMPREPLY=()122 trigger=${FZF_COMPLETION_TRIGGER-'**'}123 cur="${COMP_WORDS[COMP_CWORD]}"124 if [[ ${cur} == *"$trigger" ]]; then124 if [[ "$cur" == *"$trigger" ]]; then125 base=${cur:0:${#cur}-${#trigger}}126 eval base=$base126 eval "base=$base"127128 dir="$base"129 while [ 1 ]; do130 if [ -z "$dir" -o -d "$dir" ]; then129 while true; do130 if [ -z "$dir" ] || [ -d "$dir" ]; then131 leftover=${base/#"$dir"}132 leftover=${leftover/#\/}133 [ -z "$dir" ] && dir='.'134 [ "$dir" != "/" ] && dir="${dir/%\//}"135 tput sc136 matches=$(eval "$1 $(printf %q "$dir")" | $fzf $FZF_COMPLETION_OPTS $2 -q "$leftover" | while read item; do136 matches=$(eval "$1 $(printf %q "$dir")" | $fzf $FZF_COMPLETION_OPTS $2 -q "$leftover" | while read -r item; do137 printf "%q$3 " "$item"138 done)139 matches=${matches% }140 if [ -n "$matches" ]; then
17 unmodified lines
158159_fzf_complete() {160 local cur selected trigger cmd fzf post161 post="$(caller 0 | awk '{print $2}')_post"162 type -t $post > /dev/null 2>&1 || post=cat163 [ ${FZF_TMUX:-1} -eq 1 ] && fzf="fzf-tmux -d ${FZF_TMUX_HEIGHT:-40%}" || fzf="fzf"162 type -t "$post" > /dev/null 2>&1 || post=cat163 [ "${FZF_TMUX:-1}" != 0 ] && fzf="fzf-tmux -d ${FZF_TMUX_HEIGHT:-40%}" || fzf="fzf"164165 cmd=$(echo ${COMP_WORDS[0]} | sed 's/[^a-z0-9_=]/_/g')165 cmd=$(echo "${COMP_WORDS[0]}" | sed 's/[^a-z0-9_=]/_/g')166 trigger=${FZF_COMPLETION_TRIGGER-'**'}167 cur="${COMP_WORDS[COMP_CWORD]}"168 if [[ ${cur} == *"$trigger" ]]; then168 if [[ "$cur" == *"$trigger" ]]; then169 cur=${cur:0:${#cur}-${#trigger}}170171 tput sc172 selected=$(cat | $fzf $FZF_COMPLETION_OPTS $1 -q "$cur" | $post | tr '\n' ' ')
26 unmodified lines
199_fzf_complete_kill() {200 [ -n "${COMP_WORDS[COMP_CWORD]}" ] && return 1201202 local selected fzf203 [ ${FZF_TMUX:-1} -eq 1 ] && fzf="fzf-tmux -d ${FZF_TMUX_HEIGHT:-40%}" || fzf="fzf"203 [ "${FZF_TMUX:-1}" != 0 ] && fzf="fzf-tmux -d ${FZF_TMUX_HEIGHT:-40%}" || fzf="fzf"204 tput sc205 selected=$(ps -ef | sed 1d | $fzf -m $FZF_COMPLETION_OPTS | awk '{print $2}' | tr '\n' ' ')206 tput rc207
105 unmodified lines
modified:shell/key-bindings.bash+5 added-5 removed