add full support of stack strace

pull/2209/head
Doraken 2023-07-22 00:25:47 +02:00
parent 1d2687f1f4
commit 2e3c036102
221 changed files with 10122 additions and 1177 deletions

View File

@ -9,4 +9,4 @@ about-alias 'the silver searcher (ag) aliases'
# -F (-F or --quit-if-one-screen) Auto exit if <1 screen # -F (-F or --quit-if-one-screen) Auto exit if <1 screen
# -X (-X or --no-init) Disable termcap init & deinit # -X (-X or --no-init) Disable termcap init & deinit
alias ag='ag --smart-case --pager="less -MIRFX"' alias ag=$("ag --smart-case --pager="less -MIRFX")

View File

@ -29,6 +29,10 @@ function _set_pkg_aliases()
alias pkgfiles='dpkg --listfiles' alias pkgfiles='dpkg --listfiles'
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_set_pkg_aliases _set_pkg_aliases

View File

@ -24,6 +24,10 @@ function _set_pkg_aliases()
# see only response headers from a get request # see only response headers from a get request
alias clhead='curl -D - -so /dev/null' alias clhead='curl -D - -so /dev/null'
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_set_pkg_aliases _set_pkg_aliases

View File

@ -83,7 +83,7 @@ function catt()
Function_PATH="${Function_PATH}/${Function_Name}" Function_PATH="${Function_PATH}/${Function_Name}"
###################################################### ######################################################
for i in "$@"; do for i in "${@}"; do
if [[ -d "$i" ]] if [[ -d "$i" ]]
then then
ls "$i" ls "$i"
@ -91,6 +91,10 @@ function catt()
cat "$i" cat "$i"
fi fi
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# The Bash-it aliases were moved to the `bash-it.aliases.bash` file. The intent of this # The Bash-it aliases were moved to the `bash-it.aliases.bash` file. The intent of this

View File

@ -207,7 +207,11 @@ function gdv()
Function_PATH="${Function_PATH}/${Function_Name}" Function_PATH="${Function_PATH}/${Function_Name}"
###################################################### ######################################################
git diff --ignore-all-space "$@" | vim -R - git diff --ignore-all-space "${@}" | vim -R -
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function get_default_branch() function get_default_branch()
@ -223,4 +227,8 @@ function get_default_branch()
else else
echo master echo master
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -10,5 +10,5 @@ alias vimh='vim -c ":h | only"'
# open vim in new tab is taken from # open vim in new tab is taken from
# http://stackoverflow.com/questions/936501/let-gvim-always-run-a-single-instancek # http://stackoverflow.com/questions/936501/let-gvim-always-run-a-single-instancek
_command_exists mvim && function mvimt { command mvim --remote-tab-silent "$@" || command mvim "$@"; } _command_exists mvim && function mvimt { command mvim --remote-tab-silent "${@}" || command mvim "${@}"; }
_command_exists gvim && function gvimt { command gvim --remote-tab-silent "$@" || command gvim "$@"; } _command_exists gvim && function gvimt { command gvim --remote-tab-silent "${@}" || command gvim "${@}"; }

View File

@ -121,6 +121,10 @@ function _bash-it-component-completion-callback-on-init-aliases()
done < <(alias -p) done < <(alias -p)
# shellcheck source=/dev/null # shellcheck source=/dev/null
source "$tmp_file" && command rm -f "$tmp_file" source "$tmp_file" && command rm -f "$tmp_file"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_bash-it-component-completion-callback-on-init-aliases _bash-it-component-completion-callback-on-init-aliases

View File

@ -10,6 +10,10 @@ function _compreply_candidates()
local IFS=$'\n' local IFS=$'\n'
read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]}" -- "${cur}") read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]}" -- "${cur}")
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it() function _bash-it()
@ -100,6 +104,10 @@ function _bash-it()
_compreply_candidates _compreply_candidates
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Activate completion for bash-it and its common misspellings # Activate completion for bash-it and its common misspellings

View File

