-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2274 from seefood/ira/shellcheck_2
- Loading branch information
Showing
9 changed files
with
198 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck shell=bash | ||
# Bash completion support for Capistrano. | ||
|
||
export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/} | ||
|
||
_capcomplete() { | ||
if [ -f Capfile ]; then | ||
recent=`ls -t .cap_tasks~ Capfile **/*.cap 2> /dev/null | head -n 1` | ||
if [[ $recent != '.cap_tasks~' ]]; then | ||
cap --version | grep 'Capistrano v2.' > /dev/null | ||
if [ $? -eq 0 ]; then | ||
# Capistrano 2.x | ||
cap --tool --verbose --tasks | cut -d " " -f 2 > .cap_tasks~ | ||
else | ||
# Capistrano 3.x | ||
cap --all --tasks | cut -d " " -f 2 > .cap_tasks~ | ||
fi | ||
fi | ||
COMPREPLY=($(compgen -W "`cat .cap_tasks~`" -- ${COMP_WORDS[COMP_CWORD]})) | ||
return 0 | ||
fi | ||
if [ -f Capfile ]; then | ||
# shellcheck disable=SC2012 | ||
recent=$(ls -t .cap_tasks~ Capfile ./**/*.cap 2> /dev/null | head -n 1) | ||
if [[ $recent != '.cap_tasks~' ]]; then | ||
if cap --version | grep -q 'Capistrano v2.'; then | ||
# Capistrano 2.x | ||
cap --tool --verbose --tasks | cut -d " " -f 2 > .cap_tasks~ | ||
else | ||
# Capistrano 3.x | ||
cap --all --tasks | cut -d " " -f 2 > .cap_tasks~ | ||
fi | ||
fi | ||
# shellcheck disable=SC2207 | ||
COMPREPLY=($(compgen -W "$(cat .cap_tasks~)" -- "${COMP_WORDS[COMP_CWORD]}")) | ||
return 0 | ||
fi | ||
} | ||
|
||
complete -o default -o nospace -F _capcomplete cap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
#!/usr/bin/env bash | ||
# shellcheck shell=bash | ||
# Bash completion support for the 'dirs' plugin (commands G, R). | ||
|
||
_dirs-complete() { | ||
local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}" | ||
local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}" | ||
|
||
# parse all defined shortcuts from ~/.dirs | ||
if [ -r "$HOME/.dirs" ]; then | ||
COMPREPLY=($(compgen -W "$(grep -v '^#' ~/.dirs | sed -e 's/\(.*\)=.*/\1/')" -- ${CURRENT_PROMPT}) ) | ||
fi | ||
# parse all defined shortcuts from ~/.dirs | ||
if [ -r "$HOME/.dirs" ]; then | ||
# shellcheck disable=SC2207 | ||
COMPREPLY=($(compgen -W "$(grep -v '^#' ~/.dirs | sed -e 's/\(.*\)=.*/\1/')" -- "${CURRENT_PROMPT}")) | ||
fi | ||
|
||
return 0 | ||
return 0 | ||
} | ||
|
||
complete -o default -o nospace -F _dirs-complete G R |
Oops, something went wrong.