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

whitespace autofix stuff, and shfmt cleanup #2265

Merged
merged 9 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clean_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ themes/brainy
themes/brunton
themes/candy
themes/clean
themes/doubletime
themes/easy
themes/elixr
themes/essential
Expand All @@ -175,7 +176,7 @@ themes/pete
themes/powerline
themes/pure
themes/purity

themes/rjorgenson

# vendor init files
#
Expand Down
138 changes: 67 additions & 71 deletions completion/available/fabric.completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,103 +31,99 @@
# https://github.com/ricobl/dotfiles/blob/master/bin/fab_bash_completion
#


# Use cache files for fab tasks or not.
# If set to "false" command "fab --shortlist" will be executed every time.
export FAB_COMPLETION_CACHE_TASKS=true

# File name where tasks cache will be stored (in current dir).
export FAB_COMPLETION_CACHED_TASKS_FILENAME=".fab_tasks~"


# Set command to get time of last file modification as seconds since Epoch
case "$OSTYPE" in
'darwin'*|'freebsd'*)
__FAB_COMPLETION_MTIME_COMMAND="stat -f '%m'"
;;
*)
__FAB_COMPLETION_MTIME_COMMAND="stat -c '%Y'"
;;
'darwin'* | 'freebsd'*)
__FAB_COMPLETION_MTIME_COMMAND="stat -f '%m'"
;;
*)
__FAB_COMPLETION_MTIME_COMMAND="stat -c '%Y'"
;;
esac


#
# Get time of last fab cache file modification as seconds since Epoch
#
function __fab_chache_mtime() {
${__FAB_COMPLETION_MTIME_COMMAND} \
$FAB_COMPLETION_CACHED_TASKS_FILENAME | xargs -n 1 expr
${__FAB_COMPLETION_MTIME_COMMAND} \
$FAB_COMPLETION_CACHED_TASKS_FILENAME | xargs -n 1 expr
}


