Skip to content

Commit

Permalink
Merge pull request #2274 from seefood/ira/shellcheck_2
Browse files Browse the repository at this point in the history
  • Loading branch information
seefood authored Jan 12, 2025
2 parents d7439ab + 0a92d76 commit 9a4af68
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 219 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
bats-test:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-14, macos-15]
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-14]

runs-on: ${{ matrix.os }}

Expand Down
13 changes: 7 additions & 6 deletions clean_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ completion/available/awscli.completion.bash
completion/available/bash-it.completion.bash
completion/available/brew.completion.bash
completion/available/bundler.completion.bash
completion/available/capistrano.completion.bash
completion/available/cargo.completion.bash
completion/available/composer.completion.bash
completion/available/conda.completion.bash
completion/available/consul.completion.bash
completion/available/dart.completion.bash
completion/available/dirs.completion.bash
completion/available/django.completion.bash
completion/available/dmidecode.completion.bash
completion/available/docker-compose.completion.bash
completion/available/docker-machine.completion.bash
completion/available/docker.completion.bash
completion/available/dotnet.completion.bash
Expand Down Expand Up @@ -130,18 +133,16 @@ plugins/available/pyenv.plugin.bash
plugins/available/python.plugin.bash
plugins/available/rbenv.plugin.bash
plugins/available/ruby.plugin.bash
plugins/available/sudo.plugin.bash
plugins/available/textmate.plugin.bash
plugins/available/thefuck.plugin.bash
plugins/available/todo.plugin.bash
plugins/available/url.plugin.bash
plugins/available/virtualenv.plugin.bash
plugins/available/xterm.plugin.bash
plugins/available/z_autoenv.plugin.bash
plugins/available/zoxide.plugin.bash

# tests
#
test/completion/aliases.completion.bats
test/run
test/test_helper.bash

# themes
#
themes/90210
Expand Down
33 changes: 17 additions & 16 deletions completion/available/capistrano.completion.bash
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
15 changes: 8 additions & 7 deletions completion/available/dirs.completion.bash
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
Loading

0 comments on commit 9a4af68

Please sign in to comment.