Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shfmt and shellcheck for a few more files #2274

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
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
Loading