#
# Get time of last fabfile file/module modification as seconds since Epoch
#
function __fab_fabfile_mtime() {
local f="fabfile"
if [[ -e "$f.py" ]]; then
${__FAB_COMPLETION_MTIME_COMMAND} "$f.py" | xargs -n 1 expr
else
# Suppose that it's a fabfile dir
find $f/*.py -exec ${__FAB_COMPLETION_MTIME_COMMAND} {} + \
| xargs -n 1 expr | sort -n -r | head -1
fi
local f="fabfile"
if [[ -e "$f.py" ]]; then
${__FAB_COMPLETION_MTIME_COMMAND} "$f.py" | xargs -n 1 expr
else
# Suppose that it's a fabfile dir
find $f/*.py -exec ${__FAB_COMPLETION_MTIME_COMMAND} {} + \
| xargs -n 1 expr | sort -n -r | head -1
fi
}


#
# Completion for "fab" command
#
function __fab_completion() {
# Return if "fab" command doesn't exists
[[ -e `which fab 2> /dev/null` ]] || return 0

# Variables to hold the current word and possible matches
local cur="${COMP_WORDS[COMP_CWORD]}"
local opts=()

# Generate possible matches and store them in variable "opts"
case "${cur}" in
-*)
if [[ -z "${__FAB_COMPLETION_LONG_OPT}" ]]; then
export __FAB_COMPLETION_LONG_OPT=$(
fab --help | grep -E -o "\-\-[A-Za-z_\-]+\=?" | sort -u)
fi
opts="${__FAB_COMPLETION_LONG_OPT}"
;;

# Completion for short options is not nessary.
# It's left here just for history.
# -*)
# if [[ -z "${__FAB_COMPLETION_SHORT_OPT}" ]]; then
# export __FAB_COMPLETION_SHORT_OPT=$(
# fab --help | grep -E -o "^ +\-[A-Za-z_\]" | sort -u)
# fi
# opts="${__FAB_COMPLETION_SHORT_OPT}"
# ;;

*)
# If "fabfile.py" or "fabfile" dir with "__init__.py" file exists
local f="fabfile"
if [[ -e "$f.py" || (-d "$f" && -e "$f/__init__.py") ]]; then
# Build a list of the available tasks
if $FAB_COMPLETION_CACHE_TASKS; then
# If use cache
if [[ ! -s ${FAB_COMPLETION_CACHED_TASKS_FILENAME} ||
$(__fab_fabfile_mtime) -gt $(__fab_chache_mtime) ]]; then
fab --shortlist > ${FAB_COMPLETION_CACHED_TASKS_FILENAME} \
2> /dev/null
fi
opts=$(cat ${FAB_COMPLETION_CACHED_TASKS_FILENAME})
else
# Without cache
opts=$(fab --shortlist 2> /dev/null)
fi
fi
;;
esac

# Set possible completions
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
# Return if "fab" command doesn't exists
[[ -e $(which fab 2> /dev/null) ]] || return 0

# Variables to hold the current word and possible matches
local cur="${COMP_WORDS[COMP_CWORD]}"
local opts=()

# Generate possible matches and store them in variable "opts"
case "${cur}" in
-*)
if [[ -z "${__FAB_COMPLETION_LONG_OPT}" ]]; then
export __FAB_COMPLETION_LONG_OPT=$(
fab --help | grep -E -o "\-\-[A-Za-z_\-]+\=?" | sort -u
)
fi
opts="${__FAB_COMPLETION_LONG_OPT}"
;;

# Completion for short options is not nessary.
# It's left here just for history.
# -*)
# if [[ -z "${__FAB_COMPLETION_SHORT_OPT}" ]]; then
# export __FAB_COMPLETION_SHORT_OPT=$(
# fab --help | grep -E -o "^ +\-[A-Za-z_\]" | sort -u)
# fi
# opts="${__FAB_COMPLETION_SHORT_OPT}"
# ;;

*)
# If "fabfile.py" or "fabfile" dir with "__init__.py" file exists
local f="fabfile"
if [[ -e "$f.py" || (-d "$f" && -e "$f/__init__.py") ]]; then
# Build a list of the available tasks
if $FAB_COMPLETION_CACHE_TASKS; then
# If use cache
if [[ ! -s ${FAB_COMPLETION_CACHED_TASKS_FILENAME} ||
$(__fab_fabfile_mtime) -gt $(__fab_chache_mtime) ]]; then
fab --shortlist > ${FAB_COMPLETION_CACHED_TASKS_FILENAME} \
2> /dev/null
fi
opts=$(cat ${FAB_COMPLETION_CACHED_TASKS_FILENAME})
else
# Without cache
opts=$(fab --shortlist 2> /dev/null)
fi
fi
;;
esac

# Set possible completions
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
}
complete -o default -o nospace -F __fab_completion fab
126 changes: 58 additions & 68 deletions completion/available/git_flow.completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
#
# Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/)

_git_flow ()
{
_git_flow() {
local subcommands="init feature release hotfix"
local subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ]; then
Expand All @@ -55,26 +54,25 @@ _git_flow ()
fi

case "$subcommand" in
feature)
__git_flow_feature
return
;;
release)
__git_flow_release
return
;;
hotfix)
__git_flow_hotfix
return
;;
*)
COMPREPLY=()
;;
feature)
__git_flow_feature
return
;;
release)
__git_flow_release
return
;;
hotfix)
__git_flow_hotfix
return
;;
*)
COMPREPLY=()
;;
esac
}

__git_flow_feature ()
{
__git_flow_feature() {
local subcommands="list start finish publish track diff rebase checkout pull"
local subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ]; then
Expand All @@ -83,45 +81,41 @@ __git_flow_feature ()
fi

case "$subcommand" in
pull)
__gitcomp "$(__git_remotes)"
return
;;
checkout|finish|diff|rebase)
__gitcomp "$(__git_flow_list_features)"
return
;;
publish)
__gitcomp "$(comm -23 <(__git_flow_list_features) <(__git_flow_list_remote_features))"
return
;;
track)
__gitcomp "$(__git_flow_list_remote_features)"
return
;;
*)
COMPREPLY=()
;;
pull)
__gitcomp "$(__git_remotes)"
return
;;
checkout | finish | diff | rebase)
__gitcomp "$(__git_flow_list_features)"
return
;;
publish)
__gitcomp "$(comm -23 <(__git_flow_list_features) <(__git_flow_list_remote_features))"
return
;;
track)
__gitcomp "$(__git_flow_list_remote_features)"
return
;;
*)
COMPREPLY=()
;;
esac
}

__git_flow_list_features ()
{
__git_flow_list_features() {
git flow feature list 2> /dev/null | tr -d ' |*'
}

__git_flow_list_remote_features ()
{
__git_flow_list_remote_features() {
git branch -r 2> /dev/null | grep "origin/$(__git_flow_feature_prefix)" | awk '{ sub(/^origin\/$(__git_flow_feature_prefix)/, "", $1); print }'
}

__git_flow_feature_prefix ()
{
__git_flow_feature_prefix() {
git config gitflow.prefix.feature 2> /dev/null || echo "feature/"
}

__git_flow_release ()
{
__git_flow_release() {
local subcommands="list start finish"
local subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ]; then
Expand All @@ -130,24 +124,22 @@ __git_flow_release ()
fi

case "$subcommand" in
finish)
__gitcomp "$(__git_flow_list_releases)"
return
;;
*)
COMPREPLY=()
;;
finish)
__gitcomp "$(__git_flow_list_releases)"
return
;;
*)
COMPREPLY=()
;;
esac

}

__git_flow_list_releases ()
{
__git_flow_list_releases() {
git flow release list 2> /dev/null
}

__git_flow_hotfix ()
{
__git_flow_hotfix() {
local subcommands="list start finish"
local subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ]; then
Expand All @@ -156,23 +148,21 @@ __git_flow_hotfix ()
fi

case "$subcommand" in
finish)
__gitcomp "$(__git_flow_list_hotfixes)"
return
;;
*)
COMPREPLY=()
;;
finish)
__gitcomp "$(__git_flow_list_hotfixes)"
return
;;
*)
COMPREPLY=()
;;
esac
}

__git_flow_list_hotfixes ()
{
__git_flow_list_hotfixes() {
git flow hotfix list 2> /dev/null
}

# temporarily wrap __git_find_on_cmdline() for backwards compatibility
if ! _command_exists __git_find_subcommand
then
if ! _command_exists __git_find_subcommand; then
alias __git_find_subcommand=__git_find_on_cmdline
fi
Loading
Loading