@ -27,7 +27,12 @@
# To use, source this file on bash: # To use, source this file on bash:
# . completion-bundle # . completion-bundle
function __bundle() { function __bundle()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local bundle_bin=("${_RUBY_COMMAND_PREFIX[@]}" "${1}") local bundle_bin=("${_RUBY_COMMAND_PREFIX[@]}" "${1}")
local cur prev local cur prev
_get_comp_words_by_ref -n : cur prev _get_comp_words_by_ref -n : cur prev
@ -191,9 +196,18 @@ function __bundle() {
esac esac
fi fi
COMPREPLY=($(compgen -W "${options[*]}" -- "$cur")) COMPREPLY=($(compgen -W "${options[*]}" -- "$cur"))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __bundle_get_command() { function __bundle_get_command()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local i local i
for ((i=1; i < $COMP_CWORD; ++i)); do for ((i=1; i < $COMP_CWORD; ++i)); do
local arg=${COMP_WORDS[$i]} local arg=${COMP_WORDS[$i]}
@ -213,13 +227,22 @@ function __bundle_get_command() {
return;; return;;
esac esac
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Provides completion for Bundler group names. # Provides completion for Bundler group names.
# #
# Multiple groups can be entered, separated either by spaces or by colons. # Multiple groups can be entered, separated either by spaces or by colons.
# Input is read from $cur, and the result is directly written to $COMPREPLY. # Input is read from $cur, and the result is directly written to $COMPREPLY.
function __bundle_complete_groups() { function __bundle_complete_groups()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# Group being currently written # Group being currently written
local cur_group=${cur##*[ :]} local cur_group=${cur##*[ :]}
# All groups written before # All groups written before
@ -239,13 +262,22 @@ function __bundle_complete_groups() {
# Prepend prefix to all entries # Prepend prefix to all entries
COMPREPLY=("${COMPREPLY[@]/#/$prefix}") COMPREPLY=("${COMPREPLY[@]/#/$prefix}")
__ltrim_colon_completions "$cur" __ltrim_colon_completions "$cur"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# __bundle_exec_ruby <script> [args...] # __bundle_exec_ruby <script> [args...]
# #
# Runs a Ruby script with Bundler loaded. # Runs a Ruby script with Bundler loaded.
# Results may be cached. # Results may be cached.
function __bundle_exec_ruby() { function __bundle_exec_ruby()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local bundle_bin=(${bundle_bin[@]:-bundle}) local bundle_bin=(${bundle_bin[@]:-bundle})
# Lockfile is inferred here, and might not be correct (for example, when # Lockfile is inferred here, and might not be correct (for example, when
# running on a subdirectory). However, a wrong file path won't be a # running on a subdirectory). However, a wrong file path won't be a
@ -264,7 +296,7 @@ function __bundle_exec_ruby() {
then then
tail -n +2 -- "$cachefile" tail -n +2 -- "$cachefile"
else else
local output=$("${bundle_bin[@]}" exec ruby -e "$@" 2>/dev/null) local output=$("${bundle_bin[@]}" exec ruby -e "${@}" 2>/dev/null)
if [[ $? -eq 0 ]] if [[ $? -eq 0 ]]
then then
(mkdir -p -- "$cachedir" && (mkdir -p -- "$cachedir" &&
@ -272,6 +304,10 @@ function __bundle_exec_ruby() {
echo "$output" echo "$output"
fi fi
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -3,7 +3,12 @@
export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/} export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
function _capcomplete() { function _capcomplete()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if [ -f Capfile ] if [ -f Capfile ]
then then
recent=`ls -t .cap_tasks~ Capfile **/*.cap 2> /dev/null | head -n 1` recent=`ls -t .cap_tasks~ Capfile **/*.cap 2> /dev/null | head -n 1`
@ -22,6 +27,10 @@ function _capcomplete() {
COMPREPLY=($(compgen -W "`cat .cap_tasks~`" -- ${COMP_WORDS[COMP_CWORD]})) COMPREPLY=($(compgen -W "`cat .cap_tasks~`" -- ${COMP_WORDS[COMP_CWORD]}))
return 0 return 0
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -o default -o nospace -F _capcomplete cap complete -o default -o nospace -F _capcomplete cap

View File

@ -133,6 +133,10 @@ function __composer_completion()
return 0 return 0
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -o default -F __composer_completion composer complete -o default -F __composer_completion composer

View File

@ -1,6 +1,11 @@
# shellcheck shell=bash # shellcheck shell=bash
function __dart_completion() { function __dart_completion()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# shellcheck disable=SC2155 # shellcheck disable=SC2155
local prev=$(_get_pword) local prev=$(_get_pword)
# shellcheck disable=SC2155 # shellcheck disable=SC2155
@ -43,6 +48,10 @@ function __dart_completion() {
COMPREPLY=($(compgen -W "$HELP $VERBOSE --version --enable-analytics --disable-analytics help analyze compile create format pub run test" -- "$curr")) COMPREPLY=($(compgen -W "$HELP $VERBOSE --version --enable-analytics --disable-analytics help analyze compile create format pub run test" -- "$curr"))
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F __dart_completion dart complete -F __dart_completion dart

View File

@ -1,7 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Bash completion support for the 'dirs' plugin (commands G, R). # Bash completion support for the 'dirs' plugin (commands G, R).
function _dirs-complete() { function _dirs-complete()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}" local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}"
# parse all defined shortcuts from ~/.dirs # parse all defined shortcuts from ~/.dirs
@ -11,6 +16,10 @@ function _dirs-complete() {
fi fi
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -o default -o nospace -F _dirs-complete G R complete -o default -o nospace -F _dirs-complete G R

View File

@ -1,6 +1,11 @@
# shellcheck shell=bash # shellcheck shell=bash
function __dmidecode_completion() { function __dmidecode_completion()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# shellcheck disable=SC2155 # shellcheck disable=SC2155
local prev=$(_get_pword) local prev=$(_get_pword)
# shellcheck disable=SC2155 # shellcheck disable=SC2155
@ -17,6 +22,10 @@ function __dmidecode_completion() {
COMPREPLY=($(compgen -W "-d --dev-mem -h --help -q --quiet -s --string -t --type -H --handle -u --dump{,-bin} --from-dump --no-sysfs --oem-string -V --version" -- "$curr")) COMPREPLY=($(compgen -W "-d --dev-mem -h --help -q --quiet -s --string -t --type -H --handle -u --dump{,-bin} --from-dump --no-sysfs --oem-string -V --version" -- "$curr"))
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F __dmidecode_completion dmidecode complete -F __dmidecode_completion dmidecode

View File

@ -34,28 +34,56 @@
__docker_compose_previous_extglob_setting=$(shopt -p extglob) __docker_compose_previous_extglob_setting=$(shopt -p extglob)
shopt -s extglob shopt -s extglob
function __docker_compose_q() { function __docker_compose_q()
docker-compose 2>/dev/null "${top_level_options[@]}" "$@" {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
docker-compose 2>/dev/null "${top_level_options[@]}" "${@}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Transforms a multiline list of strings into a single line string # Transforms a multiline list of strings into a single line string
# with the words separated by "|". # with the words separated by "|".
function __docker_compose_to_alternatives() { function __docker_compose_to_alternatives()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local parts=( $1 ) local parts=( $1 )
local IFS='|' local IFS='|'
echo "${parts[*]}" echo "${parts[*]}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Transforms a multiline list of options into an extglob pattern # Transforms a multiline list of options into an extglob pattern
# suitable for use in case statements. # suitable for use in case statements.
function __docker_compose_to_extglob() { function __docker_compose_to_extglob()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local extglob=$( __docker_compose_to_alternatives "${1}" ) local extglob=$( __docker_compose_to_alternatives "${1}" )
echo "@($extglob)" echo "@($extglob)"
} }
# Determines whether the option passed as the first argument exist on # Determines whether the option passed as the first argument exist on
# the commandline. The option may be a pattern, e.g. `--force|-f`. # the commandline. The option may be a pattern, e.g. `--force|-f`.
function __docker_compose_has_option() { function __docker_compose_has_option()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local pattern="${1}" local pattern="${1}"
for (( i=2; i < $cword; ++i)); do for (( i=2; i < $cword; ++i)); do
if [[ ${words[$i]} =~ ^($pattern)$ ]] if [[ ${words[$i]} =~ ^($pattern)$ ]]
@ -64,12 +92,21 @@ function __docker_compose_has_option() {
fi fi
done done
return 1 return 1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Returns `key` if we are currently completing the value of a map option (`key=value`) # Returns `key` if we are currently completing the value of a map option (`key=value`)
# which matches the extglob passed in as an argument. # which matches the extglob passed in as an argument.
# This function is needed for key-specific completions. # This function is needed for key-specific completions.
function __docker_compose_map_key_of_current_option() { function __docker_compose_map_key_of_current_option()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local glob="${1}" local glob="${1}"
local key glob_pos local key glob_pos
@ -92,37 +129,82 @@ function __docker_compose_map_key_of_current_option() {
[ "${words[$glob_pos]}" = "=" ] && ((glob_pos--)) # --option=key=value syntax [ "${words[$glob_pos]}" = "=" ] && ((glob_pos--)) # --option=key=value syntax
[[ ${words[$glob_pos]} == @($glob) ]] && echo "$key" [[ ${words[$glob_pos]} == @($glob) ]] && echo "$key"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# suppress trailing whitespace # suppress trailing whitespace
function __docker_compose_nospace() { function __docker_compose_nospace()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# compopt is not available in ancient bash versions # compopt is not available in ancient bash versions
type compopt &>/dev/null && compopt -o nospace type compopt &>/dev/null && compopt -o nospace
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Outputs a list of all defined services, regardless of their running state. # Outputs a list of all defined services, regardless of their running state.
# Arguments for `docker-compose ps` may be passed in order to filter the service list, # Arguments for `docker-compose ps` may be passed in order to filter the service list,
# e.g. `status=running`. # e.g. `status=running`.
function __docker_compose_services() { function __docker_compose_services()
__docker_compose_q ps --services "$@" {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
__docker_compose_q ps --services "${@}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Applies completion of services based on the current value of `$cur`. # Applies completion of services based on the current value of `$cur`.
# Arguments for `docker-compose ps` may be passed in order to filter the service list, # Arguments for `docker-compose ps` may be passed in order to filter the service list,
# see `__docker_compose_services`. # see `__docker_compose_services`.
function __docker_compose_complete_services() { function __docker_compose_complete_services()
COMPREPLY=( $(compgen -W "$(__docker_compose_services "$@")" -- "$cur") ) {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
COMPREPLY=( $(compgen -W "$(__docker_compose_services "${@}")" -- "$cur") )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# The services for which at least one running container exists # The services for which at least one running container exists
function __docker_compose_complete_running_services() { function __docker_compose_complete_running_services()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local names=$(__docker_compose_services --filter status=running) local names=$(__docker_compose_services --filter status=running)
COMPREPLY=( $(compgen -W "$names" -- "$cur") ) COMPREPLY=( $(compgen -W "$names" -- "$cur") )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_build() { function _docker_compose_build()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
--build-arg) --build-arg)
COMPREPLY=( $( compgen -e -- "$cur" ) ) COMPREPLY=( $( compgen -e -- "$cur" ) )
@ -142,10 +224,19 @@ function _docker_compose_build() {
__docker_compose_complete_services --filter source=build __docker_compose_complete_services --filter source=build
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_bundle() { function _docker_compose_bundle()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
--output|-o) --output|-o)
_filedir _filedir
@ -154,10 +245,19 @@ function _docker_compose_bundle() {
esac esac
COMPREPLY=( $( compgen -W "--push-images --help --output -o" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--push-images --help --output -o" -- "$cur" ) )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_config() { function _docker_compose_config()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
--hash) --hash)
if [[ $cur == \\* ]] if [[ $cur == \\* ]]
@ -171,10 +271,19 @@ function _docker_compose_config() {
esac esac
COMPREPLY=( $( compgen -W "--hash --help --quiet -q --resolve-image-digests --services --volumes" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--hash --help --quiet -q --resolve-image-digests --services --volumes" -- "$cur" ) )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_create() { function _docker_compose_create()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--build --force-recreate --help --no-build --no-recreate" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--build --force-recreate --help --no-build --no-recreate" -- "$cur" ) )
@ -183,10 +292,19 @@ function _docker_compose_create() {
__docker_compose_complete_services __docker_compose_complete_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_docker_compose() { function _docker_compose_docker_compose()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
--tlscacert|--tlscert|--tlskey) --tlscacert|--tlscert|--tlskey)
_filedir _filedir
@ -217,10 +335,19 @@ function _docker_compose_docker_compose() {
COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) ) COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_down() { function _docker_compose_down()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
--rmi) --rmi)
COMPREPLY=( $( compgen -W "all local" -- "$cur" ) ) COMPREPLY=( $( compgen -W "all local" -- "$cur" ) )
@ -236,10 +363,19 @@ function _docker_compose_down() {
COMPREPLY=( $( compgen -W "--help --rmi --timeout -t --volumes -v --remove-orphans" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--help --rmi --timeout -t --volumes -v --remove-orphans" -- "$cur" ) )
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_events() { function _docker_compose_events()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
--json) --json)
return return
@ -254,10 +390,19 @@ function _docker_compose_events() {
__docker_compose_complete_services __docker_compose_complete_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_exec() { function _docker_compose_exec()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
--index|--user|-u|--workdir|-w) --index|--user|-u|--workdir|-w)
return return
@ -272,14 +417,32 @@ function _docker_compose_exec() {
__docker_compose_complete_running_services __docker_compose_complete_running_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_help() { function _docker_compose_help()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) ) COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_images() { function _docker_compose_images()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--help --quiet -q" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--help --quiet -q" -- "$cur" ) )
@ -288,9 +451,18 @@ function _docker_compose_images() {
__docker_compose_complete_services __docker_compose_complete_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_kill() { function _docker_compose_kill()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
-s) -s)
COMPREPLY=( $( compgen -W "SIGHUP SIGINT SIGKILL SIGUSR1 SIGUSR2" -- "$(echo $cur | tr '[:lower:]' '[:upper:]')" ) ) COMPREPLY=( $( compgen -W "SIGHUP SIGINT SIGKILL SIGUSR1 SIGUSR2" -- "$(echo $cur | tr '[:lower:]' '[:upper:]')" ) )
@ -306,10 +478,19 @@ function _docker_compose_kill() {
__docker_compose_complete_running_services __docker_compose_complete_running_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_logs() { function _docker_compose_logs()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
--tail) --tail)
return return
@ -324,10 +505,19 @@ function _docker_compose_logs() {
__docker_compose_complete_services __docker_compose_complete_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_pause() { function _docker_compose_pause()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
@ -336,10 +526,19 @@ function _docker_compose_pause() {
__docker_compose_complete_running_services __docker_compose_complete_running_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_port() { function _docker_compose_port()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
--protocol) --protocol)
COMPREPLY=( $( compgen -W "tcp udp" -- "$cur" ) ) COMPREPLY=( $( compgen -W "tcp udp" -- "$cur" ) )
@ -358,10 +557,19 @@ function _docker_compose_port() {
__docker_compose_complete_services __docker_compose_complete_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_ps() { function _docker_compose_ps()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local key=$(__docker_compose_map_key_of_current_option '--filter') local key=$(__docker_compose_map_key_of_current_option '--filter')
case "$key" in case "$key" in
source) source)
@ -390,10 +598,19 @@ function _docker_compose_ps() {
__docker_compose_complete_services __docker_compose_complete_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_pull() { function _docker_compose_pull()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--help --ignore-pull-failures --include-deps --no-parallel --quiet -q" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--help --ignore-pull-failures --include-deps --no-parallel --quiet -q" -- "$cur" ) )
@ -402,10 +619,19 @@ function _docker_compose_pull() {
__docker_compose_complete_services --filter source=image __docker_compose_complete_services --filter source=image
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_push() { function _docker_compose_push()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--help --ignore-push-failures" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--help --ignore-push-failures" -- "$cur" ) )
@ -414,10 +640,19 @@ function _docker_compose_push() {
__docker_compose_complete_services __docker_compose_complete_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_restart() { function _docker_compose_restart()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
--timeout|-t) --timeout|-t)
return return
@ -432,10 +667,19 @@ function _docker_compose_restart() {
__docker_compose_complete_running_services __docker_compose_complete_running_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_rm() { function _docker_compose_rm()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--force -f --help --stop -s -v" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--force -f --help --stop -s -v" -- "$cur" ) )
@ -449,10 +693,19 @@ function _docker_compose_rm() {
fi fi
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_run() { function _docker_compose_run()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
-e) -e)
COMPREPLY=( $( compgen -e -- "$cur" ) ) COMPREPLY=( $( compgen -e -- "$cur" ) )
@ -472,10 +725,19 @@ function _docker_compose_run() {
__docker_compose_complete_services __docker_compose_complete_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_scale() { function _docker_compose_scale()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
=) =)
COMPREPLY=("$cur") COMPREPLY=("$cur")
@ -495,10 +757,19 @@ function _docker_compose_scale() {
__docker_compose_nospace __docker_compose_nospace
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_start() { function _docker_compose_start()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
@ -507,10 +778,19 @@ function _docker_compose_start() {
__docker_compose_complete_services --filter status=stopped __docker_compose_complete_services --filter status=stopped
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_stop() { function _docker_compose_stop()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
--timeout|-t) --timeout|-t)
return return
@ -525,10 +805,19 @@ function _docker_compose_stop() {
__docker_compose_complete_running_services __docker_compose_complete_running_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_top() { function _docker_compose_top()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
@ -537,10 +826,19 @@ function _docker_compose_top() {
__docker_compose_complete_running_services __docker_compose_complete_running_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_unpause() { function _docker_compose_unpause()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
@ -549,10 +847,19 @@ function _docker_compose_unpause() {
__docker_compose_complete_services --filter status=paused __docker_compose_complete_services --filter status=paused
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_up() { function _docker_compose_up()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$prev" in case "$prev" in
=) =)
COMPREPLY=("$cur") COMPREPLY=("$cur")
@ -580,19 +887,37 @@ function _docker_compose_up() {
__docker_compose_complete_services __docker_compose_complete_services
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose_version() { function _docker_compose_version()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--short" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--short" -- "$cur" ) )
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _docker_compose() { function _docker_compose()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local previous_extglob_setting=$(shopt -p extglob) local previous_extglob_setting=$(shopt -p extglob)
shopt -s extglob shopt -s extglob
@ -686,6 +1011,10 @@ function _docker_compose() {
eval "$previous_extglob_setting" eval "$previous_extglob_setting"
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
eval "$__docker_compose_previous_extglob_setting" eval "$__docker_compose_previous_extglob_setting"

View File

@ -15,6 +15,10 @@ function _dotnet_bash_complete()
read -d '' -ra candidates < <(dotnet complete --position "${COMP_POINT}" "${COMP_LINE}" 2> /dev/null) read -d '' -ra candidates < <(dotnet complete --position "${COMP_POINT}" "${COMP_LINE}" 2> /dev/null)
read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]:-}" -- "$cur") read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]:-}" -- "$cur")
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -f -F _dotnet_bash_complete dotnet complete -f -F _dotnet_bash_complete dotnet

View File

@ -63,6 +63,10 @@ function __fab_chache_mtime()
${__FAB_COMPLETION_MTIME_COMMAND} \ ${__FAB_COMPLETION_MTIME_COMMAND} \
$FAB_COMPLETION_CACHED_TASKS_FILENAME | xargs -n 1 expr $FAB_COMPLETION_CACHED_TASKS_FILENAME | xargs -n 1 expr
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
@ -85,6 +89,10 @@ function __fab_fabfile_mtime()
find $f/*.py -exec ${__FAB_COMPLETION_MTIME_COMMAND} {} + \ find $f/*.py -exec ${__FAB_COMPLETION_MTIME_COMMAND} {} + \
| xargs -n 1 expr | sort -n -r | head -1 | xargs -n 1 expr | sort -n -r | head -1
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
@ -153,5 +161,9 @@ function __fab_completion()
# Set possible completions # Set possible completions
COMPREPLY=($(compgen -W "${opts}" -- ${cur})) COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -o default -o nospace -F __fab_completion fab complete -o default -o nospace -F __fab_completion fab

View File

@ -2,7 +2,12 @@
cite "about-completion" cite "about-completion"
about-completion "gem completion" about-completion "gem completion"
__gem_completion() { function __gem_completion()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local cur=${COMP_WORDS[COMP_CWORD]} local cur=${COMP_WORDS[COMP_CWORD]}
local prev=${COMP_WORDS[COMP_CWORD - 1]} local prev=${COMP_WORDS[COMP_CWORD - 1]}
case $prev in case $prev in
@ -31,6 +36,10 @@ __gem_completion() {
local commands=(build cert check cleanup contents dependency environment fetch generate_index help install list lock outdated owner pristine push query rdoc search server sources specification stale uninstall unpack update which) local commands=(build cert check cleanup contents dependency environment fetch generate_index help install list lock outdated owner pristine push query rdoc search server sources specification stale uninstall unpack update which)
# shellcheck disable=SC2207 # shellcheck disable=SC2207
COMPREPLY=($(compgen -W "${commands[*]}" -- "$cur")) COMPREPLY=($(compgen -W "${commands[*]}" -- "$cur"))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F __gem_completion gem complete -F __gem_completion gem

View File

@ -47,6 +47,10 @@
function _git_flow () function _git_flow ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="init feature release hotfix" local subcommands="init feature release hotfix"
local subcommand="$(__git_find_subcommand "$subcommands")" local subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ] if [ -z "$subcommand" ]
@ -72,10 +76,18 @@ function _git_flow ()
COMPREPLY=() COMPREPLY=()
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_feature () function __git_flow_feature ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="list start finish publish track diff rebase checkout pull" local subcommands="list start finish publish track diff rebase checkout pull"
local subcommand="$(__git_find_subcommand "$subcommands")" local subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ] if [ -z "$subcommand" ]
@ -105,25 +117,57 @@ function __git_flow_feature ()
COMPREPLY=() COMPREPLY=()
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_list_features () function __git_flow_list_features ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
git flow feature list 2> /dev/null | tr -d ' |*' git flow feature list 2> /dev/null | tr -d ' |*'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_list_remote_features () function __git_flow_list_remote_features ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
git branch -r 2> /dev/null | grep "origin/$(__git_flow_feature_prefix)" | awk '{ sub(/^origin\/$(__git_flow_feature_prefix)/, "", $1); print }' git branch -r 2> /dev/null | grep "origin/$(__git_flow_feature_prefix)" | awk '{ sub(/^origin\/$(__git_flow_feature_prefix)/, "", $1); print }'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_feature_prefix () function __git_flow_feature_prefix ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
git config gitflow.prefix.feature 2> /dev/null || echo "feature/" git config gitflow.prefix.feature 2> /dev/null || echo "feature/"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_release () function __git_flow_release ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="list start finish" local subcommands="list start finish"
local subcommand="$(__git_find_subcommand "$subcommands")" local subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ] if [ -z "$subcommand" ]
@ -142,15 +186,31 @@ function __git_flow_release ()
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_list_releases () function __git_flow_list_releases ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
git flow release list 2> /dev/null git flow release list 2> /dev/null
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_hotfix () function __git_flow_hotfix ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="list start finish" local subcommands="list start finish"
local subcommand="$(__git_find_subcommand "$subcommands")" local subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ] if [ -z "$subcommand" ]
@ -168,11 +228,27 @@ function __git_flow_hotfix ()
COMPREPLY=() COMPREPLY=()
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_list_hotfixes () function __git_flow_list_hotfixes ()
{ {
git flow hotfix list 2> /dev/null git flow hotfix list 2> /dev/null
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# temporarily wrap __git_find_on_cmdline() for backwards compatibility # temporarily wrap __git_find_on_cmdline() for backwards compatibility

View File

@ -55,6 +55,10 @@ __git_flow_config_file_options="
function _git_flow () function _git_flow ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="init feature release hotfix support help version config finish delete publish rebase" local subcommands="init feature release hotfix support help version config finish delete publish rebase"
local subcommand="$(__git_find_on_cmdline "$subcommands")" local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ] if [ -z "$subcommand" ]
@ -92,10 +96,18 @@ function _git_flow ()
COMPREPLY=() COMPREPLY=()
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_init () function __git_flow_init ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="help" local subcommands="help"
local subcommand="$(__git_find_on_cmdline "$subcommands")" local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ] if [ -z "$subcommand" ]
@ -113,10 +125,18 @@ function __git_flow_init ()
return return
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_feature () function __git_flow_feature ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="list start finish publish track diff rebase checkout pull help delete" local subcommands="list start finish publish track diff rebase checkout pull help delete"
local subcommand="$(__git_find_on_cmdline "$subcommands")" local subcommand="$(__git_find_on_cmdline "$subcommands")"
@ -197,10 +217,18 @@ function __git_flow_feature ()
COMPREPLY=() COMPREPLY=()
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_release () function __git_flow_release ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="list start finish track publish help delete" local subcommands="list start finish track publish help delete"
local subcommand="$(__git_find_on_cmdline "$subcommands")" local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ] if [ -z "$subcommand" ]
@ -284,10 +312,18 @@ function __git_flow_release ()
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_hotfix () function __git_flow_hotfix ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="list start finish track publish help delete" local subcommands="list start finish track publish help delete"
local subcommand="$(__git_find_on_cmdline "$subcommands")" local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ] if [ -z "$subcommand" ]
@ -369,10 +405,18 @@ function __git_flow_hotfix ()
COMPREPLY=() COMPREPLY=()
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_support () function __git_flow_support ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="list start help" local subcommands="list start help"
local subcommand="$(__git_find_on_cmdline "$subcommands")" local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ] if [ -z "$subcommand" ]
@ -410,10 +454,18 @@ function __git_flow_support ()
COMPREPLY=() COMPREPLY=()
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_config () function __git_flow_config ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="list set base" local subcommands="list set base"
local subcommand="$(__git_find_on_cmdline "$subcommands")" local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ] if [ -z "$subcommand" ]
@ -455,20 +507,36 @@ function __git_flow_config ()
COMPREPLY=() COMPREPLY=()
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_prefix () function __git_flow_prefix ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "${1}" in case "${1}" in
feature|release|hotfix|support) feature|release|hotfix|support)
git config "gitflow.prefix.$1" 2> /dev/null || echo "$1/" git config "gitflow.prefix.$1" 2> /dev/null || echo "$1/"
return return
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_list_local_branches () function __git_flow_list_local_branches ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if [ -n "${1}" ] if [ -n "${1}" ]
then then
local prefix="$(__git_flow_prefix $1)" local prefix="$(__git_flow_prefix $1)"
@ -482,10 +550,18 @@ function __git_flow_list_local_branches ()
git for-each-ref --format="ref=%(refname:short)" refs/heads/ | sort git for-each-ref --format="ref=%(refname:short)" refs/heads/ | sort
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_list_remote_branches () function __git_flow_list_remote_branches ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local prefix="$(__git_flow_prefix $1)" local prefix="$(__git_flow_prefix $1)"
local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")" local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")"
git for-each-ref --shell --format='%(refname:short)' refs/remotes/$origin/$prefix | \ git for-each-ref --shell --format='%(refname:short)' refs/remotes/$origin/$prefix | \
@ -494,10 +570,18 @@ function __git_flow_list_remote_branches ()
ref="${ref##$prefix}" ref="${ref##$prefix}"
echo "$ref" echo "$ref"
done | sort done | sort
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __git_flow_list_branches () function __git_flow_list_branches ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")" local origin="$(git config gitflow.origin 2> /dev/null || echo "origin")"
if [ -n "${1}" ] if [ -n "${1}" ]
then then
@ -511,6 +595,10 @@ function __git_flow_list_branches ()
else else
git for-each-ref --format="%(refname:short)" refs/heads/ refs/remotes/$origin | sort git for-each-ref --format="%(refname:short)" refs/heads/ refs/remotes/$origin | sort
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# alias __git_find_on_cmdline for backwards compatibility # alias __git_find_on_cmdline for backwards compatibility

View File

@ -33,6 +33,10 @@ function __gradle-set-project-root-dir()
project_root_dir="$(_bash-it-find-in-ancestor "settings.gradle" "gradlew")" project_root_dir="$(_bash-it-find-in-ancestor "settings.gradle" "gradlew")"
return "${?}" return "${?}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __gradle-init-cache-dir() function __gradle-init-cache-dir()
@ -44,6 +48,10 @@ function __gradle-init-cache-dir()
cache_dir="$HOME/.gradle/completion" cache_dir="$HOME/.gradle/completion"
mkdir -p ${cache_dir} mkdir -p ${cache_dir}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __gradle-set-build-file() function __gradle-set-build-file()
@ -62,6 +70,10 @@ function __gradle-set-build-file()
sed -n -e "s/rootProject\.buildFileName = [\'\"]\(.*\)[\'\"]/\1/p") sed -n -e "s/rootProject\.buildFileName = [\'\"]\(.*\)[\'\"]/\1/p")
gradle_build_file="$project_root_dir/${build_file_name:-build.gradle}" gradle_build_file="$project_root_dir/${build_file_name:-build.gradle}"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __gradle-set-cache-name() function __gradle-set-cache-name()
@ -73,6 +85,10 @@ function __gradle-set-cache-name()
# Cache name is constructed from the absolute path of the build file. # Cache name is constructed from the absolute path of the build file.
cache_name=$(echo $gradle_build_file | sed -e 's/\//_/g') cache_name=$(echo $gradle_build_file | sed -e 's/\//_/g')
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __gradle-set-files-checksum() function __gradle-set-files-checksum()
@ -92,6 +108,10 @@ function __gradle-set-files-checksum()
else else
echo "Cannot generate completions as neither md5 nor md5sum exist on \$PATH" echo "Cannot generate completions as neither md5 nor md5sum exist on \$PATH"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __gradle-generate-script-cache() function __gradle-generate-script-cache()
@ -111,6 +131,10 @@ function __gradle-generate-script-cache()
local gradle_build_scripts=$(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern") local gradle_build_scripts=$(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern")
printf "%s\n" "${gradle_build_scripts[@]}" > $cache_dir/$cache_name printf "%s\n" "${gradle_build_scripts[@]}" > $cache_dir/$cache_name
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __gradle-long-options() function __gradle-long-options()
@ -162,6 +186,10 @@ function __gradle-long-options()
--version - Prints Gradle version info --version - Prints Gradle version info
--warn - Log warnings and errors only" --warn - Log warnings and errors only"
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") ) COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __gradle-properties() function __gradle-properties()
@ -183,6 +211,10 @@ function __gradle-properties()
-Dorg.gradle.workers.max= - Set the number of workers Gradle is allowed to use" -Dorg.gradle.workers.max= - Set the number of workers Gradle is allowed to use"
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") ) COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __gradle-short-options() function __gradle-short-options()
@ -213,6 +245,10 @@ function __gradle-short-options()
-P - Sets a project property of the root project -P - Sets a project property of the root project
-S - Print out the full (very verbose) stacktrace" -S - Print out the full (very verbose) stacktrace"
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") ) COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __gradle-notify-tasks-cache-build() function __gradle-notify-tasks-cache-build()
@ -226,6 +262,10 @@ function __gradle-notify-tasks-cache-build()
__gradle-generate-tasks-cache __gradle-generate-tasks-cache
# Remove "please wait" message by writing a bunch of spaces then moving back to the left # Remove "please wait" message by writing a bunch of spaces then moving back to the left
echo -e " \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\c" echo -e " \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\c"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __gradle-generate-tasks-cache() function __gradle-generate-tasks-cache()
@ -287,6 +327,10 @@ function __gradle-generate-tasks-cache()
printf "%s\n" "${gradle_all_tasks[@]}" > ${cache_dir}/${gradle_files_checksum} printf "%s\n" "${gradle_all_tasks[@]}" > ${cache_dir}/${gradle_files_checksum}
echo ${gradle_files_checksum} > ${cache_dir}/${cache_name}.md5 echo ${gradle_files_checksum} > ${cache_dir}/${cache_name}.md5
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __gradle-completion-init() function __gradle-completion-init()
@ -314,6 +358,10 @@ function __gradle-completion-init()
IFS="$OLDIFS" IFS="$OLDIFS"
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _gradle() function _gradle()
@ -396,6 +444,10 @@ wrapper - Generates Gradle wrapper files."
fi fi
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F _gradle gradle complete -F _gradle gradle

View File

@ -41,7 +41,12 @@
# eval "$(grunt --completion=bash)" # eval "$(grunt --completion=bash)"
# Search the current directory and all parent directories for a gruntfile. # Search the current directory and all parent directories for a gruntfile.
function _grunt_gruntfile() { function _grunt_gruntfile()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local curpath="$PWD" local curpath="$PWD"
while [[ "$curpath" ]]; do while [[ "$curpath" ]]; do
for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do
@ -54,10 +59,19 @@ function _grunt_gruntfile() {
curpath="${curpath%/*}" curpath="${curpath%/*}"
done done
return 1 return 1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Enable bash autocompletion. # Enable bash autocompletion.
function _grunt_completions() { function _grunt_completions()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# The currently-being-completed word. # The currently-being-completed word.
local cur="${COMP_WORDS[COMP_CWORD]}" local cur="${COMP_WORDS[COMP_CWORD]}"
# The current gruntfile, if it exists. # The current gruntfile, if it exists.
@ -71,6 +85,10 @@ function _grunt_completions() {
[[ "$cur" == -* ]] && compls="$compls $opts" [[ "$cur" == -* ]] && compls="$compls $opts"
# Tell complete what stuff to show. # Tell complete what stuff to show.
COMPREPLY=($(compgen -W "$compls" -- "$cur")) COMPREPLY=($(compgen -W "$compls" -- "$cur"))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -o default -F _grunt_completions grunt complete -o default -F _grunt_completions grunt

View File

@ -39,12 +39,21 @@
# #
# eval "$(gulp --completion=bash)" # eval "$(gulp --completion=bash)"
# Enable bash autocompletion. # Enable bash autocompletion.
function _gulp_completions() { function _gulp_completions()
# The currently-being-completed word. {
local cur="${COMP_WORDS[COMP_CWORD]}" ############ STACK_TRACE_BUILDER #####################
#Grab tasks Function_Name="${FUNCNAME[0]}"
local compls=$(gulp --tasks-simple) Function_PATH="${Function_PATH}/${Function_Name}"
# Tell complete what stuff to show. ######################################################
COMPREPLY=($(compgen -W "$compls" -- "$cur")) # The currently-being-completed word.
local cur="${COMP_WORDS[COMP_CWORD]}"
#Grab tasks
local compls=$(gulp --tasks-simple)
# Tell complete what stuff to show.
COMPREPLY=($(compgen -W "$compls" -- "$cur"))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -o default -F _gulp_completions gulp complete -o default -F _gulp_completions gulp

View File

@ -36,7 +36,12 @@ if _is_function _git && ! _is_function __git_list_all_commands_without_hub
sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')" sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')"
# Wrap the 'list_all_commands' function with extra hub commands # Wrap the 'list_all_commands' function with extra hub commands
__git_list_all_commands() { __git_list_all_commands()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
cat <<-EOF cat <<-EOF
alias alias
pull-request pull-request
@ -52,7 +57,11 @@ ci-status
sync sync
EOF EOF
__git_list_all_commands_without_hub __git_list_all_commands_without_hub
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Ensure cached commands are cleared # Ensure cached commands are cleared
__git_all_commands="" __git_all_commands=""
@ -90,7 +99,11 @@ EOF
((c++)) ((c++))
done done
__gitcomp "$s ${shells}" __gitcomp "$s ${shells}"
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# hub browse [-u] [--|[USER/]REPOSITORY] [SUBPAGE] # hub browse [-u] [--|[USER/]REPOSITORY] [SUBPAGE]
function _git_browse() function _git_browse()
@ -140,7 +153,11 @@ EOF
else else
__gitcomp "$u" __gitcomp "$u"
fi fi
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# hub compare [-u] [USER[/REPOSITORY]] [[START...]END] # hub compare [-u] [USER[/REPOSITORY]] [[START...]END]
function _git_compare() function _git_compare()
@ -242,7 +259,11 @@ EOF
fi fi
;; ;;
esac esac
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# hub create [NAME] [-p] [-d DESCRIPTION] [-h HOMEPAGE] # hub create [NAME] [-p] [-d DESCRIPTION] [-h HOMEPAGE]
function _git_create() function _git_create()
@ -281,7 +302,11 @@ EOF
__gitcomp "${repo} ${flags}" __gitcomp "${repo} ${flags}"
;; ;;
esac esac
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# hub fork [--no-remote] [--remote-name REMOTE] [--org ORGANIZATION] # hub fork [--no-remote] [--remote-name REMOTE] [--org ORGANIZATION]
function _git_fork() function _git_fork()
@ -319,7 +344,11 @@ EOF
__gitcomp "${flags}" __gitcomp "${flags}"
;; ;;
esac esac
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>] [-a <USER>] [-M <MILESTONE>] [-l <LABELS>] # hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>] [-a <USER>] [-M <MILESTONE>] [-l <LABELS>]
fucntion _git_pull_request() fucntion _git_pull_request()
@ -361,7 +390,11 @@ EOF
__gitcomp "${flags}" __gitcomp "${flags}"
;; ;;
esac esac
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
################### ###################
# Helper functions # Helper functions
@ -410,7 +443,11 @@ EOF
fi fi
done < "${config}" done < "${config}"
fi fi
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# __hub_github_repos [FORMAT] # __hub_github_repos [FORMAT]
# List all github hosted repository # List all github hosted repository
@ -442,7 +479,11 @@ EOF
command git config --get-regexp 'remote\.[^.]*\.url' | command git config --get-regexp 'remote\.[^.]*\.url' |
grep -E ' ((https?|git)://|git@)github\.com[:/][^:/]+/[^/]+$' | grep -E ' ((https?|git)://|git@)github\.com[:/][^:/]+/[^/]+$' |
sed -E 's#^remote\.([^.]+)\.url +.+[:/](([^/]+)/[^.]+)(\.git)?$#'"$format"'#' sed -E 's#^remote\.([^.]+)\.url +.+[:/](([^/]+)/[^.]+)(\.git)?$#'"$format"'#'
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# __hub_heads # __hub_heads
# List all local "branch", and remote "owner/repo:branch" # List all local "branch", and remote "owner/repo:branch"
@ -468,7 +509,11 @@ EOF
done done
done done
fi fi
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# __hub_revlist [REMOTE] # __hub_revlist [REMOTE]
# List all tags, and branches under REMOTE, without the "remote/" prefix # List all tags, and branches under REMOTE, without the "remote/" prefix
@ -490,7 +535,11 @@ EOF
command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ command git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
"refs/tags/" "refs/tags/"
fi fi
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Enable completion for hub even when not using the alias # Enable completion for hub even when not using the alias
complete -o bashdefault -o default -o nospace -F _git hub 2>/dev/null \ complete -o bashdefault -o default -o nospace -F _git hub 2>/dev/null \

View File

@ -49,6 +49,10 @@ funciton _complete_invoke()
# #
# COMPREPLY is the list of valid completions handed back to `complete`. # COMPREPLY is the list of valid completions handed back to `complete`.
COMPREPLY=( $(compgen -W "${candidates}" -- $2) ) COMPREPLY=( $(compgen -W "${candidates}" -- $2) )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -35,8 +35,16 @@ stat -c %Y /dev/null > /dev/null 2>&1 && _KAC_STAT_COMMAND="stat -c %Y" || _KAC_
# returns 1 otherwise # returns 1 otherwise
function _KAC_is_file_newer_than() function _KAC_is_file_newer_than()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
[ -f "${1}" ] || return 1 [ -f "${1}" ] || return 1
[ $(($(date +%s) - $($_KAC_STAT_COMMAND "${1}"))) -gt "${2}" ] && return 1 || return 0 [ $(($(date +%s) - $($_KAC_STAT_COMMAND "${1}"))) -gt "${2}" ] && return 1 || return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# helper function for _KAC_get_and_regen_cache, see doc below # helper function for _KAC_get_and_regen_cache, see doc below
@ -52,12 +60,16 @@ function _KAC_regen_cache()
local TMP_FILE="$(mktemp "${_KAC_CACHE_TMP_DIR}/${CACHE_NAME}.XXXX")" local TMP_FILE="$(mktemp "${_KAC_CACHE_TMP_DIR}/${CACHE_NAME}.XXXX")"
shift 1 shift 1
# discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated # discard the temp file if it's empty AND the previous command didn't exit successfully, but still mark the cache as updated
if ! "$@" > "$TMP_FILE" 2> /dev/null if ! "${@}" > "$TMP_FILE" 2> /dev/null
then then
[[ $(wc -l "$TMP_FILE") == 0 ]] && rm -f "$TMP_FILE" && touch "$CACHE_PATH" && return 1 [[ $(wc -l "$TMP_FILE") == 0 ]] && rm -f "$TMP_FILE" && touch "$CACHE_PATH" && return 1
else else
mv -f "$TMP_FILE" "$CACHE_PATH" mv -f "$TMP_FILE" "$CACHE_PATH"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# cached files can't have spaces in their names # cached files can't have spaces in their names
@ -68,6 +80,10 @@ function _KAC_get_cache_name_from_command()
Function_PATH="${Function_PATH}/${Function_Name}" Function_PATH="${Function_PATH}/${Function_Name}"
###################################################### ######################################################
echo "${@// /_SPACE_}" echo "${@// /_SPACE_}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# the reverse operation from the function above # the reverse operation from the function above
@ -78,6 +94,10 @@ function _KAC_get_command_from_cache_name()
Function_PATH="${Function_PATH}/${Function_Name}" Function_PATH="${Function_PATH}/${Function_Name}"
###################################################### ######################################################
echo "${@//_SPACE_/ }" echo "${@//_SPACE_/ }"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# given a command as argument, it fetches the cache for that command if it can find it # given a command as argument, it fetches the cache for that command if it can find it
@ -92,7 +112,7 @@ function _KAC_get_and_regen_cache()
Function_PATH="${Function_PATH}/${Function_Name}" Function_PATH="${Function_PATH}/${Function_Name}"
###################################################### ######################################################
# the cache name can't have space in it # the cache name can't have space in it
local CACHE_NAME=$(_KAC_get_cache_name_from_command "$@") local CACHE_NAME=$(_KAC_get_cache_name_from_command "${@}")
local REGEN_CMD="_KAC_regen_cache ${CACHE_NAME} $*" local REGEN_CMD="_KAC_regen_cache ${CACHE_NAME} $*"
_KAC_CACHE_PATH="${_KNIFE_AUTOCOMPLETE_CACHE_DIR}/${CACHE_NAME}" _KAC_CACHE_PATH="${_KNIFE_AUTOCOMPLETE_CACHE_DIR}/${CACHE_NAME}"
# no need to wait for the regen if the file already exists # no need to wait for the regen if the file already exists
@ -102,7 +122,11 @@ function _KAC_get_and_regen_cache()
else else
${REGEN_CMD} ${REGEN_CMD}
fi fi
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}}
# performs two things: first, deletes all obsolete temp files # performs two things: first, deletes all obsolete temp files
# then refreshes stale caches that haven't been called in a long time # then refreshes stale caches that haven't been called in a long time
@ -128,6 +152,10 @@ function _KAC_clean_cache()
# then regen the cache # then regen the cache
_KAC_get_and_regen_cache "${CMD}" > /dev/null _KAC_get_and_regen_cache "${CMD}" > /dev/null
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# perform a cache cleaning when loading this file # perform a cache cleaning when loading this file
@ -146,6 +174,10 @@ function _KAC_knife_commands()
Function_PATH="${Function_PATH}/${Function_Name}" Function_PATH="${Function_PATH}/${Function_Name}"
###################################################### ######################################################
knife --help | grep -E "^knife" | sed -E 's/ \(options\)//g' knife --help | grep -E "^knife" | sed -E 's/ \(options\)//g'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# rebuilds the knife base command currently being completed, and assigns it to $_KAC_CURRENT_COMMAND # rebuilds the knife base command currently being completed, and assigns it to $_KAC_CURRENT_COMMAND
@ -171,6 +203,10 @@ function _KAC_get_current_base_command()
done done
_KAC_CURRENT_COMMAND="${PREVIOUS}" _KAC_CURRENT_COMMAND="${PREVIOUS}"
[[ "${I}" -le "${COMP_CWORD}" ]] && _KAC_CURRENT_COMMAND_NB_WORDS="${I}" [[ "${I}" -le "${COMP_CWORD}" ]] && _KAC_CURRENT_COMMAND_NB_WORDS="${I}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# searches the position of the currently completed argument in the current base command # searches the position of the currently completed argument in the current base command
@ -194,6 +230,10 @@ function _KAC_get_current_arg_position()
CURRENT_ARG_POS=$((CURRENT_ARG_POS + 1)) CURRENT_ARG_POS=$((CURRENT_ARG_POS + 1))
done done
echo "${CURRENT_ARG_POS}" echo "${CURRENT_ARG_POS}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# the actual auto-complete function # the actual auto-complete function
@ -253,6 +293,10 @@ function _knife()
done done
# shellcheck disable=SC2207,SC2086 # shellcheck disable=SC2207,SC2086
COMPREPLY=($(compgen -W "${LIST}" -- ${COMP_WORDS[COMP_CWORD]})) COMPREPLY=($(compgen -W "${LIST}" -- ${COMP_WORDS[COMP_CWORD]}))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F _knife knife complete -F _knife knife

View File

@ -18,6 +18,10 @@ function __laravel_completion()
COMPREPLY+=("$_opt_") COMPREPLY+=("$_opt_")
fi fi
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F __laravel_completion laravel complete -F __laravel_completion laravel

View File

@ -23,5 +23,9 @@ function __lerna_completion()
# Tell complete what stuff to show. # Tell complete what stuff to show.
# shellcheck disable=2207 # shellcheck disable=2207
COMPREPLY=($(compgen -W "$compls" -- "$cur")) COMPREPLY=($(compgen -W "$compls" -- "$cur"))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -o default -F __lerna_completion lerna complete -o default -F __lerna_completion lerna

View File

@ -5,6 +5,10 @@
function _makecomplete() function _makecomplete()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
COMPREPLY=() COMPREPLY=()
# https://www.gnu.org/software/make/manual/html_node/Makefile-Names.html # https://www.gnu.org/software/make/manual/html_node/Makefile-Names.html
@ -31,6 +35,10 @@ function _makecomplete()
done < <(compgen -W "$(tr ' ' '\n' <<<"${targets[@]}" | sort -u)" -- "${COMP_WORDS[COMP_CWORD]}") done < <(compgen -W "$(tr ' ' '\n' <<<"${targets[@]}" | sort -u)" -- "${COMP_WORDS[COMP_CWORD]}")
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -o nospace -F _makecomplete make complete -o nospace -F _makecomplete make

View File

@ -3,6 +3,10 @@
function _mvn() function _mvn()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local cmds cur colonprefixes local cmds cur colonprefixes
cmds="clean validate compile test package integration-test \ cmds="clean validate compile test package integration-test \
verify install deploy test-compile site generate-sources \ verify install deploy test-compile site generate-sources \
@ -32,5 +36,9 @@ function _mvn()
done done
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} && } &&
complete -F _mvn mvn complete -F _mvn mvn

View File

@ -2,6 +2,10 @@
function __ngrok_completion() function __ngrok_completion()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# shellcheck disable=SC2155 # shellcheck disable=SC2155
local prev=$(_get_pword) local prev=$(_get_pword)
# shellcheck disable=SC2155 # shellcheck disable=SC2155
@ -43,6 +47,10 @@ function __ngrok_completion()
*) ;; *) ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F __ngrok_completion ngrok complete -F __ngrok_completion ngrok

View File

@ -21,6 +21,10 @@ function __notify-send_completions()
COMPREPLY=($(compgen -W "-? --help -u --urgency -t --expire-time -a --app-name -i --icon -c --category -h --hint -v --version" -- "$curr")) COMPREPLY=($(compgen -W "-? --help -u --urgency -t --expire-time -a --app-name -i --icon -c --category -h --hint -v --version" -- "$curr"))
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F __notify-send_completions notify-send complete -F __notify-send_completions notify-send

View File

@ -2,7 +2,7 @@
# nvm (Node Version Manager) completion # nvm (Node Version Manager) completion
if [ "$NVM_DIR" ] && [ -r "$NVM_DIR"/bash_completion ]; if [ "${NVM_DIR}" ] && [ -r "${NVM_DIR}"/bash_completion ];
then then
. "$NVM_DIR"/bash_completion . "${NVM_DIR}"/bash_completion
fi fi

View File

@ -17,11 +17,15 @@ function __bash_it_complete_pip()
if _command_exists _pip_completion if _command_exists _pip_completion
then then
complete -o default -F _pip_completion pip complete -o default -F _pip_completion pip
_pip_completion "$@" _pip_completion "${@}"
else else
eval "$(pip completion --bash)" eval "$(pip completion --bash)"
_pip_completion "$@" _pip_completion "${@}"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -o default -F __bash_it_complete_pip pip complete -o default -F __bash_it_complete_pip pip

View File

@ -17,10 +17,14 @@ function __bash_it_complete_pip3()
if _command_exists _pip_completion if _command_exists _pip_completion
then then
complete -o default -F _pip_completion pip3 complete -o default -F _pip_completion pip3
_pip_completion "$@" _pip_completion "${@}"
else else
eval "$(pip3 completion --bash)" eval "$(pip3 completion --bash)"
_pip_completion "$@" _pip_completion "${@}"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -o default -F __bash_it_complete_pip3 pip3 complete -o default -F __bash_it_complete_pip3 pip3

View File

@ -50,6 +50,10 @@ function _pj()
fi fi
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F _pj -o nospace pj complete -F _pj -o nospace pj

View File

@ -3,17 +3,26 @@
export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/} export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
function _rakecomplete() { function _rakecomplete()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if [ -f Rakefile ] if [ -f Rakefile ]
then then
recent=`ls -t .rake_tasks~ Rakefile **/*.rake 2> /dev/null | head -n 1` recent=`ls -t .rake_tasks~ Rakefile **/*.rake 2> /dev/null | head -n 1`
if [[ $recent != '.rake_tasks~' ]] if [[ ${recent} != '.rake_tasks~' ]]
then then
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~ rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
fi fi
COMPREPLY=($(compgen -W "`cat .rake_tasks~`" -- ${COMP_WORDS[COMP_CWORD]})) COMPREPLY=($(compgen -W "`cat .rake_tasks~`" -- ${COMP_WORDS[COMP_CWORD]}))
return 0 return 0
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -o default -o nospace -F _rakecomplete rake complete -o default -o nospace -F _rakecomplete rake

View File

@ -2,4 +2,4 @@
# Bash completion support for RVM. # Bash completion support for RVM.
# Source: https://rvm.io/workflow/completion # Source: https://rvm.io/workflow/completion
[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion [[ -r ${rvm_path}/scripts/completion ]] && . ${rvm_path}/scripts/completion

View File

@ -39,16 +39,28 @@ function _salt_get_grains()
else else
salt '*' --timeout 2 --out=txt -- grains.ls | sed 's/^.*\[//' | tr -d ",']" |sed 's:\([a-z0-9]\) :\1\: :g' salt '*' --timeout 2 --out=txt -- grains.ls | sed 's/^.*\[//' | tr -d ",']" |sed 's:\([a-z0-9]\) :\1\: :g'
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _salt_get_grain_values() function _salt_get_grain_values()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if [ "${1}" = 'local' ] if [ "${1}" = 'local' ]
then then
salt-call --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$' salt-call --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$'
else else
salt '*' --timeout 2 --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$' salt '*' --timeout 2 --out=txt -- grains.item $1 |sed 's/^\S*:\s//' |grep -v '^\s*$'
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
@ -156,6 +168,10 @@ function _salt()
COMPREPLY=( $(compgen -W "${all}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${all}" -- ${cur}) )
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F _salt salt complete -F _salt salt
@ -243,6 +259,10 @@ function _saltkey()
esac esac
COMPREPLY=($(compgen -W "${opts} " -- ${cur})) COMPREPLY=($(compgen -W "${opts} " -- ${cur}))
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F _saltkey salt-key complete -F _saltkey salt-key
@ -305,6 +325,10 @@ function _saltcall()
_salt_coms="$(salt-call --out=txt -- sys.list_functions|sed 's/^.*\[//' | tr -d ",']" )" _salt_coms="$(salt-call --out=txt -- sys.list_functions|sed 's/^.*\[//' | tr -d ",']" )"
COMPREPLY=( $(compgen -W "${opts} ${_salt_coms}" -- ${cur} )) COMPREPLY=( $(compgen -W "${opts} ${_salt_coms}" -- ${cur} ))
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F _saltcall salt-call complete -F _saltcall salt-call
@ -386,6 +410,10 @@ function _saltcp()
# default is using opts: # default is using opts:
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F _saltcp salt-cp complete -F _saltcp salt-cp

View File

@ -1,6 +1,11 @@
# shellcheck shell=bash # shellcheck shell=bash
function _sdkman_complete() { function _sdkman_complete()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local CANDIDATES local CANDIDATES
local CANDIDATE_VERSIONS local CANDIDATE_VERSIONS
local SDKMAN_CANDIDATES_CSV="${SDKMAN_CANDIDATES_CSV:-}" local SDKMAN_CANDIDATES_CSV="${SDKMAN_CANDIDATES_CSV:-}"
@ -49,15 +54,33 @@ function _sdkman_complete() {
fi fi
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _sdkman_candidate_local_versions() { function _sdkman_candidate_local_versions()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
CANDIDATE_VERSIONS=$(__sdkman_cleanup_local_versions "${1}") CANDIDATE_VERSIONS=$(__sdkman_cleanup_local_versions "${1}")
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _sdkman_candidate_all_versions() { function _sdkman_candidate_all_versions()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
candidate="${1}" candidate="${1}"
CANDIDATE_LOCAL_VERSIONS=$(__sdkman_cleanup_local_versions "$candidate") CANDIDATE_LOCAL_VERSIONS=$(__sdkman_cleanup_local_versions "$candidate")
@ -80,12 +103,25 @@ function _sdkman_candidate_all_versions() {
CANDIDATE_VERSIONS="$(echo "$CANDIDATE_ONLINE_VERSIONS $CANDIDATE_LOCAL_VERSIONS" | tr ' ' '\n' | grep -v -e '^[[:space:]|\*|\>|\+]*$' | sort -u) " CANDIDATE_VERSIONS="$(echo "$CANDIDATE_ONLINE_VERSIONS $CANDIDATE_LOCAL_VERSIONS" | tr ' ' '\n' | grep -v -e '^[[:space:]|\*|\>|\+]*$' | sort -u) "
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __sdkman_cleanup_local_versions() { function __sdkman_cleanup_local_versions()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
__sdkman_build_version_csv "${1}" | tr ',' ' ' __sdkman_build_version_csv "${1}" | tr ',' ' '
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F _sdkman_complete sdk complete -F _sdkman_complete sdk

View File

@ -12,6 +12,10 @@ then
function _sqlmap() function _sqlmap()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
@ -161,6 +165,10 @@ then
# else # else
# _filedir bat # _filedir bat
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -3,7 +3,12 @@
export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/} export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
_sshcomplete() { _sshcomplete()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}" local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}"
if [[ ${CURRENT_PROMPT} == *@* ]] if [[ ${CURRENT_PROMPT} == *@* ]]
then then
@ -40,6 +45,10 @@ _sshcomplete() {
fi fi
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -o default -o nospace -F _sshcomplete ssh scp slogin sftp complete -o default -o nospace -F _sshcomplete ssh scp slogin sftp

View File

@ -27,11 +27,11 @@ _svn_bash_completion_paths=(
# Load the first completion file found # Load the first completion file found
_svn_bash_completion_found=false _svn_bash_completion_found=false
for _comp_path in "${_svn_bash_completion_paths[@]}"; do for _comp_path in "${_svn_bash_completion_paths[@]}"; do
if [[ -r "$_comp_path" ]] if [[ -r "${_comp_path}" ]]
then then
_svn_bash_completion_found=true _svn_bash_completion_found=true
# shellcheck disable=SC1090 # don't follow # shellcheck disable=SC1090 # don't follow
source "$_comp_path" source "${_comp_path}"
break break
fi fi
done done

View File

@ -36,9 +36,9 @@ elif _bash_it_homebrew_check
3.2* | 4.0* | 4.1*) 3.2* | 4.0* | 4.1*)
# Import version 1.x of bash-completion, if installed. # Import version 1.x of bash-completion, if installed.
BASH_COMPLETION="${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@1/etc/bash_completion" BASH_COMPLETION="${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@1/etc/bash_completion"
if [[ -r "$BASH_COMPLETION" ]] if [[ -r "${BASH_COMPLETION}" ]]
then then
source "$BASH_COMPLETION" source "${BASH_COMPLETION}"
else else
unset BASH_COMPLETION unset BASH_COMPLETION
fi fi

View File

@ -1,4 +1,9 @@
function __kitchen_instance_list () { function __kitchen_instance_list ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# cache to .kitchen.list.yml # cache to .kitchen.list.yml
if [[ .kitchen.yml -nt .kitchen.list.yml || .kitchen.local.yml -nt .kitchen.list.yml ]] if [[ .kitchen.yml -nt .kitchen.list.yml || .kitchen.local.yml -nt .kitchen.list.yml ]]
then then
@ -6,9 +11,18 @@ function __kitchen_instance_list () {
kitchen list --bare > .kitchen.list.yml kitchen list --bare > .kitchen.list.yml
fi fi
cat .kitchen.list.yml cat .kitchen.list.yml
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __kitchen_options () { function __kitchen_options ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
COMPREPLY=() COMPREPLY=()
@ -27,5 +41,9 @@ function __kitchen_options () {
return 0 return 0
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F __kitchen_options kitchen complete -F __kitchen_options kitchen

View File

@ -6,6 +6,10 @@
function _tmux_expand () function _tmux_expand ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
[ "$cur" != "${cur%\\}" ] && cur="$cur"'\'; [ "$cur" != "${cur%\\}" ] && cur="$cur"'\';
if [[ "$cur" == \~*/* ]] if [[ "$cur" == \~*/* ]]
then then
@ -22,6 +26,10 @@ function _tmux_expand ()
function _tmux_filedir () function _tmux_filedir ()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local IFS=' local IFS='
'; ';
_tmux_expand || return 0; _tmux_expand || return 0;
@ -31,19 +39,48 @@ function _tmux_filedir ()
return 0; return 0;
fi; fi;
COMPREPLY=(${COMPREPLY[@]} $( eval compgen -f -- \"$cur\" )) COMPREPLY=(${COMPREPLY[@]} $( eval compgen -f -- \"$cur\" ))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _tmux_complete_client() { function _tmux_complete_client()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local IFS=$'\n' local IFS=$'\n'
local cur="${1}" local cur="${1}"
COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$(tmux -q list-clients 2>/dev/null | cut -f 1 -d ':')" -- "${cur}") ) COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$(tmux -q list-clients 2>/dev/null | cut -f 1 -d ':')" -- "${cur}") )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _tmux_complete_session() {
function _tmux_complete_session()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local IFS=$'\n' local IFS=$'\n'
local cur="${1}" local cur="${1}"
COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$(tmux -q list-sessions 2>/dev/null | cut -f 1 -d ':')" -- "${cur}") ) COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$(tmux -q list-sessions 2>/dev/null | cut -f 1 -d ':')" -- "${cur}") )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _tmux_complete_window() {
function _tmux_complete_window()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local IFS=$'\n' local IFS=$'\n'
local cur="${1}" local cur="${1}"
local session_name="$(echo "${cur}" | sed 's/\\//g' | cut -d ':' -f 1)" local session_name="$(echo "${cur}" | sed 's/\\//g' | cut -d ':' -f 1)"
@ -58,9 +95,18 @@ function _tmux_complete_window() {
cur="$(echo "${cur}" | sed -e 's/:/\\\\:/')" cur="$(echo "${cur}" | sed -e 's/:/\\\\:/')"
sessions="$(echo "${sessions}" | sed -e 's/:/\\\\:/')" sessions="$(echo "${sessions}" | sed -e 's/:/\\\\:/')"
COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "${sessions}" -- "${cur}") ) COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "${sessions}" -- "${cur}") )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _tmux() { function _tmux()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local cur prev local cur prev
local i cmd cmd_index option option_index local i cmd cmd_index option option_index
local opts="" local opts=""
@ -195,6 +241,10 @@ function _tmux() {
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F _tmux tmux complete -F _tmux tmux

View File

@ -23,7 +23,12 @@
# SOFTWARE. # SOFTWARE.
function __pwdln() { function __pwdln()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
pwdmod="${PWD}/" pwdmod="${PWD}/"
itr=0 itr=0
until [[ -z "$pwdmod" ]];do until [[ -z "$pwdmod" ]];do
@ -31,9 +36,18 @@ function __pwdln() {
pwdmod="${pwdmod#*/}" pwdmod="${pwdmod#*/}"
done done
echo -n $(($itr-1)) echo -n $(($itr-1))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __vagrantinvestigate() { function __vagrantinvestigate()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if [ -f "${PWD}/.vagrant" -o -d "${PWD}/.vagrant" ];then if [ -f "${PWD}/.vagrant" -o -d "${PWD}/.vagrant" ];then
echo "${PWD}/.vagrant" echo "${PWD}/.vagrant"
return 0 return 0
@ -48,9 +62,18 @@ function __vagrantinvestigate() {
done done
fi fi
return 1 return 1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _vagrant() { function _vagrant()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}" prev="${COMP_WORDS[COMP_CWORD-1]}"
commands="box cloud destroy global-status halt help hostmanager init login package plugin port powershell provision push rdp reload resume scp snapshot ssh ssh-config status suspend up upload validate vbguest version winrm winrm-config" commands="box cloud destroy global-status halt help hostmanager init login package plugin port powershell provision push rdp reload resume scp snapshot ssh ssh-config status suspend up upload validate vbguest version winrm winrm-config"
@ -162,5 +185,9 @@ function _vagrant() {
;; ;;
esac esac
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F _vagrant vagrant complete -F _vagrant vagrant

View File

@ -1,10 +1,24 @@
#!/usr/bin/bash #!/usr/bin/bash
function _vboxmanage_realopts() { function _vboxmanage_realopts()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo $(vboxmanage|grep -i vboxmanage|cut -d' ' -f2|grep '\['|tr -s '[\[\|\]\n' ' ') echo $(vboxmanage|grep -i vboxmanage|cut -d' ' -f2|grep '\['|tr -s '[\[\|\]\n' ' ')
echo " " echo " "
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __vboxmanage_startvm() { function __vboxmanage_startvm()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
RUNNING=$(vboxmanage list runningvms | cut -d' ' -f1 | tr -d '"') RUNNING=$(vboxmanage list runningvms | cut -d' ' -f1 | tr -d '"')
TOTAL=$(vboxmanage list vms | cut -d' ' -f1 | tr -d '"') TOTAL=$(vboxmanage list vms | cut -d' ' -f1 | tr -d '"')
@ -20,9 +34,18 @@ function __vboxmanage_startvm() {
(( $MATCH == 0 )) && AVAILABLE="$AVAILABLE $VM " (( $MATCH == 0 )) && AVAILABLE="$AVAILABLE $VM "
done done
echo $AVAILABLE echo $AVAILABLE
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __vboxmanage_list() { function __vboxmanage_list()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
INPUT=$(vboxmanage list | tr -s '[\[\]\|\n]' ' ' | cut -d' ' -f4-) INPUT=$(vboxmanage list | tr -s '[\[\]\|\n]' ' ' | cut -d' ' -f4-)
PRUNED="" PRUNED=""
@ -39,10 +62,19 @@ function __vboxmanage_list() {
fi fi
echo $PRUNED echo $PRUNED
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __vboxmanage_list_vms() { function __vboxmanage_list_vms()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
VMS="" VMS=""
if [ "x$1" == "x" ] if [ "x$1" == "x" ]
then then
@ -57,9 +89,18 @@ function __vboxmanage_list_vms() {
done done
echo $VMS echo $VMS
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __vboxmanage_list_runningvms() { function __vboxmanage_list_runningvms()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
VMS="" VMS=""
if [ "${1}" == "" ] if [ "${1}" == "" ]
then then
@ -75,9 +116,18 @@ function __vboxmanage_list_runningvms() {
echo $VMS echo $VMS
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __vboxmanage_controlvm() { function __vboxmanage_controlvm()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "pause resume reset poweroff savestate acpipowerbutton" echo "pause resume reset poweroff savestate acpipowerbutton"
echo "acpisleepbutton keyboardputscancode guestmemoryballoon" echo "acpisleepbutton keyboardputscancode guestmemoryballoon"
echo "gueststatisticsinterval usbattach usbdetach vrde vrdeport" echo "gueststatisticsinterval usbattach usbdetach vrde vrdeport"
@ -95,9 +145,18 @@ function __vboxmanage_controlvm() {
# <hostport>,[<guestip>],<guestport> # <hostport>,[<guestip>],<guestport>
# natpf<1-N> delete <rulename> # natpf<1-N> delete <rulename>
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __vboxmanage_default() { function __vboxmanage_default()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
realopts=$(_vboxmanage_realopts) realopts=$(_vboxmanage_realopts)
opts=$realopts$(vboxmanage | grep -i vboxmanage | cut -d' ' -f2 | grep -v '\[' | sort | uniq) opts=$realopts$(vboxmanage | grep -i vboxmanage | cut -d' ' -f2 | grep -v '\[' | sort | uniq)
pruned="" pruned=""
@ -151,9 +210,18 @@ function __vboxmanage_default() {
# COMPREPLY=($(compgen -W "${pruned}" -- ${cur})) # COMPREPLY=($(compgen -W "${pruned}" -- ${cur}))
echo $pruned echo $pruned
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _vboxmanage() { function _vboxmanage()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# vboxmanage | grep -i vboxmanage | cut -d' ' -f2 | sort | uniq # vboxmanage | grep -i vboxmanage | cut -d' ' -f2 | sort | uniq
local cur p1 p2 p3 p4 opts local cur p1 p2 p3 p4 opts
COMPREPLY=() COMPREPLY=()
@ -228,5 +296,9 @@ function _vboxmanage() {
done done
# echo "Got to end withoug completion" # echo "Got to end withoug completion"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F _vboxmanage vboxmanage complete -F _vboxmanage vboxmanage

View File

@ -1,6 +1,11 @@
# shellcheck shell=bash # shellcheck shell=bash
__vuejs_completion() { __vuejs_completion()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# shellcheck disable=SC2155 # shellcheck disable=SC2155
local prev=$(_get_pword) local prev=$(_get_pword)
# shellcheck disable=SC2155 # shellcheck disable=SC2155
@ -56,6 +61,10 @@ __vuejs_completion() {
COMPREPLY=($(compgen -W "-h --help -v --version create add invoke inspect serve build ui init config outdated upgrade migrate info" -- "$curr")) COMPREPLY=($(compgen -W "-h --help -v --version create add invoke inspect serve build ui init config outdated upgrade migrate info" -- "$curr"))
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F __vuejs_completion vue complete -F __vuejs_completion vue

View File

@ -17,6 +17,9 @@ function __wpscan_completion()
COMPREPLY+=("$_opt_") COMPREPLY+=("$_opt_")
fi fi
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F __wpscan_completion wpscan complete -F __wpscan_completion wpscan

View File

@ -1,27 +1,36 @@
#!/usr/bin/env bash #!/usr/bin/env bash
file=$1 file=${1}
# Should only be run on clean_files.txt # Should only be run on clean_files.txt
if [ "$file" != "clean_files.txt" ] if [ "${file}" != "clean_files.txt" ]
then then
echo "Please run this script on clean_files.txt only!" echo "Please run this script on clean_files.txt only!"
exit 1 exit 1
fi fi
function compare_lines() { function compare_lines()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
prev="" prev=""
while read -r line; do while read -r line; do
# Skip unimportant lines # Skip unimportant lines
[[ $line =~ "#" ]] && continue [[ ${line} =~ "#" ]] && continue
[[ $line == "" ]] && continue [[ ${line} == "" ]] && continue
# Actual check # Actual check
if [[ $prev > $line ]] if [[ ${prev} > ${line} ]]
then then
echo "$line should be before $prev" echo "${line} should be before ${prev}"
exit 1 exit 1
fi fi
prev=$line prev="${line}"
done <<< "${1}" done <<< "${1}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# We compare using the legacy way # We compare using the legacy way

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
exit_code=0 exit_code=0
for file in "$@"; do for file in "${@}"; do
# Confirm file is not executable # Confirm file is not executable
# #
if [[ -x "${file}" ]] if [[ -x "${file}" ]]

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
exit_code=0 exit_code=0
for file in "$@"; do for file in "${@}"; do
# Confirm file is executable # Confirm file is executable
# #
if [[ ! -x "${file}" ]] if [[ ! -x "${file}" ]]

View File

@ -17,6 +17,10 @@ function _bash-it_show_usage()
echo "--no-modify-config (-n): Do not modify existing config file" echo "--no-modify-config (-n): Do not modify existing config file"
echo "--append-to-config (-a): Keep existing config file and append bash-it templates at the end" echo "--append-to-config (-a): Keep existing config file and append bash-it templates at the end"
echo "--overwrite-backup (-f): Overwrite existing backup" echo "--overwrite-backup (-f): Overwrite existing backup"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# enable a thing # enable a thing
@ -38,6 +42,10 @@ function _bash-it_load_one()
else else
echo "File ${dest} exists, skipping" echo "File ${dest} exists, skipping"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Interactively enable several things # Interactively enable several things
@ -71,6 +79,10 @@ function _bash-it_load_some()
esac esac
done done
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Back up existing profile # Back up existing profile
@ -84,6 +96,10 @@ function _bash-it_backup()
test -w "$HOME/$CONFIG_FILE" \ test -w "$HOME/$CONFIG_FILE" \
&& cp -aL "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.bak" \ && cp -aL "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.bak" \
&& echo -e "\033[0;32mYour original $CONFIG_FILE has been backed up to $CONFIG_FILE.bak\033[0m" && echo -e "\033[0;32mYour original $CONFIG_FILE has been backed up to $CONFIG_FILE.bak\033[0m"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Back up existing profile and create new one for bash-it # Back up existing profile and create new one for bash-it
@ -97,6 +113,10 @@ function _bash-it_backup_new()
_bash-it_backup _bash-it_backup
sed "s|{{BASH_IT}}|$BASH_IT|" "$BASH_IT/template/bash_profile.template.bash" > "$HOME/$CONFIG_FILE" sed "s|{{BASH_IT}}|$BASH_IT|" "$BASH_IT/template/bash_profile.template.bash" > "$HOME/$CONFIG_FILE"
echo -e "\033[0;32mCopied the template $CONFIG_FILE into ~/$CONFIG_FILE, edit this file to customize bash-it\033[0m" echo -e "\033[0;32mCopied the template $CONFIG_FILE into ~/$CONFIG_FILE, edit this file to customize bash-it\033[0m"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Back up existing profile and append bash-it templates at the end # Back up existing profile and append bash-it templates at the end
@ -109,6 +129,10 @@ function _bash-it_backup_append()
_bash-it_backup _bash-it_backup
(sed "s|{{BASH_IT}}|$BASH_IT|" "$BASH_IT/template/bash_profile.template.bash" | tail -n +2) >> "$HOME/$CONFIG_FILE" (sed "s|{{BASH_IT}}|$BASH_IT|" "$BASH_IT/template/bash_profile.template.bash" | tail -n +2) >> "$HOME/$CONFIG_FILE"
echo -e "\033[0;32mBash-it template has been added to your $CONFIG_FILE\033[0m" echo -e "\033[0;32mBash-it template has been added to your $CONFIG_FILE\033[0m"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it_check_for_backup() function _bash-it_check_for_backup()
@ -153,6 +177,10 @@ function _bash-it_check_for_backup()
else else
echo -e "\033[0;32mOverwriting backup...\033[m" echo -e "\033[0;32mOverwriting backup...\033[m"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it_modify_config_files() function _bash-it_modify_config_files()
@ -190,18 +218,22 @@ function _bash-it_modify_config_files()
# backup/new by default # backup/new by default
_bash-it_backup_new _bash-it_backup_new
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
for param in "$@"; do for param in "${@}"; do
shift shift
case "$param" in case "$param" in
"--help") set -- "$@" "-h" ;; "--help") set -- "${@}" "-h" ;;
"--silent") set -- "$@" "-s" ;; "--silent") set -- "${@}" "-s" ;;
"--interactive") set -- "$@" "-i" ;; "--interactive") set -- "${@}" "-i" ;;
"--no-modify-config") set -- "$@" "-n" ;; "--no-modify-config") set -- "${@}" "-n" ;;
"--append-to-config") set -- "$@" "-a" ;; "--append-to-config") set -- "${@}" "-a" ;;
"--overwrite-backup") set -- "$@" "-f" ;; "--overwrite-backup") set -- "${@}" "-f" ;;
*) set -- "$@" "$param" ;; *) set -- "${@}" "$param" ;;
esac esac
done done

View File

@ -12,10 +12,10 @@ if [[ -n "${BASH_IT_THEME:-}" ]]
if [[ -f "${BASH_IT_THEME}" ]] if [[ -f "${BASH_IT_THEME}" ]]
then then
source "${BASH_IT_THEME}" source "${BASH_IT_THEME}"
elif [[ -f "$CUSTOM_THEME_DIR/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" ]] elif [[ -f "${CUSTOM_THEME_DIR}/${BASH_IT_THEME}/${BASH_IT_THEME}.theme.bash" ]]
then then
source "$CUSTOM_THEME_DIR/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" source "${CUSTOM_THEME_DIR}/${BASH_IT_THEME}/${BASH_IT_THEME}.theme.bash"
else else
source "$BASH_IT/themes/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" source "${BASH_IT}/themes/${BASH_IT_THEME}/${BASH_IT_THEME}.theme.bash"
fi fi
fi fi

View File

@ -8,18 +8,40 @@ function _shell_duration_en() (
# DFARREL You would think LC_NUMERIC would do it, but not working in my local # DFARREL You would think LC_NUMERIC would do it, but not working in my local
LC_ALL='en_US.UTF-8' LC_ALL='en_US.UTF-8'
printf "%s" "${EPOCHREALTIME:-$SECONDS}" printf "%s" "${EPOCHREALTIME:-$SECONDS}"
)
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
: "${COMMAND_DURATION_START_SECONDS:=$(_shell_duration_en)}" : "${COMMAND_DURATION_START_SECONDS:=$(_shell_duration_en)}"
: "${COMMAND_DURATION_ICON:=🕘}" : "${COMMAND_DURATION_ICON:=🕘}"
: "${COMMAND_DURATION_MIN_SECONDS:=1}" : "${COMMAND_DURATION_MIN_SECONDS:=1}"
function _command_duration_pre_exec() { function _command_duration_pre_exec()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
COMMAND_DURATION_START_SECONDS="$(_shell_duration_en)" COMMAND_DURATION_START_SECONDS="$(_shell_duration_en)"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _command_duration_pre_cmd() { function _command_duration_pre_cmd()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
COMMAND_DURATION_START_SECONDS="" COMMAND_DURATION_START_SECONDS=""
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _dynamic_clock_icon { function _dynamic_clock_icon {
@ -28,9 +50,18 @@ function _dynamic_clock_icon {
# so between 144 and 155 in base 10. # so between 144 and 155 in base 10.
printf -v clock_hand '%x' $(((${1:-${SECONDS}} % 12) + 144)) printf -v clock_hand '%x' $(((${1:-${SECONDS}} % 12) + 144))
printf -v 'COMMAND_DURATION_ICON' '%b' "\xf0\x9f\x95\x$clock_hand" printf -v 'COMMAND_DURATION_ICON' '%b' "\xf0\x9f\x95\x$clock_hand"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _command_duration() { function _command_duration()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
[[ -n "${BASH_IT_COMMAND_DURATION:-}" ]] || return [[ -n "${BASH_IT_COMMAND_DURATION:-}" ]] || return
[[ -n "${COMMAND_DURATION_START_SECONDS:-}" ]] || return [[ -n "${COMMAND_DURATION_START_SECONDS:-}" ]] || return
@ -74,6 +105,10 @@ function _command_duration() {
printf "%s %s%d.%01ds" "${COMMAND_DURATION_ICON:-}" "${COMMAND_DURATION_COLOR:-}" "$seconds" "$deciseconds" printf "%s %s%d.%01ds" "${COMMAND_DURATION_ICON:-}" "${COMMAND_DURATION_COLOR:-}" "$seconds" "$deciseconds"
fi fi
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_bash_it_library_finalize_hook+=("safe_append_preexec '_command_duration_pre_exec'") _bash_it_library_finalize_hook+=("safe_append_preexec '_command_duration_pre_exec'")

File diff suppressed because it is too large Load Diff

View File

@ -2,12 +2,22 @@
# #
# Functions for working with Bash's command history. # Functions for working with Bash's command history.
function _bash-it-history-init() { function _bash-it-history-init()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
safe_append_preexec '_bash-it-history-auto-save' safe_append_preexec '_bash-it-history-auto-save'
safe_append_prompt_command '_bash-it-history-auto-load' safe_append_prompt_command '_bash-it-history-auto-load'
} }
function _bash-it-history-auto-save() { function _bash-it-history-auto-save()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case $HISTCONTROL in case $HISTCONTROL in
*'noauto'* | *'autoload'*) *'noauto'* | *'autoload'*)
: # Do nothing, as configured. : # Do nothing, as configured.
@ -21,9 +31,18 @@ function _bash-it-history-auto-save() {
shopt -q histappend && history -a && return shopt -q histappend && history -a && return
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-history-auto-load() { function _bash-it-history-auto-load()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case $HISTCONTROL in case $HISTCONTROL in
*'noauto'*) *'noauto'*)
: # Do nothing, as configured. : # Do nothing, as configured.
@ -44,6 +63,10 @@ function _bash-it-history-auto-load() {
: # Do nothing, default. : # Do nothing, default.
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_bash_it_library_finalize_hook+=('_bash-it-history-init') _bash_it_library_finalize_hook+=('_bash-it-history-init')

View File

@ -11,7 +11,8 @@
: "${BASH_IT_LOG_LEVEL_TRACE:=7}" : "${BASH_IT_LOG_LEVEL_TRACE:=7}"
readonly "${!BASH_IT_LOG_LEVEL_@}" readonly "${!BASH_IT_LOG_LEVEL_@}"
function _bash-it-log-prefix-by-path() { function _bash-it-log-prefix-by-path()
{
local component_path="${1?${FUNCNAME[0]}: path specification required}" local component_path="${1?${FUNCNAME[0]}: path specification required}"
local without_extension component_directory local without_extension component_directory
local component_filename component_type component_name local component_filename component_type component_name
@ -43,14 +44,26 @@ function _bash-it-log-prefix-by-path() {
# shellcheck disable=SC2034 # shellcheck disable=SC2034
BASH_IT_LOG_PREFIX="${component_type:-lib}: $component_name" BASH_IT_LOG_PREFIX="${component_type:-lib}: $component_name"
} }
function _has_colors() { function _has_colors()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# Check that stdout is a terminal, and that it has at least 8 colors. # Check that stdout is a terminal, and that it has at least 8 colors.
[[ -t 1 && "${CLICOLOR:=$(tput colors 2> /dev/null)}" -ge 8 ]] [[ -t 1 && "${CLICOLOR:=$(tput colors 2> /dev/null)}" -ge 8 ]]
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-log-message() { function _bash-it-log-message()
{
: _about 'Internal function used for logging, uses BASH_IT_LOG_PREFIX as a prefix' : _about 'Internal function used for logging, uses BASH_IT_LOG_PREFIX as a prefix'
: _param '1: color of the message' : _param '1: color of the message'
: _param '2: log level to print before the prefix' : _param '2: log level to print before the prefix'
@ -67,9 +80,12 @@ function _bash-it-log-message() {
else else
printf '%s\n' "${message}" printf '%s\n' "${message}"
fi fi
} }
function _log_debug() { function _log_debug()
{
: _about 'log a debug message by echoing to the screen. needs BASH_IT_LOG_LEVEL >= BASH_IT_LOG_LEVEL_INFO' : _about 'log a debug message by echoing to the screen. needs BASH_IT_LOG_LEVEL >= BASH_IT_LOG_LEVEL_INFO'
: _param '1: message to log' : _param '1: message to log'
: _example '$ _log_debug "Loading plugin git..."' : _example '$ _log_debug "Loading plugin git..."'
@ -79,9 +95,14 @@ function _log_debug() {
then then
_bash-it-log-message "${echo_green:-}" "DEBUG: " "${1}" _bash-it-log-message "${echo_green:-}" "DEBUG: " "${1}"
fi fi
} }
function _log_warning() { function _log_warning()
{
: _about 'log a message by echoing to the screen. needs BASH_IT_LOG_LEVEL >= BASH_IT_LOG_LEVEL_WARNING' : _about 'log a message by echoing to the screen. needs BASH_IT_LOG_LEVEL >= BASH_IT_LOG_LEVEL_WARNING'
: _param '1: message to log' : _param '1: message to log'
: _example '$ _log_warning "git binary not found, disabling git plugin..."' : _example '$ _log_warning "git binary not found, disabling git plugin..."'
@ -91,9 +112,13 @@ function _log_warning() {
then then
_bash-it-log-message "${echo_yellow:-}" " WARN: " "${1}" _bash-it-log-message "${echo_yellow:-}" " WARN: " "${1}"
fi fi
} }
function _log_error() { function _log_error()
{
: _about 'log a message by echoing to the screen. needs BASH_IT_LOG_LEVEL >= BASH_IT_LOG_LEVEL_ERROR' : _about 'log a message by echoing to the screen. needs BASH_IT_LOG_LEVEL >= BASH_IT_LOG_LEVEL_ERROR'
: _param '1: message to log' : _param '1: message to log'
: _example '$ _log_error "Failed to load git plugin..."' : _example '$ _log_error "Failed to load git plugin..."'
@ -103,4 +128,5 @@ function _log_error() {
then then
_bash-it-log-message "${echo_red:-}" "ERROR: " "${1}" _bash-it-log-message "${echo_red:-}" "ERROR: " "${1}"
fi fi
} }

View File

@ -12,11 +12,9 @@ __bp_delay_install="delayed"
source "${BASH_IT?}/vendor/github.com/rcaloras/bash-preexec/bash-preexec.sh" source "${BASH_IT?}/vendor/github.com/rcaloras/bash-preexec/bash-preexec.sh"
# Block damanaging user's `$HISTCONTROL` # Block damanaging user's `$HISTCONTROL`
function __bp_adjust_histcontrol() { :; } __bp_adjust_histcontrol()
# Don't fail on readonly variables # Don't fail on readonly variables
function __bp_require_not_readonly() { :; } __bp_require_not_readonly()
# For performance, testing, and to avoid unexpected behavior: disable DEBUG traps in subshells. # For performance, testing, and to avoid unexpected behavior: disable DEBUG traps in subshells.
# See bash-it/bash-it#1040 and rcaloras/bash-preexec#26 # See bash-it/bash-it#1040 and rcaloras/bash-preexec#26
: "${__bp_enable_subshells:=}" # blank : "${__bp_enable_subshells:=}" # blank
@ -25,19 +23,42 @@ function __bp_require_not_readonly() { :; }
_bash_it_library_finalize_hook+=('__bp_install_after_session_init') _bash_it_library_finalize_hook+=('__bp_install_after_session_init')
## Helper functions ## Helper functions
function __check_precmd_conflict() { function __check_precmd_conflict()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local f local f
__bp_trim_whitespace f "${1?}" __bp_trim_whitespace f "${1?}"
_bash-it-array-contains-element "${f}" "${precmd_functions[@]}" _bash-it-array-contains-element "${f}" "${precmd_functions[@]}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __check_preexec_conflict() { function __check_preexec_conflict()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local f local f
__bp_trim_whitespace f "${1?}" __bp_trim_whitespace f "${1?}"
_bash-it-array-contains-element "${f}" "${preexec_functions[@]}" _bash-it-array-contains-element "${f}" "${preexec_functions[@]}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function safe_append_prompt_command() { function safe_append_prompt_command()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local prompt_re prompt_er f local prompt_re prompt_er f
if [[ "${bash_preexec_imported:-${__bp_imported:-missing}}" == "defined" ]] if [[ "${bash_preexec_imported:-${__bp_imported:-missing}}" == "defined" ]]
@ -62,9 +83,18 @@ function safe_append_prompt_command() {
PROMPT_COMMAND="${1};${PROMPT_COMMAND}" PROMPT_COMMAND="${1};${PROMPT_COMMAND}"
fi fi
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function safe_append_preexec() { function safe_append_preexec()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local prompt_re f local prompt_re f
if [[ "${bash_preexec_imported:-${__bp_imported:-missing}}" == "defined" ]] if [[ "${bash_preexec_imported:-${__bp_imported:-missing}}" == "defined" ]]
@ -78,4 +108,8 @@ function safe_append_preexec() {
else else
_log_error "${FUNCNAME[0]}: can't append to preexec hook because _bash-preexec.sh_ hasn't been loaded" _log_error "${FUNCNAME[0]}: can't append to preexec hook because _bash-preexec.sh_ hasn't been loaded"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -2,13 +2,18 @@
# #
# Displays the prompt from each _Bash It_ theme. # Displays the prompt from each _Bash It_ theme.
function _bash-it-preview() { function _bash-it-preview()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local BASH_IT_THEME BASH_IT_LOG_LEVEL local BASH_IT_THEME BASH_IT_LOG_LEVEL
local themes IFS=$'\n' cur local themes IFS=$'\n' cur
if [[ $# -gt '0' ]] if [[ $# -gt '0' ]]
then then
themes=("$@") themes=("${@}")
else else
themes=("${BASH_IT?}/themes"/*/*.theme.bash) themes=("${BASH_IT?}/themes"/*/*.theme.bash)
themes=("${themes[@]##*/}") themes=("${themes[@]##*/}")
@ -28,10 +33,14 @@ function _bash-it-preview() {
BASH_IT_LOG_LEVEL=0 BASH_IT_LOG_LEVEL=0
bash --init-file "${BASH_IT?}/bash_it.sh" -i <<< '_bash-it-flash-term "${#BASH_IT_THEME}" "${BASH_IT_THEME}"' bash --init-file "${BASH_IT?}/bash_it.sh" -i <<< '_bash-it-flash-term "${#BASH_IT_THEME}" "${BASH_IT_THEME}"'
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
if [[ -n "${BASH_PREVIEW:-}" ]] if [[ -n "${BASH_PREVIEW:-}" ]]
then then
_bash-it-preview "${BASH_PREVIEW}" "$@" _bash-it-preview "${BASH_PREVIEW}" "${@}"
unset BASH_PREVIEW #Prevent infinite looping unset BASH_PREVIEW #Prevent infinite looping
fi fi

View File

@ -47,7 +47,12 @@
# completions: git # completions: git
# #
function _bash-it-search() { function _bash-it-search()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
_about 'searches for given terms amongst bash-it plugins, aliases and completions' _about 'searches for given terms amongst bash-it plugins, aliases and completions'
_param '1: term1' _param '1: term1'
_param '2: [ term2 ]...' _param '2: [ term2 ]...'
@ -64,7 +69,7 @@ function _bash-it-search() {
fi fi
local -a args=() local -a args=()
for word in "$@"; do for word in "${@}"; do
case "${word}" in case "${word}" in
'-h' | '--help') '-h' | '--help')
_bash-it-search-help _bash-it-search-help
@ -90,9 +95,18 @@ function _bash-it-search() {
fi fi
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-search-help() { function _bash-it-search-help()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
printf '%b' "${echo_normal-} printf '%b' "${echo_normal-}
${echo_underline_yellow-}USAGE${echo_normal-} ${echo_underline_yellow-}USAGE${echo_normal-}
@ -167,26 +181,53 @@ ${echo_underline_yellow-}SUMMARY${echo_normal-}
each module. each module.
" "
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-is-partial-match() { function _bash-it-is-partial-match()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local component="${1?${FUNCNAME[0]}: component type must be specified}" local component="${1?${FUNCNAME[0]}: component type must be specified}"
local term="${2:-}" local term="${2:-}"
_bash-it-component-help "${component}" | _bash-it-egrep -i -q -- "${term}" _bash-it-component-help "${component}" | _bash-it-egrep -i -q -- "${term}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-component-term-matches-negation() { function _bash-it-component-term-matches-negation()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local match="${1}" local match="${1}"
shift shift
local negative local negative
for negative in "$@"; do for negative in "${@}"; do
[[ "${match}" =~ ${negative} ]] && return 0 [[ "${match}" =~ ${negative} ]] && return 0
done done
return 1 return 1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-search-component() { function _bash-it-search-component()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
_about 'searches for given terms amongst a given component' _about 'searches for given terms amongst a given component'
_param '1: component type, one of: [ aliases | plugins | completions ]' _param '1: component type, one of: [ aliases | plugins | completions ]'
_param '2: term1 term2 @term3' _param '2: term1 term2 @term3'
@ -201,7 +242,7 @@ function _bash-it-search-component() {
local component_singular action action_func local component_singular action action_func
local -a search_commands=('enable' 'disable') local -a search_commands=('enable' 'disable')
for search_command in "${search_commands[@]}"; do for search_command in "${search_commands[@]}"; do
if _bash-it-array-contains-element "--${search_command}" "$@" if _bash-it-array-contains-element "--${search_command}" "${@}"
then then
component_singular="${component/es/}" # aliases -> alias component_singular="${component/es/}" # aliases -> alias
component_singular="${component_singular/ns/n}" # plugins -> plugin component_singular="${component_singular/ns/n}" # plugins -> plugin
@ -212,7 +253,7 @@ function _bash-it-search-component() {
fi fi
done done
local -a terms=("$@") # passed on the command line local -a terms=("${@}") # passed on the command line
local -a exact_terms=() # terms that should be included only if they match exactly local -a exact_terms=() # terms that should be included only if they match exactly
local -a partial_terms=() # terms that should be included if they match partially local -a partial_terms=() # terms that should be included if they match partially
@ -263,9 +304,17 @@ function _bash-it-search-component() {
done done
_bash-it-search-result "${component}" "${action:-}" "${action_func:-}" "${matches[@]:-}" _bash-it-search-result "${component}" "${action:-}" "${action_func:-}" "${matches[@]:-}"
}
function _bash-it-search-result() { ############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function _bash-it-search-result()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local component="${1?${FUNCNAME[0]}: component type must be specified}" local component="${1?${FUNCNAME[0]}: component type must be specified}"
shift shift
local action="${1:-}" local action="${1:-}"
@ -349,14 +398,32 @@ function _bash-it-search-result() {
((modified)) && _bash-it-component-cache-clean "${component}" ((modified)) && _bash-it-component-cache-clean "${component}"
printf "\n" printf "\n"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-rewind() { function _bash-it-rewind()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local -i len="${1:-0}" local -i len="${1:-0}"
printf '%b' "\033[${len}D" printf '%b' "\033[${len}D"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-flash-term() { function _bash-it-flash-term()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local -i len="${1:-0}" # redundant local -i len="${1:-0}" # redundant
local term="${2:-}" local term="${2:-}"
# as currently implemented, `$match` has already been printed to screen the first time # as currently implemented, `$match` has already been printed to screen the first time
@ -369,9 +436,18 @@ function _bash-it-flash-term() {
_bash-it-rewind "${len}" _bash-it-rewind "${len}"
printf '%b' "${color}${term}" printf '%b' "${color}${term}"
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-erase-term() { function _bash-it-erase-term()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local -i len="${1:-0}" i local -i len="${1:-0}" i
local delay=0.05 local delay=0.05
local term="${2:-}" # calculate length ourselves local term="${2:-}" # calculate length ourselves
@ -383,4 +459,8 @@ function _bash-it-erase-term() {
printf "%.*s" "$i" " " printf "%.*s" "$i" " "
sleep "${delay}" sleep "${delay}"
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -6,7 +6,12 @@
# Generic utilies # Generic utilies
########################################################################### ###########################################################################
function _bash-it-get-component-name-from-path() { function _bash-it-get-component-name-from-path()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local filename local filename
# filename without path # filename without path
filename="${1##*/}" filename="${1##*/}"
@ -14,9 +19,18 @@ function _bash-it-get-component-name-from-path() {
filename="${filename##*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}"}" filename="${filename##*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}"}"
# filename without path, priority or extension # filename without path, priority or extension
echo "${filename%.*.bash}" echo "${filename%.*.bash}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-get-component-type-from-path() { function _bash-it-get-component-type-from-path()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local filename local filename
# filename without path # filename without path
filename="${1##*/}" filename="${1##*/}"
@ -25,6 +39,10 @@ function _bash-it-get-component-type-from-path() {
# extension without priority or name # extension without priority or name
filename="${filename##*.}" filename="${filename##*.}"
echo "${filename}" echo "${filename}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# This function searches an array for an exact match against the term passed # This function searches an array for an exact match against the term passed
@ -47,36 +65,81 @@ function _bash-it-get-component-type-from-path() {
# contains pear! # contains pear!
# #
# #
function _bash-it-array-contains-element() { function _bash-it-array-contains-element()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local e element="${1?}" local e element="${1?}"
shift shift
for e in "$@"; do for e in "${@}"; do
[[ "$e" == "${element}" ]] && return 0 [[ "$e" == "${element}" ]] && return 0
done done
return 1 return 1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Dedupe an array (without embedded newlines). # Dedupe an array (without embedded newlines).
function _bash-it-array-dedup() { function _bash-it-array-dedup()
printf '%s\n' "$@" | sort -u {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
printf '%s\n' "${@}" | sort -u
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Runs `grep` with *just* the provided arguments # Runs `grep` with *just* the provided arguments
function _bash-it-grep() { function _bash-it-grep()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
: "${BASH_IT_GREP:=$(type -P grep)}" : "${BASH_IT_GREP:=$(type -P grep)}"
"${BASH_IT_GREP:-/usr/bin/grep}" "$@" "${BASH_IT_GREP:-/usr/bin/grep}" "${@}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Runs `grep` with fixed-string expressions (-F) # Runs `grep` with fixed-string expressions (-F)
function _bash-it-fgrep() { function _bash-it-fgrep()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
: "${BASH_IT_GREP:=$(type -P grep)}" : "${BASH_IT_GREP:=$(type -P grep)}"
"${BASH_IT_GREP:-/usr/bin/grep}" -F "$@" "${BASH_IT_GREP:-/usr/bin/grep}" -F "${@}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Runs `grep` with extended regular expressions (-E) # Runs `grep` with extended regular expressions (-E)
function _bash-it-egrep() { function _bash-it-egrep()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
: "${BASH_IT_GREP:=$(type -P grep)}" : "${BASH_IT_GREP:=$(type -P grep)}"
"${BASH_IT_GREP:-/usr/bin/grep}" -E "$@" "${BASH_IT_GREP:-/usr/bin/grep}" -E "${@}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
########################################################################### ###########################################################################
@ -84,7 +147,12 @@ function _bash-it-egrep() {
# completion). # completion).
########################################################################### ###########################################################################
function _bash-it-component-help() { function _bash-it-component-help()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local component file func local component file func
_bash-it-component-pluralize "${1}" component _bash-it-component-pluralize "${1}" component
_bash-it-component-cache-file "${component}" file _bash-it-component-cache-file "${component}" file
@ -94,17 +162,35 @@ function _bash-it-component-help() {
"${func}" | _bash-it-egrep '\[[x ]\]' >| "${file}" "${func}" | _bash-it-egrep '\[[x ]\]' >| "${file}"
fi fi
cat "${file}" cat "${file}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-component-cache-file() { function _bash-it-component-cache-file()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local _component_to_cache _file_path _result="${2:-${FUNCNAME[0]//-/_}}" local _component_to_cache _file_path _result="${2:-${FUNCNAME[0]//-/_}}"
_bash-it-component-pluralize "${1?${FUNCNAME[0]}: component name required}" _component_to_cache _bash-it-component-pluralize "${1?${FUNCNAME[0]}: component name required}" _component_to_cache
_file_path="${XDG_CACHE_HOME:-${HOME?}/.cache}/bash/${_component_to_cache?}" _file_path="${XDG_CACHE_HOME:-${HOME?}/.cache}/bash/${_component_to_cache?}"
[[ -f "${_file_path}" ]] || mkdir -p "${_file_path%/*}" [[ -f "${_file_path}" ]] || mkdir -p "${_file_path%/*}"
printf -v "${_result?}" '%s' "${_file_path}" printf -v "${_result?}" '%s' "${_file_path}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-component-singularize() { function _bash-it-component-singularize()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local _result="${2:-${FUNCNAME[0]//-/_}}" local _result="${2:-${FUNCNAME[0]//-/_}}"
local _component_to_single="${1?${FUNCNAME[0]}: component name required}" local _component_to_single="${1?${FUNCNAME[0]}: component name required}"
local -i len="$((${#_component_to_single} - 2))" local -i len="$((${#_component_to_single} - 2))"
@ -116,9 +202,18 @@ function _bash-it-component-singularize() {
_component_to_single="${_component_to_single%es}" _component_to_single="${_component_to_single%es}"
fi fi
printf -v "${_result?}" '%s' "${_component_to_single}" printf -v "${_result?}" '%s' "${_component_to_single}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-component-pluralize() { function _bash-it-component-pluralize()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local _result="${2:-${FUNCNAME[0]//-/_}}" local _result="${2:-${FUNCNAME[0]//-/_}}"
local _component_to_plural="${1?${FUNCNAME[0]}: component name required}" local _component_to_plural="${1?${FUNCNAME[0]}: component name required}"
local -i len="$((${#_component_to_plural} - 1))" local -i len="$((${#_component_to_plural} - 1))"
@ -131,9 +226,18 @@ function _bash-it-component-pluralize() {
_component_to_plural="${_component_to_plural}es" _component_to_plural="${_component_to_plural}es"
fi fi
printf -v "${_result?}" '%s' "${_component_to_plural}" printf -v "${_result?}" '%s' "${_component_to_plural}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-component-cache-clean() { function _bash-it-component-cache-clean()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local component="${1:-}" local component="${1:-}"
local cache local cache
local -a components=('aliases' 'plugins' 'completions') local -a components=('aliases' 'plugins' 'completions')
@ -146,29 +250,69 @@ function _bash-it-component-cache-clean() {
_bash-it-component-cache-file "${component}" cache _bash-it-component-cache-file "${component}" cache
: >| "${cache:?}" : >| "${cache:?}"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Returns an array of items within each compoenent. # Returns an array of items within each compoenent.
function _bash-it-component-list() { function _bash-it-component-list()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local IFS=$'\n' component="${1}" local IFS=$'\n' component="${1}"
_bash-it-component-help "${component}" | awk '{print $1}' | sort -u _bash-it-component-help "${component}" | awk '{print $1}' | sort -u
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-component-list-matching() { function _bash-it-component-list-matching()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local component="${1}" local component="${1}"
shift shift
local term="${1}" local term="${1}"
_bash-it-component-help "${component}" | _bash-it-egrep -- "${term}" | awk '{print $1}' | sort -u _bash-it-component-help "${component}" | _bash-it-egrep -- "${term}" | awk '{print $1}' | sort -u
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-component-list-enabled() { function _bash-it-component-list-enabled()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local IFS=$'\n' component="${1}" local IFS=$'\n' component="${1}"
_bash-it-component-help "${component}" | _bash-it-fgrep '[x]' | awk '{print $1}' | sort -u _bash-it-component-help "${component}" | _bash-it-fgrep '[x]' | awk '{print $1}' | sort -u
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function _bash-it-component-list-disabled() { function _bash-it-component-list-disabled()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local IFS=$'\n' component="${1}" local IFS=$'\n' component="${1}"
_bash-it-component-help "${component}" | _bash-it-fgrep -v '[x]' | awk '{print $1}' | sort -u _bash-it-component-help "${component}" | _bash-it-fgrep -v '[x]' | awk '{print $1}' | sort -u
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Checks if a given item is enabled for a particular component/file-type. # Checks if a given item is enabled for a particular component/file-type.
@ -178,7 +322,12 @@ function _bash-it-component-list-disabled() {
# #
# Examples: # Examples:
# _bash-it-component-item-is-enabled alias git && echo "git alias is enabled" # _bash-it-component-item-is-enabled alias git && echo "git alias is enabled"
function _bash-it-component-item-is-enabled() { function _bash-it-component-item-is-enabled()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local component_type item_name each_file local component_type item_name each_file
if [[ -f "${1?}" ]] if [[ -f "${1?}" ]]
@ -199,6 +348,10 @@ function _bash-it-component-item-is-enabled() {
done done
return 1 return 1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Checks if a given item is disabled for a particular component/file-type. # Checks if a given item is disabled for a particular component/file-type.
@ -208,6 +361,15 @@ function _bash-it-component-item-is-enabled() {
# #
# Examples: # Examples:
# _bash-it-component-item-is-disabled alias git && echo "git aliases are disabled" # _bash-it-component-item-is-disabled alias git && echo "git aliases are disabled"
function _bash-it-component-item-is-disabled() { function _bash-it-component-item-is-disabled()
! _bash-it-component-item-is-enabled "$@" {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
! _bash-it-component-item-is-enabled "${@}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -5,7 +5,13 @@ about-plugin 'AWS helper functions'
AWS_CONFIG_FILE="${AWS_CONFIG_FILE:-$HOME/.aws/config}" AWS_CONFIG_FILE="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
AWS_SHARED_CREDENTIALS_FILE="${AWS_SHARED_CREDENTIALS_FILE:-$HOME/.aws/credentials}" AWS_SHARED_CREDENTIALS_FILE="${AWS_SHARED_CREDENTIALS_FILE:-$HOME/.aws/credentials}"
function awskeys { function awskeys()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'helper function for AWS credentials file' about 'helper function for AWS credentials file'
group 'aws' group 'aws'
@ -32,7 +38,14 @@ function awskeys {
fi fi
} }
function __awskeys_help { function __awskeys_help()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo -e "Usage: awskeys [COMMAND] [profile]\n" echo -e "Usage: awskeys [COMMAND] [profile]\n"
echo -e "Helper to AWS credentials file.\n" echo -e "Helper to AWS credentials file.\n"
echo -e "Commands:\n" echo -e "Commands:\n"
@ -41,18 +54,38 @@ function __awskeys_help {
echo " show Show the AWS keys associated to a credentials profile" echo " show Show the AWS keys associated to a credentials profile"
echo " export Export an AWS credentials profile keys as environment variables" echo " export Export an AWS credentials profile keys as environment variables"
echo " unset Unset the AWS keys variables from the environment" echo " unset Unset the AWS keys variables from the environment"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __awskeys_get { function __awskeys_get()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local ln=$(grep -n "\[ *$1 *\]" "${AWS_SHARED_CREDENTIALS_FILE}" | cut -d ":" -f 1) local ln=$(grep -n "\[ *$1 *\]" "${AWS_SHARED_CREDENTIALS_FILE}" | cut -d ":" -f 1)
if [[ -n "${ln}" ]] if [[ -n "${ln}" ]]
then then
tail -n +${ln} "${AWS_SHARED_CREDENTIALS_FILE}" | grep -F -m 2 -e "aws_access_key_id" -e "aws_secret_access_key" tail -n +${ln} "${AWS_SHARED_CREDENTIALS_FILE}" | grep -F -m 2 -e "aws_access_key_id" -e "aws_secret_access_key"
tail -n +${ln} "${AWS_SHARED_CREDENTIALS_FILE}" | grep -F -m 1 "aws_session_token" tail -n +${ln} "${AWS_SHARED_CREDENTIALS_FILE}" | grep -F -m 1 "aws_session_token"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __awskeys_list { function __awskeys_list()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local credentials_list="$((grep -E '^\[ *[a-zA-Z0-9_-]+ *\]$' "${AWS_SHARED_CREDENTIALS_FILE}"; grep "\[profile" "${AWS_CONFIG_FILE}" | sed "s|\[profile |\[|g") | sort | uniq)" local credentials_list="$((grep -E '^\[ *[a-zA-Z0-9_-]+ *\]$' "${AWS_SHARED_CREDENTIALS_FILE}"; grep "\[profile" "${AWS_CONFIG_FILE}" | sed "s|\[profile |\[|g") | sort | uniq)"
if [[ -n $"{credentials_list}" ]] if [[ -n $"{credentials_list}" ]]
then then
@ -64,9 +97,19 @@ function __awskeys_list {
else else
echo "No profiles found in credentials file" echo "No profiles found in credentials file"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __awskeys_show { function __awskeys_show()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local p_keys="$(__awskeys_get $1)" local p_keys="$(__awskeys_get $1)"
if [[ -n "${p_keys}" ]] if [[ -n "${p_keys}" ]]
then then
@ -74,9 +117,19 @@ function __awskeys_show {
else else
echo "Profile $1 not found in credentials file" echo "Profile $1 not found in credentials file"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __awskeys_export { function __awskeys_export()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if [[ $(__awskeys_list) == *"${1}"* ]] if [[ $(__awskeys_list) == *"${1}"* ]]
then then
local p_keys=( $(__awskeys_get $1 | tr -d " ") ) local p_keys=( $(__awskeys_get $1 | tr -d " ") )
@ -91,13 +144,33 @@ function __awskeys_export {
else else
echo "Profile $1 not found in credentials file" echo "Profile $1 not found in credentials file"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __awskeys_unset { function __awskeys_unset()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
unset AWS_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN unset AWS_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __awskeys_comp { function __awskeys_comp()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local cur prev opts prevprev local cur prev opts prevprev
COMPREPLY=() COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
@ -119,6 +192,10 @@ function __awskeys_comp {
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
complete -F __awskeys_comp awskeys complete -F __awskeys_comp awskeys

View File

@ -2,7 +2,12 @@
cite about-plugin cite about-plugin
about-plugin 'miscellaneous tools' about-plugin 'miscellaneous tools'
function ips() { function ips()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'display all ip addresses for this host' about 'display all ip addresses for this host'
group 'base' group 'base'
if _command_exists ifconfig if _command_exists ifconfig
@ -14,17 +19,35 @@ function ips() {
else else
echo "You don't have ifconfig or ip command installed!" echo "You don't have ifconfig or ip command installed!"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function down4me() { function down4me()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'checks whether a website is down for you, or everybody' about 'checks whether a website is down for you, or everybody'
param '1: website url' param '1: website url'
example '$ down4me http://www.google.com' example '$ down4me http://www.google.com'
group 'base' group 'base'
curl -Ls "http://downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g' curl -Ls "http://downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function myip() { function myip()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'displays your ip address, as seen by the Internet' about 'displays your ip address, as seen by the Internet'
group 'base' group 'base'
list=("http://myip.dnsomatic.com/" "http://checkip.dyndns.com/" "http://checkip.dyndns.org/") list=("http://myip.dnsomatic.com/" "http://checkip.dyndns.com/" "http://checkip.dyndns.org/")
@ -36,9 +59,18 @@ function myip() {
done done
res="$(echo "$res" | grep -Eo '[0-9\.]+')" res="$(echo "$res" | grep -Eo '[0-9\.]+')"
echo -e "Your public IP is: ${echo_bold_green-} $res ${echo_normal-}" echo -e "Your public IP is: ${echo_bold_green-} $res ${echo_normal-}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function pickfrom() { function pickfrom()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'picks random line from file' about 'picks random line from file'
param '1: filename' param '1: filename'
example '$ pickfrom /usr/share/dict/words' example '$ pickfrom /usr/share/dict/words'
@ -52,9 +84,18 @@ function pickfrom() {
length="$(wc -l < "$file")" length="$(wc -l < "$file")"
n=$((RANDOM * length / 32768 + 1)) n=$((RANDOM * length / 32768 + 1))
head -n "$n" "$file" | tail -1 head -n "$n" "$file" | tail -1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function passgen() { function passgen()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'generates random password from dictionary words' about 'generates random password from dictionary words'
param 'optional integer length' param 'optional integer length'
param 'if unset, defaults to 4' param 'if unset, defaults to 4'
@ -67,6 +108,10 @@ function passgen() {
pass="$(for i in $(eval "echo {1..$length}"); do pickfrom /usr/share/dict/words; done)" pass="$(for i in $(eval "echo {1..$length}"); do pickfrom /usr/share/dict/words; done)"
echo "With spaces (easier to memorize): ${pass//$'\n'/ }" echo "With spaces (easier to memorize): ${pass//$'\n'/ }"
echo "Without spaces (easier to brute force): ${pass//$'\n'/}" echo "Without spaces (easier to brute force): ${pass//$'\n'/}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Create alias pass to passgen when pass isn't installed or # Create alias pass to passgen when pass isn't installed or
@ -78,7 +123,12 @@ fi
if _command_exists markdown && _command_exists browser if _command_exists markdown && _command_exists browser
then then
function pmdown() { function pmdown()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'preview markdown file in a browser' about 'preview markdown file in a browser'
param '1: markdown file' param '1: markdown file'
example '$ pmdown README.md' example '$ pmdown README.md'
@ -88,7 +138,12 @@ if _command_exists markdown && _command_exists browser
} }
fi fi
function mkcd() { function mkcd()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'make one or more directories and cd into the last one' about 'make one or more directories and cd into the last one'
param 'one or more directories to create' param 'one or more directories to create'
example '$ mkcd foo' example '$ mkcd foo'
@ -96,37 +151,73 @@ function mkcd() {
example '$ mkcd foo foo1 foo2 fooN' example '$ mkcd foo foo1 foo2 fooN'
example '$ mkcd /tmp/img/photos/large /tmp/img/photos/self /tmp/img/photos/Beijing' example '$ mkcd /tmp/img/photos/large /tmp/img/photos/self /tmp/img/photos/Beijing'
group 'base' group 'base'
mkdir -p -- "$@" && cd -- "${!#}" || return mkdir -p -- "${@}" && cd -- "${!#}" || return
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# shellcheck disable=SC2010 # shellcheck disable=SC2010
function lsgrep() { function lsgrep()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'search through directory contents with grep' about 'search through directory contents with grep'
group 'base' group 'base'
ls | grep "$@" ls | grep "${@}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function quiet() { function quiet()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'what *does* this do?' about 'what *does* this do?'
group 'base' group 'base'
nohup "$@" &> /dev/null < /dev/null & nohup "${@}" &> /dev/null < /dev/null &
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function usage() { function usage()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'disk usage per directory, in Mac OS X and Linux' about 'disk usage per directory, in Mac OS X and Linux'
param '1: directory name' param '1: directory name'
group 'base' group 'base'
case $OSTYPE in case $OSTYPE in
*'darwin'*) *'darwin'*)
du -hd 1 "$@" du -hd 1 "${@}"
;; ;;
*'linux'*) *'linux'*)
du -h --max-depth=1 "$@" du -h --max-depth=1 "${@}"
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function t() { function t()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'todo.sh if available, otherwise one thing todo' about 'todo.sh if available, otherwise one thing todo'
param 'if not set, display todo item' param 'if not set, display todo item'
param '1: todo text' param '1: todo text'
@ -135,7 +226,7 @@ function t() {
if _bash-it-component-item-is-enabled plugin todo if _bash-it-component-item-is-enabled plugin todo
then then
todo.sh "$@" todo.sh "${@}"
return return
elif [[ ! -f "${todotxt}" && -f ~/.t ]] elif [[ ! -f "${todotxt}" && -f ~/.t ]]
then then
@ -146,13 +237,22 @@ function t() {
then then
cat "${todotxt}" cat "${todotxt}"
else else
echo "$@" >| "${todotxt}" echo "${@}" >| "${todotxt}"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
if _command_exists mkisofs if _command_exists mkisofs
then then
function mkiso() { function mkiso()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'creates iso from current dir in the parent dir (unless defined)' about 'creates iso from current dir in the parent dir (unless defined)'
param '1: ISO name' param '1: ISO name'
param '2: dest/path' param '2: dest/path'
@ -172,26 +272,48 @@ if _command_exists mkisofs
else else
echo "${destpath%/}/${isoname}.iso already exists" echo "${destpath%/}/${isoname}.iso already exists"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
fi fi
# useful for administrators and configs # useful for administrators and configs
function buf() { function buf()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'back up file with timestamp' about 'back up file with timestamp'
param 'filename' param 'filename'
group 'base' group 'base'
local filename="${1?}" filetime local filename="${1?}" filetime
filetime=$(date +%Y%m%d_%H%M%S) filetime=$(date +%Y%m%d_%H%M%S)
cp -a "${filename}" "${filename}_${filetime}" cp -a "${filename}" "${filename}_${filetime}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
if ! _command_exists del if ! _command_exists del
then then
function del() { function del()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'move files to hidden folder in tmp, that gets cleared on each reboot' about 'move files to hidden folder in tmp, that gets cleared on each reboot'
param 'file or folder to be deleted' param 'file or folder to be deleted'
example 'del ./file.txt' example 'del ./file.txt'
group 'base' group 'base'
mkdir -p /tmp/.trash && mv "$@" /tmp/.trash mkdir -p /tmp/.trash && mv "${@}" /tmp/.trash
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
fi fi

View File

@ -1,7 +1,12 @@
# shellcheck shell=bash # shellcheck shell=bash
about-plugin 'display info about your battery charge level' about-plugin 'display info about your battery charge level'
function ac_adapter_connected() { function ac_adapter_connected()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local batteries local batteries
if _command_exists upower if _command_exists upower
then then
@ -20,9 +25,18 @@ function ac_adapter_connected() {
then then
WMIC Path Win32_Battery Get BatteryStatus /Format:List | grep -q 'BatteryStatus=2' WMIC Path Win32_Battery Get BatteryStatus /Format:List | grep -q 'BatteryStatus=2'
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function ac_adapter_disconnected() { function ac_adapter_disconnected()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local batteries local batteries
if _command_exists upower if _command_exists upower
then then
@ -41,9 +55,18 @@ function ac_adapter_disconnected() {
then then
WMIC Path Win32_Battery Get BatteryStatus /Format:List | grep -q 'BatteryStatus=1' WMIC Path Win32_Battery Get BatteryStatus /Format:List | grep -q 'BatteryStatus=1'
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function battery_percentage() { function battery_percentage()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'displays battery charge as a percentage of full (100%)' about 'displays battery charge as a percentage of full (100%)'
group 'battery' group 'battery'
@ -75,9 +98,18 @@ function battery_percentage() {
else else
echo "${command_output}" echo "${command_output}"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function battery_charge() { function battery_charge()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'graphical display of your battery charge' about 'graphical display of your battery charge'
group 'battery' group 'battery'
@ -143,4 +175,8 @@ function battery_charge() {
echo "${danger_color}UNPLG${normal?}" echo "${danger_color}UNPLG${normal?}"
;; ;;
esac esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -3,7 +3,12 @@
cite about-plugin cite about-plugin
about-plugin 'render commandline output in your browser' about-plugin 'render commandline output in your browser'
function browser() { function browser()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'pipe html to a browser' about 'pipe html to a browser'
example '$ echo "<h1>hi mom!</h1>" | browser' example '$ echo "<h1>hi mom!</h1>" | browser'
example '$ ron -5 man/rip.5.ron | browser' example '$ ron -5 man/rip.5.ron | browser'
@ -23,10 +28,19 @@ function browser() {
cat /dev/stdin > $f cat /dev/stdin > $f
open $f open $f
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function wmate() { function wmate()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'pipe hot spicy interwebs into textmate and cleanup!' about 'pipe hot spicy interwebs into textmate and cleanup!'
example '$ wmate google.com' example '$ wmate google.com'
group 'browser' group 'browser'
@ -63,9 +77,18 @@ EOT`
reference wmate reference wmate
fi fi
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function raw() { function raw()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'write wget into a temp file and pump it into your browser' about 'write wget into a temp file and pump it into your browser'
example '$ raw google.com' example '$ raw google.com'
group 'browser' group 'browser'
@ -79,4 +102,8 @@ function raw() {
reference raw reference raw
fi fi
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -4,7 +4,12 @@ about-plugin 'Simplify `curl cht.sh/<query>` to `cht.sh <query>`'
# Play nicely if user already installed cht.sh cli tool # Play nicely if user already installed cht.sh cli tool
if ! _command_exists cht.sh if ! _command_exists cht.sh
then then
function cht.sh () { function cht.sh ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Executes a cht.sh curl query using the provided arguments' about 'Executes a cht.sh curl query using the provided arguments'
param ' [ ( topic [sub-topic] ) | ~keyword ] [ :list | :help | :learn ]' param ' [ ( topic [sub-topic] ) | ~keyword ] [ :list | :help | :learn ]'
example '$ cht.sh :help' example '$ cht.sh :help'
@ -18,5 +23,9 @@ if ! _command_exists cht.sh
# Separate arguments with '/', preserving spaces within them # Separate arguments with '/', preserving spaces within them
local query=$(IFS=/ ; echo "$*") local query=$(IFS=/ ; echo "$*")
curl "cht.sh/${query}" curl "cht.sh/${query}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
fi fi

View File

@ -2,7 +2,12 @@
cite about-plugin cite about-plugin
about-plugin 'Alert (BEL) when process ends after a threshold of seconds' about-plugin 'Alert (BEL) when process ends after a threshold of seconds'
function precmd_return_notification() { function precmd_return_notification()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local command_start="${COMMAND_DURATION_START_SECONDS:=0}" local command_start="${COMMAND_DURATION_START_SECONDS:=0}"
local current_time local current_time
current_time="$(_shell_duration_en)" current_time="$(_shell_duration_en)"
@ -12,6 +17,10 @@ function precmd_return_notification() {
printf '\a' printf '\a'
fi fi
return 0 return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
safe_append_prompt_command 'precmd_return_notification' safe_append_prompt_command 'precmd_return_notification'

View File

@ -1,126 +1,333 @@
# shellcheck shell=bash # shellcheck shell=bash
# shellcheck disable=SC2005 # shellcheck disable=SC2005
function __() { function __()
echo "$@" {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "${@}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __make_ansi() { function __make_ansi()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
next=$1 next=$1
shift shift
echo -e "\[\e[$("__$next" "$@")m\]" echo -e "\[\e[$("__$next" "${@}")m\]"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __make_echo() { function __make_echo()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
next=$1 next=$1
shift shift
echo -e "\033[$("__$next" "$@")m" echo -e "\033[$("__$next" "${@}")m"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __reset() { function __reset()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
next=$1 next=$1
shift shift
out="$("__$next" "$@")" out="$("__$next" "${@}")"
echo "0${out:+;${out}}" echo "0${out:+;${out}}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __bold() { function __bold()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
next=$1 next=$1
shift shift
out="$("__$next" "$@")" out="$("__$next" "${@}")"
echo "${out:+${out};}1" echo "${out:+${out};}1"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __faint() { function __faint()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
next=$1 next=$1
shift shift
out="$("__$next" "$@")" out="$("__$next" "${@}")"
echo "${out:+${out};}2" echo "${out:+${out};}2"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __italic() { function __italic()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
next=$1 next=$1
shift shift
out="$("__$next" "$@")" out="$("__$next" "${@}")"
echo "${out:+${out};}3" echo "${out:+${out};}3"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __underline() { function __underline()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
next=$1 next=$1
shift shift
out="$("__$next" "$@")" out="$("__$next" "${@}")"
echo "${out:+${out};}4" echo "${out:+${out};}4"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __negative() { function __negative()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
next=$1 next=$1
shift shift
out="$("__$next" "$@")" out="$("__$next" "${@}")"
echo "${out:+${out};}7" echo "${out:+${out};}7"
} }
function __crossed() { function __crossed()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
next=$1 next=$1
shift shift
out="$("__$next" "$@")" out="$("__$next" "${@}")"
echo "${out:+${out};}8" echo "${out:+${out};}8"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_normal_fg() { function __color_normal_fg()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "3$1" echo "3$1"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_normal_bg() { function __color_normal_bg()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "4$1" echo "4$1"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_bright_fg() { function __color_bright_fg()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "9$1" echo "9$1"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_bright_bg() { function __color_bright_bg()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "10$1" echo "10$1"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_black() { function __color_black()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "0" echo "0"
}
function __color_red() { ############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __color_red()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "1" echo "1"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_green() { function __color_green()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "2" echo "2"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_yellow() { function __color_yellow()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "3" echo "3"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_blue() { function __color_blue()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "4" echo "4"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_magenta() {
function __color_magenta()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "5" echo "5"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_cyan() {
function __color_cyan()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "6" echo "6"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_white() {
function __color_white()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "7" echo "7"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_rgb() {
function __color_rgb()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
r=$1 && g=$2 && b=$3 r=$1 && g=$2 && b=$3
[[ $r == "$g" && $g == "$b" ]] && echo $((r / 11 + 232)) && return # gray range above 232 [[ $r == "$g" && $g == "$b" ]] && echo $((r / 11 + 232)) && return # gray range above 232
echo "8;5;$(((r * 36 + b * 6 + g) / 51 + 16))" echo "8;5;$(((r * 36 + b * 6 + g) / 51 + 16))"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color() {
function __color()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
color="${1}" color="${1}"
shift shift
case "${1}" in case "${1}" in
@ -142,56 +349,168 @@ function __color() {
next=$1 next=$1
shift shift
out="$("__$next" "$@")" out="$("__$next" "${@}")"
echo "$("__color_${mode}_${side}" "$("__color_${color}" "$rgb")")${out:+;${out}}" echo "$("__color_${mode}_${side}" "$("__color_${color}" "$rgb")")${out:+;${out}}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __black() {
echo "$(__color black "$@")" function __black()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "$(__color black "${@}")"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __red() {
echo "$(__color red "$@")" function __red()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "$(__color red "${@}")"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __green() {
echo "$(__color green "$@")" function __green()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "$(__color green "${@}")"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __yellow() {
echo "$(__color yellow "$@")" function __yellow()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "$(__color yellow "${@}")"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __blue() {
echo "$(__color blue "$@")" function __blue()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "$(__color blue "${@}")"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __magenta() {
echo "$(__color magenta "$@")" function __magenta()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "$(__color magenta "${@}")"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __cyan() {
echo "$(__color cyan "$@")" function __cyan()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "$(__color cyan "${@}")"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __white() {
echo "$(__color white "$@")" function __white()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "$(__color white "${@}")"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __rgb() {
echo "$(__color rgb "$@")" function __rgb()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "$(__color rgb "${@}")"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function __color_parse() {
function __color_parse()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
next=$1 next=$1
shift shift
echo "$("__$next" "$@")" echo "$("__$next" "${@}")"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function color() {
echo "$(__color_parse make_ansi "$@")" function color()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "$(__color_parse make_ansi "${@}")"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function echo_color() {
echo "$(__color_parse make_echo "$@")" function echo_color()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "$(__color_parse make_echo "${@}")"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -32,7 +32,12 @@ alias pu="pushd"
# Pop current location # Pop current location
alias po="popd" alias po="popd"
function dirs-help() { function dirs-help()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'directory navigation alias usage' about 'directory navigation alias usage'
group 'dirs' group 'dirs'
@ -54,8 +59,12 @@ function dirs-help() {
echo "7 : Change to stack location 7." echo "7 : Change to stack location 7."
echo "8 : Change to stack location 8." echo "8 : Change to stack location 8."
echo "9 : Change to stack location 9." echo "9 : Change to stack location 9."
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Add bookmarking functionality # Add bookmarking functionality
# Usage: # Usage:
@ -79,16 +88,30 @@ fi
alias L='cat "${BASH_IT_DIRS_BKS?}"' alias L='cat "${BASH_IT_DIRS_BKS?}"'
# Goes to destination dir, otherwise stay in the dir # Goes to destination dir, otherwise stay in the dir
function G() { function G()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'goes to destination dir' about 'goes to destination dir'
param '1: directory' param '1: directory'
example '$ G ..' example '$ G ..'
group 'dirs' group 'dirs'
cd "${1:-${PWD}}" || return cd "${1:-${PWD}}" || return
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function S() {
function S()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'save a bookmark' about 'save a bookmark'
param '1: bookmark name' param '1: bookmark name'
example '$ S mybkmrk' example '$ S mybkmrk'
@ -104,9 +127,18 @@ function S() {
echo "${1}"=\""${PWD}"\" >> "${BASH_IT_DIRS_BKS?}" echo "${1}"=\""${PWD}"\" >> "${BASH_IT_DIRS_BKS?}"
# shellcheck disable=SC1090 # shellcheck disable=SC1090
source "${BASH_IT_DIRS_BKS?}" source "${BASH_IT_DIRS_BKS?}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function R() {
function R()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'remove a bookmark' about 'remove a bookmark'
param '1: bookmark name' param '1: bookmark name'
example '$ R mybkmrk' example '$ R mybkmrk'
@ -119,6 +151,10 @@ function R() {
sed "/$1/d" "${BASH_IT_DIRS_BKS?}" > "${BASH_IT_DIRS_BKS?}.new" sed "/$1/d" "${BASH_IT_DIRS_BKS?}" > "${BASH_IT_DIRS_BKS?}.new"
command mv "${BASH_IT_DIRS_BKS?}.new" "${BASH_IT_DIRS_BKS?}" command mv "${BASH_IT_DIRS_BKS?}.new" "${BASH_IT_DIRS_BKS?}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
alias U='source "${BASH_IT_DIRS_BKS?}"' # Update bookmark stack alias U='source "${BASH_IT_DIRS_BKS?}"' # Update bookmark stack

View File

@ -1,7 +1,12 @@
cite about-plugin cite about-plugin
about-plugin 'Helper functions for using docker-compose' about-plugin 'Helper functions for using docker-compose'
function docker-compose-fresh() { function docker-compose-fresh()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Shut down, remove and start again the docker-compose setup, then tail the logs' about 'Shut down, remove and start again the docker-compose setup, then tail the logs'
group 'docker-compose' group 'docker-compose'
param '1: name of the docker-compose.yaml file to use (optional). Default: docker-compose.yaml' param '1: name of the docker-compose.yaml file to use (optional). Default: docker-compose.yaml'
@ -18,4 +23,8 @@ function docker-compose-fresh() {
docker-compose $DCO_FILE_PARAM rm -f docker-compose $DCO_FILE_PARAM rm -f
docker-compose $DCO_FILE_PARAM up -d docker-compose $DCO_FILE_PARAM up -d
docker-compose $DCO_FILE_PARAM logs -f --tail 100 docker-compose $DCO_FILE_PARAM logs -f --tail 100
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -1,35 +1,76 @@
cite about-plugin cite about-plugin
about-plugin 'Helpers to more easily work with Docker' about-plugin 'Helpers to more easily work with Docker'
function docker-remove-most-recent-container() { function docker-remove-most-recent-container()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'attempt to remove the most recent container from docker ps -a' about 'attempt to remove the most recent container from docker ps -a'
group 'docker' group 'docker'
docker ps -ql | xargs docker rm docker ps -ql | xargs docker rm
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function docker-remove-most-recent-image() {
function docker-remove-most-recent-image()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'attempt to remove the most recent image from docker images' about 'attempt to remove the most recent image from docker images'
group 'docker' group 'docker'
docker images -q | head -1 | xargs docker rmi docker images -q | head -1 | xargs docker rmi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function docker-remove-stale-assets() {
function docker-remove-stale-assets()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'attempt to remove exited containers and dangling images' about 'attempt to remove exited containers and dangling images'
group 'docker' group 'docker'
docker ps --filter status=exited -q | xargs docker rm --volumes docker ps --filter status=exited -q | xargs docker rm --volumes
docker images --filter dangling=true -q | xargs docker rmi docker images --filter dangling=true -q | xargs docker rmi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function docker-enter() {
function docker-enter()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'enter the specified docker container using bash' about 'enter the specified docker container using bash'
group 'docker' group 'docker'
param '1: Name of the container to enter' param '1: Name of the container to enter'
example 'docker-enter oracle-xe' example 'docker-enter oracle-xe'
docker exec -it "$@" /bin/bash; docker exec -it "${@}" /bin/bash;
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function docker-remove-images() {
function docker-remove-images()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'attempt to remove images with supplied tags or all if no tags are supplied' about 'attempt to remove images with supplied tags or all if no tags are supplied'
group 'docker' group 'docker'
if [ -z "${1}" ] if [ -z "${1}" ]
@ -43,9 +84,18 @@ function docker-remove-images() {
# Strip out duplicate IDs before attempting to remove the image(s) # Strip out duplicate IDs before attempting to remove the image(s)
docker rmi $(echo ${ID_ARRAY[@]} | tr ' ' '\n' | sort -u | tr '\n' ' ') docker rmi $(echo ${ID_ARRAY[@]} | tr ' ' '\n' | sort -u | tr '\n' ' ')
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function docker-image-dependencies() {
function docker-image-dependencies()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'attempt to create a Graphiz image of the supplied image ID dependencies' about 'attempt to create a Graphiz image of the supplied image ID dependencies'
group 'docker' group 'docker'
if hash dot 2>/dev/null if hash dot 2>/dev/null
@ -63,15 +113,33 @@ function docker-image-dependencies() {
else else
>&2 echo "Can't show dependencies; Graphiz is not installed" >&2 echo "Can't show dependencies; Graphiz is not installed"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function docker-runtime-environment() {
function docker-runtime-environment()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'attempt to list the environmental variables of the supplied image ID' about 'attempt to list the environmental variables of the supplied image ID'
group 'docker' group 'docker'
docker run "$@" env docker run "${@}" env
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function docker-archive-content() {
function docker-archive-content()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'show the content of the provided Docker image archive' about 'show the content of the provided Docker image archive'
group 'docker' group 'docker'
param '1: image archive name' param '1: image archive name'
@ -81,4 +149,8 @@ function docker-archive-content() {
then then
tar -xzOf $1 manifest.json | jq '[.[] | .RepoTags] | add' tar -xzOf $1 manifest.json | jq '[.[] | .RepoTags] | add'
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -1,7 +1,12 @@
cite about-plugin cite about-plugin
about-plugin 'mankier.com explain function to explain other commands' about-plugin 'mankier.com explain function to explain other commands'
explain () { function explain ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'explain any bash command via mankier.com manpage API' about 'explain any bash command via mankier.com manpage API'
param '1: Name of the command to explain' param '1: Name of the command to explain'
example '$ explain # interactive mode. Type commands to explain in REPL' example '$ explain # interactive mode. Type commands to explain in REPL'
@ -22,4 +27,9 @@ explain () {
echo "explain interactive mode." echo "explain interactive mode."
echo "explain 'cmd -o | ...' one quoted command to explain it." echo "explain 'cmd -o | ...' one quoted command to explain it."
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -2,7 +2,12 @@ cite about-plugin
about-plugin 'one command to extract them all...' about-plugin 'one command to extract them all...'
# extract file(s) from compressed status # extract file(s) from compressed status
extract() { function extract()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local opt local opt
local OPTIND=1 local OPTIND=1
while getopts "hv" opt; do while getopts "hv" opt; do
@ -56,7 +61,7 @@ End-Of-Usage
*.tar.Z) tar "x${verbose}Zf" "${1}" -C "$filedirname/$targetdirname" ;; *.tar.Z) tar "x${verbose}Zf" "${1}" -C "$filedirname/$targetdirname" ;;
*.bz2) bunzip2 "${1}" ;; *.bz2) bunzip2 "${1}" ;;
*.deb) dpkg-deb -x${verbose} "${1}" "${1:0:-4}" ;; *.deb) dpkg-deb -x${verbose} "${1}" "${1:0:-4}" ;;
*.pax.gz) gunzip "${1}"; set -- "$@" "${1:0:-3}" ;; *.pax.gz) gunzip "${1}"; set -- "${@}" "${1:0:-3}" ;;
*.gz) gunzip "${1}" ;; *.gz) gunzip "${1}" ;;
*.pax) pax -r -f "${1}" ;; *.pax) pax -r -f "${1}" ;;
*.pkg) pkgutil --expand "${1}" "${1:0:-4}" ;; *.pkg) pkgutil --expand "${1}" "${1:0:-4}" ;;
@ -73,4 +78,8 @@ End-Of-Usage
shift shift
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -20,7 +20,12 @@ if [ -z ${FZF_DEFAULT_COMMAND+x} ] && _command_exists fd
export FZF_DEFAULT_COMMAND='fd --type f' export FZF_DEFAULT_COMMAND='fd --type f'
fi fi
fe() { function fe()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about "Open the selected file in the default editor" about "Open the selected file in the default editor"
group "fzf" group "fzf"
param "1: Search term" param "1: Search term"
@ -30,9 +35,18 @@ fe() {
local files local files
files=($(fzf-tmux --query="${1}" --multi --select-1 --exit-0)) files=($(fzf-tmux --query="${1}" --multi --select-1 --exit-0))
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}" [[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
fcd() {
function fcd()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about "cd to the selected directory" about "cd to the selected directory"
group "fzf" group "fzf"
param "1: Directory to browse, or . if omitted" param "1: Directory to browse, or . if omitted"
@ -42,4 +56,8 @@ fcd() {
dir=$(find ${1:-.} -path '*/\.*' -prune \ dir=$(find ${1:-.} -path '*/\.*' -prune \
-o -type d -print 2> /dev/null | fzf +m) && -o -type d -print 2> /dev/null | fzf +m) &&
cd "$dir" cd "$dir"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -12,7 +12,12 @@ about-plugin 'video to gif, gif to WebM helper functions'
# Optional: if lossy is not important, Ubuntu has gifsicle packaged for apt-get, instead of giflossy # Optional: if lossy is not important, Ubuntu has gifsicle packaged for apt-get, instead of giflossy
# Optional: gifski (from `brew install gifski` or github.com/ImageOptim/gifski) # Optional: gifski (from `brew install gifski` or github.com/ImageOptim/gifski)
# for high quality huge files. # for high quality huge files.
function v2gif() { function v2gif()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Converts a .mov/.avi/.mp4 file into an into an animated GIF.' about 'Converts a .mov/.avi/.mp4 file into an into an animated GIF.'
group 'gif' group 'gif'
param '1: MOV/AVI/MP4 file name(s)' param '1: MOV/AVI/MP4 file name(s)'
@ -65,7 +70,7 @@ function v2gif() {
fi fi
# Parse the options # Parse the options
args=$("$getopt" -l "alert:" -l "lossy:" -l "width:" -l del,delete -l high -l tag -l "fps:" -l webm -o "a:l:w:f:dhmt" -- "$@") || { args=$("$getopt" -l "alert:" -l "lossy:" -l "width:" -l del,delete -l high -l tag -l "fps:" -l webm -o "a:l:w:f:dhmt" -- "${@}") || {
echo 'Terminating...' >&2 echo 'Terminating...' >&2
return 2 return 2
} }
@ -217,9 +222,18 @@ function v2gif() {
done done
echo "$(tput setaf 2)Done.$(tput sgr 0)" echo "$(tput setaf 2)Done.$(tput sgr 0)"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function any2webm() {
function any2webm()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Converts an movies and Animated GIF files into an into a modern quality WebM video.' about 'Converts an movies and Animated GIF files into an into a modern quality WebM video.'
group 'gif' group 'gif'
param '1: GIF/video file name(s)' param '1: GIF/video file name(s)'
@ -235,7 +249,7 @@ function any2webm() {
local args out_size local args out_size
# Parse the options # Parse the options
args=$(getopt -l alert -l "bandwidth:" -l "width:" -l del,delete -l tag -l "fps:" -l webm -o "a:b:w:f:dt" -- "$@") || { args=$(getopt -l alert -l "bandwidth:" -l "width:" -l del,delete -l tag -l "fps:" -l webm -o "a:b:w:f:dt" -- "${@}") || {
echo 'Terminating...' >&2 echo 'Terminating...' >&2
return 2 return 2
} }
@ -329,4 +343,8 @@ function any2webm() {
done done
echo "$(tput setaf 2)Done.$(tput sgr 0)" echo "$(tput setaf 2)Done.$(tput sgr 0)"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -9,26 +9,47 @@ function git_remote {
echo "Running: git remote add origin ${GIT_HOSTING:?}:$1.git" echo "Running: git remote add origin ${GIT_HOSTING:?}:$1.git"
git remote add origin "${GIT_HOSTING}:${1}".git git remote add origin "${GIT_HOSTING}:${1}".git
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git_first_push { function git_first_push {
about 'push into origin refs/heads/master' about 'push into origin refs/heads/master'
group 'git' group 'git'
echo "Running: git push origin master:refs/heads/master" echo "Running: git push origin master:refs/heads/master"
git push origin master:refs/heads/master git push origin master:refs/heads/master
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git_pub() { function git_pub()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'publishes current branch to remote origin' about 'publishes current branch to remote origin'
group 'git' group 'git'
BRANCH=$(git rev-parse --abbrev-ref HEAD) BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "Publishing ${BRANCH} to remote origin" echo "Publishing ${BRANCH} to remote origin"
git push -u origin "${BRANCH}" git push -u origin "${BRANCH}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git_revert() {
function git_revert()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'applies changes to HEAD that revert all changes after this commit' about 'applies changes to HEAD that revert all changes after this commit'
group 'git' group 'git'
@ -36,30 +57,67 @@ function git_revert() {
git reset --soft "HEAD@{1}" git reset --soft "HEAD@{1}"
git commit -m "Revert to ${1}" git commit -m "Revert to ${1}"
git reset --hard git reset --hard
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git_rollback() {
function git_rollback()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'resets the current HEAD to this commit' about 'resets the current HEAD to this commit'
group 'git' group 'git'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function is_clean() { function is_clean()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]
then then
echo "Your branch is dirty, please commit your changes" echo "Your branch is dirty, please commit your changes"
kill -INT $$ kill -INT $$
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function commit_exists() {
function commit_exists()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if git rev-list --quiet "${1:?}" if git rev-list --quiet "${1:?}"
then then
echo "Commit ${1} does not exist" echo "Commit ${1} does not exist"
kill -INT $$ kill -INT $$
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function keep_changes() {
while true; do function keep_changes()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
while true
do
# shellcheck disable=SC2162 # shellcheck disable=SC2162
read -p "Do you want to keep all changes from rolled back revisions in your working tree? [Y/N]" RESP read -p "Do you want to keep all changes from rolled back revisions in your working tree? [Y/N]" RESP
case "${RESP}" in case "${RESP}" in
@ -79,7 +137,6 @@ function git_rollback() {
;; ;;
esac esac
done done
}
if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ] if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]
then then
@ -106,25 +163,52 @@ function git_rollback() {
else else
echo "you're currently not in a git repository" echo "you're currently not in a git repository"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git_remove_missing_files() {
function git_remove_missing_files()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about "git rm's missing files" about "git rm's missing files"
group 'git' group 'git'
git ls-files -d -z | xargs -0 git update-index --remove git ls-files -d -z | xargs -0 git update-index --remove
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Adds files to git's exclude file (same as .gitignore) # Adds files to git's exclude file (same as .gitignore)
function local-ignore() { function local-ignore()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'adds file or path to git exclude file' about 'adds file or path to git exclude file'
param '1: file or path fragment to ignore' param '1: file or path fragment to ignore'
group 'git' group 'git'
echo "${1}" >> .git/info/exclude echo "${1}" >> .git/info/exclude
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# get a quick overview for your git repo # get a quick overview for your git repo
function git_info() { function git_info()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'overview for your git repo' about 'overview for your git repo'
group 'git' group 'git'
@ -161,8 +245,12 @@ function git_info() {
echo "you're currently not in a git repository" echo "you're currently not in a git repository"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git_stats { function git_stats {
about 'display stats per author' about 'display stats per author'
group 'git' group 'git'
@ -210,9 +298,18 @@ function git_stats {
else else
echo "you're currently not in a git repository" echo "you're currently not in a git repository"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function gittowork() {
function gittowork()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Places the latest .gitignore file for a given project type in the current directory, or concatenates onto an existing .gitignore' about 'Places the latest .gitignore file for a given project type in the current directory, or concatenates onto an existing .gitignore'
group 'git' group 'git'
param '1: the language/type of the project, used for determining the contents of the .gitignore file' param '1: the language/type of the project, used for determining the contents of the .gitignore file'
@ -234,9 +331,18 @@ function gittowork() {
fi fi
echo "${result}" >> .gitignore echo "${result}" >> .gitignore
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function gitignore-reload() {
function gitignore-reload()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Empties the git cache, and readds all files not blacklisted by .gitignore' about 'Empties the git cache, and readds all files not blacklisted by .gitignore'
group 'git' group 'git'
example '$ gitignore-reload' example '$ gitignore-reload'
@ -288,9 +394,18 @@ function gitignore-reload() {
git add . git add .
echo >&2 "Files readded. Commit your new changes now." echo >&2 "Files readded. Commit your new changes now."
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git-changelog() {
function git-changelog()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# --------------------------------------------------------------- # ---------------------------------------------------------------
# ORIGINAL ANSWER: https://stackoverflow.com/a/2979587/10362396 | # ORIGINAL ANSWER: https://stackoverflow.com/a/2979587/10362396 |
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -331,4 +446,7 @@ function git-changelog() {
NEXT=${DATE} NEXT=${DATE}
done done
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -1,14 +1,23 @@
cite about-plugin cite about-plugin
about-plugin 'speeds up your life by using gitstatus for git status calculations. install from https://github.com/romkatv/gitstatus' about-plugin 'speeds up your life by using gitstatus for git status calculations. install from https://github.com/romkatv/gitstatus'
function gitstatus_on_disable() { function gitstatus_on_disable()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Destructor of gitstatus plugin' about 'Destructor of gitstatus plugin'
group 'gitstatus' group 'gitstatus'
unset SCM_GIT_USE_GITSTATUS unset SCM_GIT_USE_GITSTATUS
_command_exists gitstatus_stop && gitstatus_stop _command_exists gitstatus_stop && gitstatus_stop
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# No scm-check # No scm-check
[[ $SCM_CHECK == "true" ]] || return [[ $SCM_CHECK == "true" ]] || return

View File

@ -16,7 +16,12 @@ export GOPATH="${GOPATH:-$(go env GOPATH)}"
# might be managed differently, we add each path's /bin folder to PATH using pathmunge, # might be managed differently, we add each path's /bin folder to PATH using pathmunge,
# while preserving ordering. # while preserving ordering.
# e.g. GOPATH=foo:bar -> PATH=foo/bin:bar/bin # e.g. GOPATH=foo:bar -> PATH=foo/bin:bar/bin
_bash-it-gopath-pathmunge() { function _bash-it-gopath-pathmunge()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
_about 'Ensures paths in GOPATH are added to PATH using pathmunge, with /bin appended' _about 'Ensures paths in GOPATH are added to PATH using pathmunge, with /bin appended'
_group 'go' _group 'go'
if [[ -z $GOPATH ]] if [[ -z $GOPATH ]]
@ -34,5 +39,9 @@ _bash-it-gopath-pathmunge() {
pathmunge "${paths[i]}/bin" pathmunge "${paths[i]}/bin"
fi fi
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_bash-it-gopath-pathmunge _bash-it-gopath-pathmunge

View File

@ -30,15 +30,33 @@ eval "$(goenv init - bash)"
# If moving to a directory with a goenv version set, reload the shell # If moving to a directory with a goenv version set, reload the shell
# to ensure the shell environment matches expectations. # to ensure the shell environment matches expectations.
_bash-it-goenv-preexec() { function _bash-it-goenv-preexec()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
GOENV_OLD_VERSION="$(goenv version-name)" GOENV_OLD_VERSION="$(goenv version-name)"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_bash-it-goenv-precmd() {
function _bash-it-goenv-precmd()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if [[ -n $GOENV_OLD_VERSION ]] && [[ "$GOENV_OLD_VERSION" != "$(goenv version-name)" ]] if [[ -n $GOENV_OLD_VERSION ]] && [[ "$GOENV_OLD_VERSION" != "$(goenv version-name)" ]]
then then
exec env -u PATH -u GOROOT -u GOPATH -u GOENV_OLD_VERSION "${0/-/}" --login exec env -u PATH -u GOROOT -u GOPATH -u GOENV_OLD_VERSION "${0/-/}" --login
fi fi
unset GOENV_OLD_VERSION unset GOENV_OLD_VERSION
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
preexec_functions+=(_bash-it-goenv-preexec) preexec_functions+=(_bash-it-goenv-preexec)
precmd_functions+=(_bash-it-goenv-precmd) precmd_functions+=(_bash-it-goenv-precmd)

View File

@ -1,7 +1,12 @@
cite about-plugin cite about-plugin
about-plugin 'Add a gw command to use gradle wrapper if present, else use system gradle' about-plugin 'Add a gw command to use gradle wrapper if present, else use system gradle'
function gw() { function gw()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local file="gradlew" local file="gradlew"
local result local result
@ -9,4 +14,8 @@ function gw() {
# Call gradle # Call gradle
"${result:-gradle}" $* "${result:-gradle}" $*
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -1,25 +1,52 @@
cite about-plugin cite about-plugin
about-plugin 'hg helper functions' about-plugin 'hg helper functions'
function hg_dirty() { function hg_dirty()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'displays dirty status of hg repository' about 'displays dirty status of hg repository'
group 'hg' group 'hg'
hg status --no-color 2> /dev/null \ hg status --no-color 2> /dev/null \
| awk '$1 == "?" { print "?" } $1 != "?" { print "!" }' \ | awk '$1 == "?" { print "?" } $1 != "?" { print "!" }' \
| sort | uniq | head -c1 | sort | uniq | head -c1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function hg_in_repo() {
function hg_in_repo()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'determine if pwd is an hg repo' about 'determine if pwd is an hg repo'
group 'hg' group 'hg'
[[ `hg branch 2> /dev/null` ]] && echo 'on ' [[ `hg branch 2> /dev/null` ]] && echo 'on '
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function hg_branch() {
function hg_branch()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'display current hg branch' about 'display current hg branch'
group 'hg' group 'hg'
hg branch 2> /dev/null hg branch 2> /dev/null
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -13,7 +13,12 @@ shopt -s histappend
# resize history to 100x the default (500) # resize history to 100x the default (500)
: "${HISTSIZE:=50000}" : "${HISTSIZE:=50000}"
function top-history() { function top-history()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'print the name and count of the most commonly run tools' about 'print the name and count of the most commonly run tools'
# - Make sure formatting doesn't interfer with our parsing # - Make sure formatting doesn't interfer with our parsing
@ -33,4 +38,8 @@ function top-history() {
--table \ --table \
--table-columns 'Command Count,Command Name' \ --table-columns 'Command Count,Command Name' \
--output-separator ' | ' --output-separator ' | '
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -6,14 +6,28 @@ about-plugin 'download jquery files into current project'
[[ -z "$JQUERY_VERSION_NUMBER" ]] && JQUERY_VERSION_NUMBER="1.6.1" [[ -z "$JQUERY_VERSION_NUMBER" ]] && JQUERY_VERSION_NUMBER="1.6.1"
[[ -z "$JQUERY_UI_VERSION_NUMBER" ]] && JQUERY_UI_VERSION_NUMBER="1.8.13" [[ -z "$JQUERY_UI_VERSION_NUMBER" ]] && JQUERY_UI_VERSION_NUMBER="1.8.13"
function rails_jquery { function rails_jquery()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'download rails.js into public/javascripts' about 'download rails.js into public/javascripts'
group 'javascript' group 'javascript'
curl -o public/javascripts/rails.js http://github.com/rails/jquery-ujs/raw/master/src/rails.js curl -o public/javascripts/rails.js http://github.com/rails/jquery-ujs/raw/master/src/rails.js
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function jquery_install { function jquery_install()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'download jquery.js into public/javascripts' about 'download jquery.js into public/javascripts'
group 'javascript' group 'javascript'
@ -24,9 +38,18 @@ function jquery_install {
version="${1}" version="${1}"
fi fi
curl -o public/javascripts/jquery.js "http://ajax.googleapis.com/ajax/libs/jquery/$version/jquery.min.js" curl -o public/javascripts/jquery.js "http://ajax.googleapis.com/ajax/libs/jquery/$version/jquery.min.js"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function jquery_ui_install { function jquery_ui_install()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'download jquery_us.js into public/javascripts' about 'download jquery_us.js into public/javascripts'
group 'javascript' group 'javascript'
@ -38,4 +61,8 @@ function jquery_ui_install {
fi fi
curl -o public/javascripts/jquery_ui.js "http://ajax.googleapis.com/ajax/libs/jqueryui/$version/jquery-ui.min.js" curl -o public/javascripts/jquery_ui.js "http://ajax.googleapis.com/ajax/libs/jqueryui/$version/jquery-ui.min.js"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -2,7 +2,12 @@
cite about-plugin cite about-plugin
about-plugin 'manage your jekyll site' about-plugin 'manage your jekyll site'
function editpost() { function editpost()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'edit a post' about 'edit a post'
param '1: site directory' param '1: site directory'
group 'jekyll' group 'jekyll'
@ -45,9 +50,18 @@ function editpost() {
ret="$?" ret="$?"
popd > /dev/null || return "$ret" popd > /dev/null || return "$ret"
return "$ret" return "$ret"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function newpost() {
function newpost()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'create a new post' about 'create a new post'
param '1: site directory' param '1: site directory'
group 'jekyll' group 'jekyll'
@ -189,9 +203,18 @@ function newpost() {
ret="$?" ret="$?"
popd > /dev/null || return "$ret" popd > /dev/null || return "$ret"
return "$ret" return "$ret"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function testsite() {
function testsite()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'launches local jekyll server' about 'launches local jekyll server'
param '1: site directory' param '1: site directory'
group 'jekyll' group 'jekyll'
@ -224,9 +247,18 @@ function testsite() {
ret="$?" ret="$?"
popd > /dev/null || return "$ret" popd > /dev/null || return "$ret"
return "$ret" return "$ret"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function buildsite() {
function buildsite()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'builds site' about 'builds site'
param '1: site directory' param '1: site directory'
group 'jekyll' group 'jekyll'
@ -260,9 +292,18 @@ function buildsite() {
ret="$?" ret="$?"
popd > /dev/null || return "$ret" popd > /dev/null || return "$ret"
return "$ret" return "$ret"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function deploysite() {
function deploysite()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'rsyncs site to remote host' about 'rsyncs site to remote host'
param '1: site directory' param '1: site directory'
group 'jekyll' group 'jekyll'
@ -298,8 +339,12 @@ function deploysite() {
ret="$?" ret="$?"
popd > /dev/null || return "$ret" popd > /dev/null || return "$ret"
return "$ret" return "$ret"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Load the Jekyll config # Load the Jekyll config
if [[ -s "$HOME/.jekyllconfig" ]] if [[ -s "$HOME/.jekyllconfig" ]]
then then

View File

@ -1,28 +1,63 @@
cite about-plugin cite about-plugin
about-plugin 'Maven jgitflow build helpers' about-plugin 'Maven jgitflow build helpers'
function hotfix-start { function hotfix-start()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'helper function for starting a new hotfix' about 'helper function for starting a new hotfix'
group 'jgitflow' group 'jgitflow'
mvn jgitflow:hotfix-start ${JGITFLOW_MVN_ARGUMENTS} mvn jgitflow:hotfix-start ${JGITFLOW_MVN_ARGUMENTS}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function hotfix-finish {
function hotfix-finish()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'helper function for finishing a hotfix' about 'helper function for finishing a hotfix'
group 'jgitflow' group 'jgitflow'
mvn jgitflow:hotfix-finish -Darguments="${JGITFLOW_MVN_ARGUMENTS}" && git push && git push origin master && git push --tags mvn jgitflow:hotfix-finish -Darguments="${JGITFLOW_MVN_ARGUMENTS}" && git push && git push origin master && git push --tags
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function feature-start {
function feature-start()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'helper function for starting a new feature' about 'helper function for starting a new feature'
group 'jgitflow' group 'jgitflow'
mvn jgitflow:feature-start ${JGITFLOW_MVN_ARGUMENTS} mvn jgitflow:feature-start ${JGITFLOW_MVN_ARGUMENTS}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function feature-finish {
function feature-finish()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'helper function for finishing a feature' about 'helper function for finishing a feature'
group 'jgitflow' group 'jgitflow'
@ -30,18 +65,43 @@ function feature-finish {
echo -e '\033[32m----------------------------------------------------------------\033[0m' echo -e '\033[32m----------------------------------------------------------------\033[0m'
echo -e '\033[32m===== REMEMBER TO CREATE A NEW RELEASE TO DEPLOY THIS FEATURE ====\033[0m' echo -e '\033[32m===== REMEMBER TO CREATE A NEW RELEASE TO DEPLOY THIS FEATURE ====\033[0m'
echo -e '\033[32m----------------------------------------------------------------\033[0m' echo -e '\033[32m----------------------------------------------------------------\033[0m'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function release-start {
function release-start()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'helper function for starting a new release' about 'helper function for starting a new release'
group 'jgitflow' group 'jgitflow'
mvn jgitflow:release-start ${JGITFLOW_MVN_ARGUMENTS} mvn jgitflow:release-start ${JGITFLOW_MVN_ARGUMENTS}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function release-finish {
function release-finish()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'helper function for finishing a release' about 'helper function for finishing a release'
group 'jgitflow' group 'jgitflow'
mvn jgitflow:release-finish -Darguments="${JGITFLOW_MVN_ARGUMENTS}" && git push && git push origin master && git push --tags mvn jgitflow:release-finish -Darguments="${JGITFLOW_MVN_ARGUMENTS}" && git push && git push origin master && git push --tags
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -3,11 +3,20 @@
cite about-plugin cite about-plugin
about-plugin 'initialize jump (see https://github.com/gsamokovarov/jump). Add `export JUMP_OPTS=("--bind=z")` to change keybinding' about-plugin 'initialize jump (see https://github.com/gsamokovarov/jump). Add `export JUMP_OPTS=("--bind=z")` to change keybinding'
function __init_jump() { function __init_jump()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if _command_exists jump if _command_exists jump
then then
eval "$(jump shell bash "${JUMP_OPTS[@]}")" eval "$(jump shell bash "${JUMP_OPTS[@]}")"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
__init_jump __init_jump

View File

@ -6,18 +6,36 @@ _command_exists pygmentize || return
# pigmentize cat and less outputs - call them ccat and cless to avoid that # pigmentize cat and less outputs - call them ccat and cless to avoid that
# especially cat'ed output in scripts gets mangled with pygemtized meta characters # especially cat'ed output in scripts gets mangled with pygemtized meta characters
function ccat() { function ccat()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'runs pygmentize on each file passed in' about 'runs pygmentize on each file passed in'
param '*: files to concatenate (as normally passed to cat)' param '*: files to concatenate (as normally passed to cat)'
example 'ccat mysite/manage.py dir/text-file.txt' example 'ccat mysite/manage.py dir/text-file.txt'
pygmentize -f 256 -O style="${BASH_IT_CCAT_STYLE:-default}" -g "$@" pygmentize -f 256 -O style="${BASH_IT_CCAT_STYLE:-default}" -g "${@}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function cless() {
function cless()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'pigments the files passed in and passes to less for pagination' about 'pigments the files passed in and passes to less for pagination'
param '*: the files to paginate with less' param '*: the files to paginate with less'
example 'cless mysite/manage.py' example 'cless mysite/manage.py'
pygmentize -f 256 -O style="${BASH_IT_CLESS_STYLE:-default}" -g "$@" | command less -R pygmentize -f 256 -O style="${BASH_IT_CLESS_STYLE:-default}" -g "${@}" | command less -R
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -4,7 +4,12 @@ about-plugin 'manage your nginx service'
pathmunge "${NGINX_PATH:=/opt/nginx}/sbin" after pathmunge "${NGINX_PATH:=/opt/nginx}/sbin" after
export NGINX_PATH export NGINX_PATH
function nginx_reload() { function nginx_reload()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'reload your nginx config' about 'reload your nginx config'
group 'nginx' group 'nginx'
@ -18,9 +23,18 @@ function nginx_reload() {
echo "Nginx pid file not found" echo "Nginx pid file not found"
return 0 return 0
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function nginx_stop() {
function nginx_stop()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'stop nginx' about 'stop nginx'
group 'nginx' group 'nginx'
@ -34,9 +48,18 @@ function nginx_stop() {
echo "Nginx pid file not found" echo "Nginx pid file not found"
return 0 return 0
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function nginx_start() {
function nginx_start()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'start nginx' about 'start nginx'
group 'nginx' group 'nginx'
@ -48,11 +71,24 @@ function nginx_start() {
else else
echo "Couldn't start nginx" echo "Couldn't start nginx"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function nginx_restart() {
function nginx_restart()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'restart nginx' about 'restart nginx'
group 'nginx' group 'nginx'
nginx_stop && nginx_start nginx_stop && nginx_start
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -19,13 +19,22 @@ fi
if ! _command_exists nvm if ! _command_exists nvm
then then
function nvm() { function nvm()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
echo "Bash-it no longer bundles the nvm script. Please install the latest version from" echo "Bash-it no longer bundles the nvm script. Please install the latest version from"
echo "" echo ""
echo "https://github.com/creationix/nvm.git" echo "https://github.com/creationix/nvm.git"
echo "" echo ""
echo "if you want to use nvm. You can keep this plugin enabled once you have installed nvm." echo "if you want to use nvm. You can keep this plugin enabled once you have installed nvm."
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
nvm nvm
fi fi

View File

@ -7,14 +7,28 @@ if [[ "${OSTYPE}" != 'darwin'* ]]
return 1 return 1
fi fi
function time-machine-destination() { function time-machine-destination()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
group "osx-timemachine" group "osx-timemachine"
about "Shows the OS X Time Machine destination/mount point" about "Shows the OS X Time Machine destination/mount point"
tmutil destinationinfo | grep "Mount Point" | sed -e 's/Mount Point : \(.*\)/\1/g' tmutil destinationinfo | grep "Mount Point" | sed -e 's/Mount Point : \(.*\)/\1/g'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function time-machine-list-machines() {
function time-machine-list-machines()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
group "osx-timemachine" group "osx-timemachine"
about "Lists the OS X Time Machine machines on the backup volume" about "Lists the OS X Time Machine machines on the backup volume"
@ -24,9 +38,18 @@ function time-machine-list-machines() {
find "$tmdest" -maxdepth 1 -mindepth 1 -type d | grep -v "/\." | while read -r line; do find "$tmdest" -maxdepth 1 -mindepth 1 -type d | grep -v "/\." | while read -r line; do
echo "${line##*/}" echo "${line##*/}"
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function time-machine-list-all-backups() {
function time-machine-list-all-backups()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
group "osx-timemachine" group "osx-timemachine"
about "Shows all of the backups for the specified machine" about "Shows all of the backups for the specified machine"
param "1: Machine name (optional)" param "1: Machine name (optional)"
@ -40,9 +63,18 @@ function time-machine-list-all-backups() {
find "$BACKUP_LOCATION" -maxdepth 1 -mindepth 1 -type d | while read -r line; do find "$BACKUP_LOCATION" -maxdepth 1 -mindepth 1 -type d | while read -r line; do
echo "$line" echo "$line"
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function time-machine-list-old-backups() {
function time-machine-list-old-backups()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
group "osx-timemachine" group "osx-timemachine"
about "Shows all of the backups for the specified machine, except for the most recent backup" about "Shows all of the backups for the specified machine, except for the most recent backup"
param "1: Machine name (optional)" param "1: Machine name (optional)"
@ -57,10 +89,19 @@ function time-machine-list-old-backups() {
find "$BACKUP_LOCATION" -maxdepth 1 -mindepth 1 -type d -name 2\* | sed \$d | while read -r line; do find "$BACKUP_LOCATION" -maxdepth 1 -mindepth 1 -type d -name 2\* | sed \$d | while read -r line; do
echo "$line" echo "$line"
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Taken from here: http://stackoverflow.com/a/30547074/1228454 # Taken from here: http://stackoverflow.com/a/30547074/1228454
function _tm_startsudo() { function _tm_startsudo()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local -x SUDO_COMMAND="plugin/osx-timemachine: keep 'sudo' token alive during long-run 'tmutil' commands" local -x SUDO_COMMAND="plugin/osx-timemachine: keep 'sudo' token alive during long-run 'tmutil' commands"
sudo "-${SUDO_ASKPASS:+A}v" # validate without running a command, using `ssh-askpass` if available. sudo "-${SUDO_ASKPASS:+A}v" # validate without running a command, using `ssh-askpass` if available.
(while sudo "-${SUDO_ASKPASS:+A}v"; do (while sudo "-${SUDO_ASKPASS:+A}v"; do
@ -68,14 +109,32 @@ function _tm_startsudo() {
done) & done) &
SUDO_PID="$!" SUDO_PID="$!"
trap _tm_stopsudo SIGINT SIGTERM trap _tm_stopsudo SIGINT SIGTERM
} ############### Stack_TRACE_BUILDER ################
function _tm_stopsudo() { Function_PATH="$( dirname ${Function_PATH} )"
kill "$SUDO_PID" ####################################################
trap - SIGINT SIGTERM
sudo -k
} }
function time-machine-delete-old-backups() { function _tm_stopsudo()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
kill "${SUDO_PID}"
trap - SIGINT SIGTERM
sudo -k
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function time-machine-delete-old-backups()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
group "osx-timemachine" group "osx-timemachine"
about "Deletes all of the backups for the specified machine, with the exception of the most recent one" about "Deletes all of the backups for the specified machine, with the exception of the most recent one"
param "1: Machine name (optional)" param "1: Machine name (optional)"
@ -93,4 +152,8 @@ function time-machine-delete-old-backups() {
done <<< "$(time-machine-list-old-backups "$COMPUTERNAME")" done <<< "$(time-machine-list-old-backups "$COMPUTERNAME")"
_tm_stopsudo _tm_stopsudo
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -13,7 +13,12 @@ if _is_function update_terminal_cwd
safe_append_prompt_command 'update_terminal_cwd' safe_append_prompt_command 'update_terminal_cwd'
fi fi
function tab() { function tab()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'opens a new terminal tab' about 'opens a new terminal tab'
group 'osx' group 'osx'
@ -26,53 +31,115 @@ function tab() {
do script with command " cd \"$PWD\"; $*" in window 0 do script with command " cd \"$PWD\"; $*" in window 0
end tell end tell
EOF EOF
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# renames the current os x terminal tab title # renames the current os x terminal tab title
function tabname { function tabname()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
printf '%b' "\e]1;$1\a" printf '%b' "\e]1;$1\a"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# renames the current os x terminal window title # renames the current os x terminal window title
function winname { function winname()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
printf '%b' "\e]2;$1\a" printf '%b' "\e]2;$1\a"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function pman() {
function pman()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'view man documentation in Preview' about 'view man documentation in Preview'
param '1: man page to view' param '1: man page to view'
example '$ pman bash' example '$ pman bash'
group 'osx' group 'osx'
man -t "${1}" | open -fa 'Preview' man -t "${1}" | open -fa 'Preview'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function pri() { function pri()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'display information about Ruby classes, modules, or methods, in Preview' about 'display information about Ruby classes, modules, or methods, in Preview'
param '1: Ruby method, module, or class' param '1: Ruby method, module, or class'
example '$ pri Array' example '$ pri Array'
group 'osx' group 'osx'
ri -T "${1}" | open -fa 'Preview' ri -T "${1}" | open -fa 'Preview'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Download a file and open it in Preview # Download a file and open it in Preview
function prevcurl() { function prevcurl()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'download a file and open it in Preview' about 'download a file and open it in Preview'
param '1: url' param '1: url'
group 'osx' group 'osx'
curl "$*" | open -fa 'Preview' curl "$*" | open -fa 'Preview'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function refresh-launchpad() {
function refresh-launchpad()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Reset launchpad layout in macOS' about 'Reset launchpad layout in macOS'
example '$ refresh-launchpad' example '$ refresh-launchpad'
group 'osx' group 'osx'
defaults write com.apple.dock ResetLaunchPad -bool TRUE defaults write com.apple.dock ResetLaunchPad -bool TRUE
killall Dock killall Dock
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function list-jvms() {
function list-jvms()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'List java virtual machines and their states in macOS' about 'List java virtual machines and their states in macOS'
example 'list-jvms' example 'list-jvms'
group 'osx' group 'osx'
@ -92,9 +159,18 @@ function list-jvms() {
fi fi
printf '%s\t%s\t%s\n' "${i}" "${JVMS[i]##*/}" "${JVMS_STATES[i]}" printf '%s\t%s\t%s\n' "${i}" "${JVMS[i]##*/}" "${JVMS_STATES[i]}"
done done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function pick-default-jvm() {
function pick-default-jvm()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Pick the default Java Virtual Machines in system-wide scope in macOS' about 'Pick the default Java Virtual Machines in system-wide scope in macOS'
example 'pick-default-jvm' example 'pick-default-jvm'
@ -136,4 +212,8 @@ function pick-default-jvm() {
sudo mv -vn "${DEFAULT_JVM_DIR}/Contents/Info.plist.disable" "${DEFAULT_JVM_DIR}/Contents/Info.plist" \ sudo mv -vn "${DEFAULT_JVM_DIR}/Contents/Info.plist.disable" "${DEFAULT_JVM_DIR}/Contents/Info.plist" \
&& echo "Enabled ${DEFAULT_JVM} as default JVM" && echo "Enabled ${DEFAULT_JVM} as default JVM"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -4,45 +4,85 @@ cite about-plugin
about-plugin 'CNB pack cli aliases' about-plugin 'CNB pack cli aliases'
__pack_debug() function __pack_debug()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if [[ -n ${BASH_COMP_DEBUG_FILE} ]] if [[ -n ${BASH_COMP_DEBUG_FILE} ]]
then then
echo "$*" >> "${BASH_COMP_DEBUG_FILE}" echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# Homebrew on Macs have version 1.3 of bash-completion which doesn't include # Homebrew on Macs have version 1.3 of bash-completion which doesn't include
# _init_completion. This is a very minimal version of that function. # _init_completion. This is a very minimal version of that function.
__pack_init_completion() function __pack_init_completion()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
COMPREPLY=() COMPREPLY=()
_get_comp_words_by_ref "$@" cur prev words cword _get_comp_words_by_ref "${@}" cur prev words cword
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
__pack_index_of_word()
function __pack_index_of_word()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local w word=$1 local w word=$1
shift shift
index=0 index=0
for w in "$@"; do for w in "${@}"; do
[[ $w = "$word" ]] && return [[ $w = "$word" ]] && return
index=$((index+1)) index=$((index+1))
done done
index=-1 index=-1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
__pack_contains_word()
function __pack_contains_word()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local w word=$1; shift local w word=$1; shift
for w in "$@"; do for w in "${@}"; do
[[ $w = "$word" ]] && return [[ $w = "$word" ]] && return
done done
return 1 return 1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
__pack_handle_reply()
function __pack_handle_reply()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
__pack_debug "${FUNCNAME[0]}" __pack_debug "${FUNCNAME[0]}"
case $cur in case $cur in
-*) -*)
@ -140,23 +180,50 @@ __pack_handle_reply()
then then
compopt -o nospace compopt -o nospace
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
# The arguments should be in the form "ext1|ext2|extn" # The arguments should be in the form "ext1|ext2|extn"
__pack_handle_filename_extension_flag() function __pack_handle_filename_extension_flag()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local ext="${1}" local ext="${1}"
_filedir "@(${ext})" _filedir "@(${ext})"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
__pack_handle_subdirs_in_dir_flag()
function __pack_handle_subdirs_in_dir_flag()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local dir="${1}" local dir="${1}"
pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
__pack_handle_flag()
function __pack_handle_flag()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
__pack_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" __pack_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
# if a command required a flag, and we found it, unset must_have_one_flag() # if a command required a flag, and we found it, unset must_have_one_flag()
@ -209,10 +276,19 @@ __pack_handle_flag()
c=$((c+1)) c=$((c+1))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
__pack_handle_noun()
function __pack_handle_noun()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
__pack_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" __pack_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
if __pack_contains_word "${words[c]}" "${must_have_one_noun[@]}" if __pack_contains_word "${words[c]}" "${must_have_one_noun[@]}"
@ -225,10 +301,19 @@ __pack_handle_noun()
nouns+=("${words[c]}") nouns+=("${words[c]}")
c=$((c+1)) c=$((c+1))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
__pack_handle_command()
function __pack_handle_command()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
__pack_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" __pack_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
local next_command local next_command
@ -246,10 +331,19 @@ __pack_handle_command()
c=$((c+1)) c=$((c+1))
__pack_debug "${FUNCNAME[0]}: looking for ${next_command}" __pack_debug "${FUNCNAME[0]}: looking for ${next_command}"
declare -F "$next_command" >/dev/null && $next_command declare -F "$next_command" >/dev/null && $next_command
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
__pack_handle_word()
function __pack_handle_word()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if [[ $c -ge $cword ]] if [[ $c -ge $cword ]]
then then
__pack_handle_reply __pack_handle_reply
@ -279,10 +373,19 @@ __pack_handle_word()
__pack_handle_noun __pack_handle_noun
fi fi
__pack_handle_word __pack_handle_word
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_pack_build()
function _pack_build()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
last_command="pack_build" last_command="pack_build"
command_aliases=() command_aliases=()
@ -326,10 +429,19 @@ _pack_build()
must_have_one_flag=() must_have_one_flag=()
must_have_one_noun=() must_have_one_noun=()
noun_aliases=() noun_aliases=()
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_pack_run()
function _pack_run()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
last_command="pack_run" last_command="pack_run"
command_aliases=() command_aliases=()
@ -373,10 +485,19 @@ _pack_run()
must_have_one_flag=() must_have_one_flag=()
must_have_one_noun=() must_have_one_noun=()
noun_aliases=() noun_aliases=()
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_pack_rebase()
function _pack_rebase()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
last_command="pack_rebase" last_command="pack_rebase"
command_aliases=() command_aliases=()
@ -406,10 +527,19 @@ _pack_rebase()
must_have_one_flag=() must_have_one_flag=()
must_have_one_noun=() must_have_one_noun=()
noun_aliases=() noun_aliases=()
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_pack_create-builder()
function _pack_create-builder()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
last_command="pack_create-builder" last_command="pack_create-builder"
command_aliases=() command_aliases=()
@ -442,10 +572,19 @@ _pack_create-builder()
must_have_one_flag+=("-b") must_have_one_flag+=("-b")
must_have_one_noun=() must_have_one_noun=()
noun_aliases=() noun_aliases=()
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_pack_set-run-image-mirrors()
function _pack_set-run-image-mirrors()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
last_command="pack_set-run-image-mirrors" last_command="pack_set-run-image-mirrors"
command_aliases=() command_aliases=()
@ -474,10 +613,19 @@ _pack_set-run-image-mirrors()
must_have_one_flag+=("-m") must_have_one_flag+=("-m")
must_have_one_noun=() must_have_one_noun=()
noun_aliases=() noun_aliases=()
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_pack_inspect-builder()
function _pack_inspect-builder()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
last_command="pack_inspect-builder" last_command="pack_inspect-builder"
command_aliases=() command_aliases=()
@ -501,10 +649,19 @@ _pack_inspect-builder()
must_have_one_flag=() must_have_one_flag=()
must_have_one_noun=() must_have_one_noun=()
noun_aliases=() noun_aliases=()
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_pack_set-default-builder()
function _pack_set-default-builder()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
last_command="pack_set-default-builder" last_command="pack_set-default-builder"
command_aliases=() command_aliases=()
@ -528,10 +685,19 @@ _pack_set-default-builder()
must_have_one_flag=() must_have_one_flag=()
must_have_one_noun=() must_have_one_noun=()
noun_aliases=() noun_aliases=()
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_pack_version()
function _pack_version()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
last_command="pack_version" last_command="pack_version"
command_aliases=() command_aliases=()
@ -555,10 +721,19 @@ _pack_version()
must_have_one_flag=() must_have_one_flag=()
must_have_one_noun=() must_have_one_noun=()
noun_aliases=() noun_aliases=()
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_pack_completion()
function _pack_completion()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
last_command="pack_completion" last_command="pack_completion"
command_aliases=() command_aliases=()
@ -582,10 +757,19 @@ _pack_completion()
must_have_one_flag=() must_have_one_flag=()
must_have_one_noun=() must_have_one_noun=()
noun_aliases=() noun_aliases=()
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
_pack_root_command()
function _pack_root_command()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
last_command="pack" last_command="pack"
command_aliases=() command_aliases=()
@ -618,10 +802,19 @@ _pack_root_command()
must_have_one_flag=() must_have_one_flag=()
must_have_one_noun=() must_have_one_noun=()
noun_aliases=() noun_aliases=()
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
__start_pack()
function __start_pack()
{ {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local cur prev words cword local cur prev words cword
declare -A flaghash 2>/dev/null || : declare -A flaghash 2>/dev/null || :
declare -A aliashash 2>/dev/null || : declare -A aliashash 2>/dev/null || :
@ -645,8 +838,13 @@ __start_pack()
local nouns=() local nouns=()
__pack_handle_word __pack_handle_word
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
if [[ $(type -t compopt) = "builtin" ]] if [[ $(type -t compopt) = "builtin" ]]
then then
complete -o default -F __start_pack pack complete -o default -F __start_pack pack

View File

@ -22,12 +22,20 @@ if [[ ${BASH_VERSINFO[0]} -lt 4 ]]
return return
fi fi
function _replace_by_history() { function _replace_by_history()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local HISTTIMEFORMAT= # Ensure we can parse history properly local HISTTIMEFORMAT= # Ensure we can parse history properly
#TODO: "${histlines[@]/*( )+([[:digit:]])*( )/}" #TODO: "${histlines[@]/*( )+([[:digit:]])*( )/}"
local l local l
l="$(history | tail -r | sed -e 's/^\ *[0-9]*\ *//' | percol --query "${READLINE_LINE:-}")" l="$(history | tail -r | sed -e 's/^\ *[0-9]*\ *//' | percol --query "${READLINE_LINE:-}")"
READLINE_LINE="${l}" READLINE_LINE="${l}"
READLINE_POINT=${#l} READLINE_POINT=${#l}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
bind -x '"\C-r": _replace_by_history' bind -x '"\C-r": _replace_by_history'

View File

@ -20,23 +20,46 @@ done
function postgres_start { function postgres_start()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Starts PostgreSQL server' about 'Starts PostgreSQL server'
group 'postgres' group 'postgres'
echo 'Starting Postgres....'; echo 'Starting Postgres....';
$POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile start ${POSTGRES_BIN}/pg_ctl -D $PGDATA -l $PGDATA/logfile start
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function postgres_stop { function postgres_stop()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Stops PostgreSQL server' about 'Stops PostgreSQL server'
group 'postgres' group 'postgres'
echo 'Stopping Postgres....'; echo 'Stopping Postgres....';
$POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile stop -s -m fast ${POSTGRES_BIN}/pg_ctl -D $PGDATA -l $PGDATA/logfile stop -s -m fast
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function postgres_status { function postgres_status()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Returns status of PostgreSQL server' about 'Returns status of PostgreSQL server'
group 'postgres' group 'postgres'
@ -47,34 +70,74 @@ function postgres_status {
else else
echo "Postgres service [RUNNING]" echo "Postgres service [RUNNING]"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function is_postgres_running { function is_postgres_running
$POSTGRES_BIN/pg_ctl -D $PGDATA status | grep -F -o "no server running" {
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
${POSTGRES_BIN}/pg_ctl -D ${PGDATA} status | grep -F -o "no server running"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function postgres_restart { function postgres_restart
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Restarts status of PostgreSQL server' about 'Restarts status of PostgreSQL server'
group 'postgres' group 'postgres'
echo 'Restarting Postgres....'; echo 'Restarting Postgres....';
$POSTGRES_BIN/pg_ctl -D $PGDATA restart $POSTGRES_BIN/pg_ctl -D ${PGDATA} restart
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function postgres_logfile { function postgres_logfile
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'View the last 500 lines from logfile' about 'View the last 500 lines from logfile'
group 'postgres' group 'postgres'
tail -500 $PGDATA/logfile | less tail -500 ${PGDATA}/logfile | less
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function postgres_serverlog { function postgres_serverlog
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'View the last 500 lines from server.log' about 'View the last 500 lines from server.log'
group 'postgres' group 'postgres'
tail -500 $PGDATA/server.log | less tail -500 ${PGDATA}/server.log | less
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -3,7 +3,12 @@ about-plugin 'quickly navigate configured project paths'
: "${BASH_IT_PROJECT_PATHS:=$HOME/Projects:$HOME/src:$HOME/work}" : "${BASH_IT_PROJECT_PATHS:=$HOME/Projects:$HOME/src:$HOME/work}"
function pj() { function pj()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'navigate quickly to your various project directories' about 'navigate quickly to your various project directories'
group 'projects' group 'projects'
@ -54,6 +59,9 @@ function pj() {
esac esac
"${cmd:-cd}" "${dest}" "${cmd:-cd}" "${dest}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
alias pjo="pj open" alias pjo="pj open"

View File

@ -1,7 +1,12 @@
# shellcheck shell=bash # shellcheck shell=bash
about-plugin 'Proxy Tools' about-plugin 'Proxy Tools'
function disable-proxy() { function disable-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Disables proxy settings for Bash, npm and SSH' about 'Disables proxy settings for Bash, npm and SSH'
group 'proxy' group 'proxy'
@ -17,9 +22,17 @@ function disable-proxy() {
npm-disable-proxy npm-disable-proxy
ssh-disable-proxy ssh-disable-proxy
svn-disable-proxy svn-disable-proxy
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function enable-proxy() { function enable-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Enables proxy settings for Bash, npm and SSH' about 'Enables proxy settings for Bash, npm and SSH'
group 'proxy' group 'proxy'
@ -35,9 +48,17 @@ function enable-proxy() {
npm-enable-proxy npm-enable-proxy
ssh-enable-proxy ssh-enable-proxy
svn-enable-proxy svn-enable-proxy
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function enable-proxy-alt() { function enable-proxy-alt()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Enables alternate proxy settings for Bash, npm and SSH' about 'Enables alternate proxy settings for Bash, npm and SSH'
group 'proxy' group 'proxy'
@ -53,9 +74,17 @@ function enable-proxy-alt() {
npm-enable-proxy "${http_proxy:-}" "${https_proxy:-}" npm-enable-proxy "${http_proxy:-}" "${https_proxy:-}"
ssh-enable-proxy ssh-enable-proxy
svn-enable-proxy "${http_proxy:-}" svn-enable-proxy "${http_proxy:-}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function show-proxy() { function show-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Shows the proxy settings for Bash, Git, npm and SSH' about 'Shows the proxy settings for Bash, Git, npm and SSH'
group 'proxy' group 'proxy'
@ -69,9 +98,17 @@ function show-proxy() {
git-global-show-proxy git-global-show-proxy
svn-show-proxy svn-show-proxy
ssh-show-proxy ssh-show-proxy
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function proxy-help() { function proxy-help()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Provides an overview of the bash-it proxy configuration' about 'Provides an overview of the bash-it proxy configuration'
group 'proxy' group 'proxy'
@ -90,9 +127,17 @@ Run 'glossary proxy' to show the available proxy functions with a short descript
EOF EOF
bash-it-show-proxy bash-it-show-proxy
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function bash-it-show-proxy() { function bash-it-show-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Shows the bash-it proxy settings' about 'Shows the bash-it proxy settings'
group 'proxy' group 'proxy'
@ -102,9 +147,17 @@ function bash-it-show-proxy() {
echo "(These variables will be used to set the proxy when you call 'enable-proxy')" echo "(These variables will be used to set the proxy when you call 'enable-proxy')"
echo "" echo ""
env | grep -e "BASH_IT.*PROXY" env | grep -e "BASH_IT.*PROXY"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function npm-show-proxy() { function npm-show-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Shows the npm proxy settings' about 'Shows the npm proxy settings'
group 'proxy' group 'proxy'
@ -117,9 +170,17 @@ function npm-show-proxy() {
echo "npm HTTPS proxy: $(npm config get https-proxy)" echo "npm HTTPS proxy: $(npm config get https-proxy)"
echo "npm proxy exceptions: $(npm config get noproxy)" echo "npm proxy exceptions: $(npm config get noproxy)"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function npm-disable-proxy() { function npm-disable-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Disables npm proxy settings' about 'Disables npm proxy settings'
group 'proxy' group 'proxy'
@ -130,9 +191,17 @@ function npm-disable-proxy() {
npm config delete noproxy npm config delete noproxy
echo "Disabled npm proxy settings" echo "Disabled npm proxy settings"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function npm-enable-proxy() { function npm-enable-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Enables npm proxy settings' about 'Enables npm proxy settings'
group 'proxy' group 'proxy'
@ -147,9 +216,17 @@ function npm-enable-proxy() {
npm config set noproxy "${my_no_proxy:-}" || return npm config set noproxy "${my_no_proxy:-}" || return
echo "Enabled npm proxy settings" echo "Enabled npm proxy settings"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git-global-show-proxy() { function git-global-show-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Shows global Git proxy settings' about 'Shows global Git proxy settings'
group 'proxy' group 'proxy'
@ -161,9 +238,17 @@ function git-global-show-proxy() {
echo "Git (Global) HTTP proxy: $(git config --global --get http.proxy)" echo "Git (Global) HTTP proxy: $(git config --global --get http.proxy)"
echo "Git (Global) HTTPS proxy: $(git config --global --get https.proxy)" echo "Git (Global) HTTPS proxy: $(git config --global --get https.proxy)"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git-global-disable-proxy() { function git-global-disable-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Disables global Git proxy settings' about 'Disables global Git proxy settings'
group 'proxy' group 'proxy'
@ -173,9 +258,17 @@ function git-global-disable-proxy() {
git config --global --unset-all https.proxy git config --global --unset-all https.proxy
echo "Disabled global Git proxy settings" echo "Disabled global Git proxy settings"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git-global-enable-proxy() { function git-global-enable-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Enables global Git proxy settings' about 'Enables global Git proxy settings'
group 'proxy' group 'proxy'
@ -187,9 +280,17 @@ function git-global-enable-proxy() {
git config --global --add https.proxy "${BASH_IT_HTTPS_PROXY:?}" git config --global --add https.proxy "${BASH_IT_HTTPS_PROXY:?}"
echo "Enabled global Git proxy settings" echo "Enabled global Git proxy settings"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git-show-proxy() { function git-show-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Shows current Git project proxy settings' about 'Shows current Git project proxy settings'
group 'proxy' group 'proxy'
@ -200,9 +301,17 @@ function git-show-proxy() {
echo "Git HTTP proxy: $(git config --get http.proxy)" echo "Git HTTP proxy: $(git config --get http.proxy)"
echo "Git HTTPS proxy: $(git config --get https.proxy)" echo "Git HTTPS proxy: $(git config --get https.proxy)"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git-disable-proxy() { function git-disable-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Disables current Git project proxy settings' about 'Disables current Git project proxy settings'
group 'proxy' group 'proxy'
@ -212,9 +321,17 @@ function git-disable-proxy() {
git config --unset-all https.proxy git config --unset-all https.proxy
echo "Disabled Git project proxy settings" echo "Disabled Git project proxy settings"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function git-enable-proxy() { function git-enable-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Enables current Git project proxy settings' about 'Enables current Git project proxy settings'
group 'proxy' group 'proxy'
@ -226,9 +343,17 @@ function git-enable-proxy() {
git config --add https.proxy "${BASH_IT_HTTPS_PROXY:?}" git config --add https.proxy "${BASH_IT_HTTPS_PROXY:?}"
echo "Enabled Git project proxy settings" echo "Enabled Git project proxy settings"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function svn-show-proxy() { function svn-show-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Shows SVN proxy settings' about 'Shows SVN proxy settings'
group 'proxy' group 'proxy'
@ -256,9 +381,17 @@ if (config.has_section('global')):
print 'http-proxy-exceptions: ' + proxy_exceptions print 'http-proxy-exceptions: ' + proxy_exceptions
END END
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function svn-disable-proxy() { function svn-disable-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Disables SVN proxy settings' about 'Disables SVN proxy settings'
group 'proxy' group 'proxy'
@ -285,9 +418,17 @@ if config.has_section('global'):
print 'Disabled SVN proxy settings' print 'Disabled SVN proxy settings'
END END
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function svn-enable-proxy() { function svn-enable-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Enables SVN proxy settings' about 'Enables SVN proxy settings'
group 'proxy' group 'proxy'
@ -322,9 +463,17 @@ with open(os.path.expanduser('~/.subversion/servers'), 'wb') as configfile:
print 'Enabled SVN proxy settings' print 'Enabled SVN proxy settings'
END END
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function ssh-show-proxy() { function ssh-show-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Shows SSH config proxy settings (from ~/.ssh/config)' about 'Shows SSH config proxy settings (from ~/.ssh/config)'
group 'proxy' group 'proxy'
@ -359,9 +508,17 @@ function ssh-show-proxy() {
} }
' ~/.ssh/config | column -t ' ~/.ssh/config | column -t
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function ssh-disable-proxy() { function ssh-disable-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Disables SSH config proxy settings' about 'Disables SSH config proxy settings'
group 'proxy' group 'proxy'
@ -370,9 +527,17 @@ function ssh-disable-proxy() {
sed -e's/^.*ProxyCommand/# ProxyCommand/' "${BASH_IT_SED_I_PARAMETERS[@]}" ~/.ssh/config sed -e's/^.*ProxyCommand/# ProxyCommand/' "${BASH_IT_SED_I_PARAMETERS[@]}" ~/.ssh/config
echo "Disabled SSH config proxy settings" echo "Disabled SSH config proxy settings"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }
function ssh-enable-proxy() { function ssh-enable-proxy()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Enables SSH config proxy settings' about 'Enables SSH config proxy settings'
group 'proxy' group 'proxy'
@ -381,4 +546,7 @@ function ssh-enable-proxy() {
sed -e's/# ProxyCommand/ ProxyCommand/' "${BASH_IT_SED_I_PARAMETERS[@]}" ~/.ssh/config sed -e's/# ProxyCommand/ ProxyCommand/' "${BASH_IT_SED_I_PARAMETERS[@]}" ~/.ssh/config
echo "Enabled SSH config proxy settings" echo "Enabled SSH config proxy settings"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -12,7 +12,12 @@ else
return 1 return 1
fi fi
function pyedit() { function pyedit()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'opens python module in your EDITOR' about 'opens python module in your EDITOR'
param '1: python module to open' param '1: python module to open'
example '$ pyedit requests' example '$ pyedit requests'
@ -33,4 +38,7 @@ function pyedit() {
echo "$EDITOR ${xpyc%.*}.py" echo "$EDITOR ${xpyc%.*}.py"
${VISUAL:-${EDITOR:-${ALTERNATE_EDITOR:-nano}}} "${xpyc%.*}.py" ${VISUAL:-${EDITOR:-${ALTERNATE_EDITOR:-nano}}} "${xpyc%.*}.py"
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

View File

@ -2,7 +2,12 @@ cite about-plugin
about-plugin 'Helper functions for Ruby on Rails' about-plugin 'Helper functions for Ruby on Rails'
# Quick function to kill a daemonized Rails server # Quick function to kill a daemonized Rails server
function killrails() { function killrails()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'Searches for a daemonized Rails server in tmp/pids and attempts to kill it.' about 'Searches for a daemonized Rails server in tmp/pids and attempts to kill it.'
group 'rails' group 'rails'
@ -16,4 +21,7 @@ function killrails() {
echo "[FAIL] Error killing Rails server" echo "[FAIL] Error killing Rails server"
return 1 return 1
fi fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
} }

Some files were not shown because too many files have changed in this diff Show More