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
# -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'
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
_set_pkg_aliases

View File

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

View File

@ -83,7 +83,7 @@ function catt()
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
for i in "$@"; do
for i in "${@}"; do
if [[ -d "$i" ]]
then
ls "$i"
@ -91,6 +91,10 @@ function catt()
cat "$i"
fi
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

View File

@ -207,7 +207,11 @@ function gdv()
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()
@ -223,4 +227,8 @@ function get_default_branch()
else
echo master
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
# 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 gvim && function gvimt { command gvim --remote-tab-silent "$@" || command gvim "$@"; }
_command_exists mvim && function mvimt { command mvim --remote-tab-silent "${@}" || command mvim "${@}"; }
_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)
# shellcheck source=/dev/null
source "$tmp_file" && command rm -f "$tmp_file"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
_bash-it-component-completion-callback-on-init-aliases

View File

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

View File

@ -27,7 +27,12 @@
# To use, source this file on bash:
# . 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 cur prev
_get_comp_words_by_ref -n : cur prev
@ -191,9 +196,18 @@ function __bundle() {
esac
fi
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
for ((i=1; i < $COMP_CWORD; ++i)); do
local arg=${COMP_WORDS[$i]}
@ -213,13 +227,22 @@ function __bundle_get_command() {
return;;
esac
done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Provides completion for Bundler group names.
#
# 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.
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
local cur_group=${cur##*[ :]}
# All groups written before
@ -239,13 +262,22 @@ function __bundle_complete_groups() {
# Prepend prefix to all entries
COMPREPLY=("${COMPREPLY[@]/#/$prefix}")
__ltrim_colon_completions "$cur"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# __bundle_exec_ruby <script> [args...]
#
# Runs a Ruby script with Bundler loaded.
# 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})
# 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
@ -264,7 +296,7 @@ function __bundle_exec_ruby() {
then
tail -n +2 -- "$cachefile"
else
local output=$("${bundle_bin[@]}" exec ruby -e "$@" 2>/dev/null)
local output=$("${bundle_bin[@]}" exec ruby -e "${@}" 2>/dev/null)
if [[ $? -eq 0 ]]
then
(mkdir -p -- "$cachedir" &&
@ -272,6 +304,10 @@ function __bundle_exec_ruby() {
echo "$output"
fi
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}

View File

@ -3,7 +3,12 @@
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 ]
then
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]}))
return 0
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -o default -o nospace -F _capcomplete cap

View File

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

View File

@ -1,6 +1,11 @@
# 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
local prev=$(_get_pword)
# 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"))
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F __dart_completion dart

View File

@ -1,7 +1,12 @@
#!/usr/bin/env bash
# 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]}"
# parse all defined shortcuts from ~/.dirs
@ -11,6 +16,10 @@ function _dirs-complete() {
fi
return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -o default -o nospace -F _dirs-complete G R

View File

@ -1,6 +1,11 @@
# 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
local prev=$(_get_pword)
# 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"))
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F __dmidecode_completion dmidecode

View File

@ -34,28 +34,56 @@
__docker_compose_previous_extglob_setting=$(shopt -p extglob)
shopt -s extglob
function __docker_compose_q() {
docker-compose 2>/dev/null "${top_level_options[@]}" "$@"
function __docker_compose_q()
{
############ 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
# 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 IFS='|'
echo "${parts[*]}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Transforms a multiline list of options into an extglob pattern
# 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}" )
echo "@($extglob)"
}
# Determines whether the option passed as the first argument exist on
# 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}"
for (( i=2; i < $cword; ++i)); do
if [[ ${words[$i]} =~ ^($pattern)$ ]]
@ -64,12 +92,21 @@ function __docker_compose_has_option() {
fi
done
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`)
# which matches the extglob passed in as an argument.
# 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 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) ]] && echo "$key"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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
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.
# Arguments for `docker-compose ps` may be passed in order to filter the service list,
# e.g. `status=running`.
function __docker_compose_services() {
__docker_compose_q ps --services "$@"
function __docker_compose_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`.
# Arguments for `docker-compose ps` may be passed in order to filter the service list,
# see `__docker_compose_services`.
function __docker_compose_complete_services() {
COMPREPLY=( $(compgen -W "$(__docker_compose_services "$@")" -- "$cur") )
function __docker_compose_complete_services()
{
############ 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
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)
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
--build-arg)
COMPREPLY=( $( compgen -e -- "$cur" ) )
@ -142,10 +224,19 @@ function _docker_compose_build() {
__docker_compose_complete_services --filter source=build
;;
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
--output|-o)
_filedir
@ -154,10 +245,19 @@ function _docker_compose_bundle() {
esac
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
--hash)
if [[ $cur == \\* ]]
@ -171,10 +271,19 @@ function _docker_compose_config() {
esac
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
-*)
COMPREPLY=( $( compgen -W "--build --force-recreate --help --no-build --no-recreate" -- "$cur" ) )
@ -183,10 +292,19 @@ function _docker_compose_create() {
__docker_compose_complete_services
;;
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
--tlscacert|--tlscert|--tlskey)
_filedir
@ -217,10 +335,19 @@ function _docker_compose_docker_compose() {
COMPREPLY=( $( compgen -W "${commands[*]}" -- "$cur" ) )
;;
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
--rmi)
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" ) )
;;
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
--json)
return
@ -254,10 +390,19 @@ function _docker_compose_events() {
__docker_compose_complete_services
;;
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
--index|--user|-u|--workdir|-w)
return
@ -272,14 +417,32 @@ function _docker_compose_exec() {
__docker_compose_complete_running_services
;;
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" ) )
############### 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
-*)
COMPREPLY=( $( compgen -W "--help --quiet -q" -- "$cur" ) )
@ -288,9 +451,18 @@ function _docker_compose_images() {
__docker_compose_complete_services
;;
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
-s)
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
;;
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
--tail)
return
@ -324,10 +505,19 @@ function _docker_compose_logs() {
__docker_compose_complete_services
;;
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
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
@ -336,10 +526,19 @@ function _docker_compose_pause() {
__docker_compose_complete_running_services
;;
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
--protocol)
COMPREPLY=( $( compgen -W "tcp udp" -- "$cur" ) )
@ -358,10 +557,19 @@ function _docker_compose_port() {
__docker_compose_complete_services
;;
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')
case "$key" in
source)
@ -390,10 +598,19 @@ function _docker_compose_ps() {
__docker_compose_complete_services
;;
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
-*)
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
;;
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
-*)
COMPREPLY=( $( compgen -W "--help --ignore-push-failures" -- "$cur" ) )
@ -414,10 +640,19 @@ function _docker_compose_push() {
__docker_compose_complete_services
;;
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
--timeout|-t)
return
@ -432,10 +667,19 @@ function _docker_compose_restart() {
__docker_compose_complete_running_services
;;
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
-*)
COMPREPLY=( $( compgen -W "--force -f --help --stop -s -v" -- "$cur" ) )
@ -449,10 +693,19 @@ function _docker_compose_rm() {
fi
;;
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
-e)
COMPREPLY=( $( compgen -e -- "$cur" ) )
@ -472,10 +725,19 @@ function _docker_compose_run() {
__docker_compose_complete_services
;;
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
=)
COMPREPLY=("$cur")
@ -495,10 +757,19 @@ function _docker_compose_scale() {
__docker_compose_nospace
;;
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
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
@ -507,10 +778,19 @@ function _docker_compose_start() {
__docker_compose_complete_services --filter status=stopped
;;
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
--timeout|-t)
return
@ -525,10 +805,19 @@ function _docker_compose_stop() {
__docker_compose_complete_running_services
;;
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
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
@ -537,10 +826,19 @@ function _docker_compose_top() {
__docker_compose_complete_running_services
;;
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
-*)
COMPREPLY=( $( compgen -W "--help" -- "$cur" ) )
@ -549,10 +847,19 @@ function _docker_compose_unpause() {
__docker_compose_complete_services --filter status=paused
;;
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
=)
COMPREPLY=("$cur")
@ -580,19 +887,37 @@ function _docker_compose_up() {
__docker_compose_complete_services
;;
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
-*)
COMPREPLY=( $( compgen -W "--short" -- "$cur" ) )
;;
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)
shopt -s extglob
@ -686,6 +1011,10 @@ function _docker_compose() {
eval "$previous_extglob_setting"
return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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 COMPREPLY < <(compgen -W "${candidates[*]:-}" -- "$cur")
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -f -F _dotnet_bash_complete dotnet

View File

@ -63,6 +63,10 @@ function __fab_chache_mtime()
${__FAB_COMPLETION_MTIME_COMMAND} \
$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} {} + \
| xargs -n 1 expr | sort -n -r | head -1
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
@ -153,5 +161,9 @@ function __fab_completion()
# Set possible completions
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -o default -o nospace -F __fab_completion fab

View File

@ -2,7 +2,12 @@
cite "about-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 prev=${COMP_WORDS[COMP_CWORD - 1]}
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)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "${commands[*]}" -- "$cur"))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F __gem_completion gem

View File

@ -47,6 +47,10 @@
function _git_flow ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="init feature release hotfix"
local subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ]
@ -72,10 +76,18 @@ function _git_flow ()
COMPREPLY=()
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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 subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ]
@ -105,25 +117,57 @@ function __git_flow_feature ()
COMPREPLY=()
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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 ' |*'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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 }'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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/"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __git_flow_release ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="list start finish"
local subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ]
@ -142,15 +186,31 @@ function __git_flow_release ()
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __git_flow_hotfix ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="list start finish"
local subcommand="$(__git_find_subcommand "$subcommands")"
if [ -z "$subcommand" ]
@ -168,11 +228,27 @@ function __git_flow_hotfix ()
COMPREPLY=()
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __git_flow_list_hotfixes ()
{
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

View File

@ -55,6 +55,10 @@ __git_flow_config_file_options="
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 subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]
@ -92,10 +96,18 @@ function _git_flow ()
COMPREPLY=()
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __git_flow_init ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="help"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]
@ -113,10 +125,18 @@ function __git_flow_init ()
return
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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 subcommand="$(__git_find_on_cmdline "$subcommands")"
@ -197,10 +217,18 @@ function __git_flow_feature ()
COMPREPLY=()
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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 subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]
@ -284,10 +312,18 @@ function __git_flow_release ()
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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 subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]
@ -369,10 +405,18 @@ function __git_flow_hotfix ()
COMPREPLY=()
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __git_flow_support ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="list start help"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]
@ -410,10 +454,18 @@ function __git_flow_support ()
COMPREPLY=()
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __git_flow_config ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local subcommands="list set base"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]
@ -455,20 +507,36 @@ function __git_flow_config ()
COMPREPLY=()
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __git_flow_prefix ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
case "${1}" in
feature|release|hotfix|support)
git config "gitflow.prefix.$1" 2> /dev/null || echo "$1/"
return
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __git_flow_list_local_branches ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if [ -n "${1}" ]
then
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
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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 origin="$(git config gitflow.origin 2> /dev/null || echo "origin")"
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}"
echo "$ref"
done | sort
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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")"
if [ -n "${1}" ]
then
@ -511,6 +595,10 @@ function __git_flow_list_branches ()
else
git for-each-ref --format="%(refname:short)" refs/heads/ refs/remotes/$origin | sort
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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")"
return "${?}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __gradle-init-cache-dir()
@ -44,6 +48,10 @@ function __gradle-init-cache-dir()
cache_dir="$HOME/.gradle/completion"
mkdir -p ${cache_dir}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __gradle-set-build-file()
@ -62,6 +70,10 @@ function __gradle-set-build-file()
sed -n -e "s/rootProject\.buildFileName = [\'\"]\(.*\)[\'\"]/\1/p")
gradle_build_file="$project_root_dir/${build_file_name:-build.gradle}"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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=$(echo $gradle_build_file | sed -e 's/\//_/g')
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __gradle-set-files-checksum()
@ -92,6 +108,10 @@ function __gradle-set-files-checksum()
else
echo "Cannot generate completions as neither md5 nor md5sum exist on \$PATH"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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")
printf "%s\n" "${gradle_build_scripts[@]}" > $cache_dir/$cache_name
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __gradle-long-options()
@ -162,6 +186,10 @@ function __gradle-long-options()
--version - Prints Gradle version info
--warn - Log warnings and errors only"
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __gradle-properties()
@ -183,6 +211,10 @@ function __gradle-properties()
-Dorg.gradle.workers.max= - Set the number of workers Gradle is allowed to use"
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __gradle-short-options()
@ -213,6 +245,10 @@ function __gradle-short-options()
-P - Sets a project property of the root project
-S - Print out the full (very verbose) stacktrace"
COMPREPLY=( $(compgen -W "$args" -- "${COMP_WORDS[COMP_CWORD]}") )
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __gradle-notify-tasks-cache-build()
@ -226,6 +262,10 @@ function __gradle-notify-tasks-cache-build()
__gradle-generate-tasks-cache
# 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"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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}
echo ${gradle_files_checksum} > ${cache_dir}/${cache_name}.md5
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __gradle-completion-init()
@ -314,6 +358,10 @@ function __gradle-completion-init()
IFS="$OLDIFS"
return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function _gradle()
@ -396,6 +444,10 @@ wrapper - Generates Gradle wrapper files."
fi
return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F _gradle gradle

View File

@ -41,7 +41,12 @@
# eval "$(grunt --completion=bash)"
# 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"
while [[ "$curpath" ]]; do
for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do
@ -54,10 +59,19 @@ function _grunt_gruntfile() {
curpath="${curpath%/*}"
done
return 1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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.
local cur="${COMP_WORDS[COMP_CWORD]}"
# The current gruntfile, if it exists.
@ -71,6 +85,10 @@ function _grunt_completions() {
[[ "$cur" == -* ]] && compls="$compls $opts"
# Tell complete what stuff to show.
COMPREPLY=($(compgen -W "$compls" -- "$cur"))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -o default -F _grunt_completions grunt

View File

@ -39,12 +39,21 @@
#
# eval "$(gulp --completion=bash)"
# Enable bash autocompletion.
function _gulp_completions() {
# 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"))
function _gulp_completions()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# 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

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/')"
# 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
alias
pull-request
@ -52,7 +57,11 @@ ci-status
sync
EOF
__git_list_all_commands_without_hub
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Ensure cached commands are cleared
__git_all_commands=""
@ -90,7 +99,11 @@ EOF
((c++))
done
__gitcomp "$s ${shells}"
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# hub browse [-u] [--|[USER/]REPOSITORY] [SUBPAGE]
function _git_browse()
@ -140,7 +153,11 @@ EOF
else
__gitcomp "$u"
fi
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# hub compare [-u] [USER[/REPOSITORY]] [[START...]END]
function _git_compare()
@ -242,7 +259,11 @@ EOF
fi
;;
esac
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# hub create [NAME] [-p] [-d DESCRIPTION] [-h HOMEPAGE]
function _git_create()
@ -281,7 +302,11 @@ EOF
__gitcomp "${repo} ${flags}"
;;
esac
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# hub fork [--no-remote] [--remote-name REMOTE] [--org ORGANIZATION]
function _git_fork()
@ -319,7 +344,11 @@ EOF
__gitcomp "${flags}"
;;
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>]
fucntion _git_pull_request()
@ -361,7 +390,11 @@ EOF
__gitcomp "${flags}"
;;
esac
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
###################
# Helper functions
@ -410,7 +443,11 @@ EOF
fi
done < "${config}"
fi
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# __hub_github_repos [FORMAT]
# List all github hosted repository
@ -442,7 +479,11 @@ EOF
command git config --get-regexp 'remote\.[^.]*\.url' |
grep -E ' ((https?|git)://|git@)github\.com[:/][^:/]+/[^/]+$' |
sed -E 's#^remote\.([^.]+)\.url +.+[:/](([^/]+)/[^.]+)(\.git)?$#'"$format"'#'
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# __hub_heads
# List all local "branch", and remote "owner/repo:branch"
@ -468,7 +509,11 @@ EOF
done
done
fi
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# __hub_revlist [REMOTE]
# 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)' \
"refs/tags/"
fi
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Enable completion for hub even when not using the alias
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=( $(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
function _KAC_is_file_newer_than()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
[ -f "${1}" ] || return 1
[ $(($(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
@ -52,12 +60,16 @@ function _KAC_regen_cache()
local TMP_FILE="$(mktemp "${_KAC_CACHE_TMP_DIR}/${CACHE_NAME}.XXXX")"
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
if ! "$@" > "$TMP_FILE" 2> /dev/null
if ! "${@}" > "$TMP_FILE" 2> /dev/null
then
[[ $(wc -l "$TMP_FILE") == 0 ]] && rm -f "$TMP_FILE" && touch "$CACHE_PATH" && return 1
else
mv -f "$TMP_FILE" "$CACHE_PATH"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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}"
######################################################
echo "${@// /_SPACE_}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# the reverse operation from the function above
@ -78,6 +94,10 @@ function _KAC_get_command_from_cache_name()
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
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
@ -92,7 +112,7 @@ function _KAC_get_and_regen_cache()
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# 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} $*"
_KAC_CACHE_PATH="${_KNIFE_AUTOCOMPLETE_CACHE_DIR}/${CACHE_NAME}"
# no need to wait for the regen if the file already exists
@ -102,7 +122,11 @@ function _KAC_get_and_regen_cache()
else
${REGEN_CMD}
fi
}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}}
# performs two things: first, deletes all obsolete temp files
# 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
_KAC_get_and_regen_cache "${CMD}" > /dev/null
done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# perform a cache cleaning when loading this file
@ -146,6 +174,10 @@ function _KAC_knife_commands()
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
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
@ -171,6 +203,10 @@ function _KAC_get_current_base_command()
done
_KAC_CURRENT_COMMAND="${PREVIOUS}"
[[ "${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
@ -194,6 +230,10 @@ function _KAC_get_current_arg_position()
CURRENT_ARG_POS=$((CURRENT_ARG_POS + 1))
done
echo "${CURRENT_ARG_POS}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# the actual auto-complete function
@ -253,6 +293,10 @@ function _knife()
done
# shellcheck disable=SC2207,SC2086
COMPREPLY=($(compgen -W "${LIST}" -- ${COMP_WORDS[COMP_CWORD]}))
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F _knife knife

View File

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

View File

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

View File

@ -5,6 +5,10 @@
function _makecomplete()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
COMPREPLY=()
# 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]}")
return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -o nospace -F _makecomplete make

View File

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

View File

@ -2,6 +2,10 @@
function __ngrok_completion()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# shellcheck disable=SC2155
local prev=$(_get_pword)
# shellcheck disable=SC2155
@ -43,6 +47,10 @@ function __ngrok_completion()
*) ;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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"))
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F __notify-send_completions notify-send

View File

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

View File

@ -17,11 +17,15 @@ function __bash_it_complete_pip()
if _command_exists _pip_completion
then
complete -o default -F _pip_completion pip
_pip_completion "$@"
_pip_completion "${@}"
else
eval "$(pip completion --bash)"
_pip_completion "$@"
_pip_completion "${@}"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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
then
complete -o default -F _pip_completion pip3
_pip_completion "$@"
_pip_completion "${@}"
else
eval "$(pip3 completion --bash)"
_pip_completion "$@"
_pip_completion "${@}"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -o default -F __bash_it_complete_pip3 pip3

View File

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

View File

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

View File

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

View File

@ -1,6 +1,11 @@
# 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 CANDIDATE_VERSIONS
local SDKMAN_CANDIDATES_CSV="${SDKMAN_CANDIDATES_CSV:-}"
@ -49,15 +54,33 @@ function _sdkman_complete() {
fi
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}")
############### 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_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) "
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 ',' ' '
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F _sdkman_complete sdk

View File

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

View File

@ -3,7 +3,12 @@
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]}"
if [[ ${CURRENT_PROMPT} == *@* ]]
then
@ -40,6 +45,10 @@ _sshcomplete() {
fi
return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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
_svn_bash_completion_found=false
for _comp_path in "${_svn_bash_completion_paths[@]}"; do
if [[ -r "$_comp_path" ]]
if [[ -r "${_comp_path}" ]]
then
_svn_bash_completion_found=true
# shellcheck disable=SC1090 # don't follow
source "$_comp_path"
source "${_comp_path}"
break
fi
done

View File

@ -36,9 +36,9 @@ elif _bash_it_homebrew_check
3.2* | 4.0* | 4.1*)
# Import version 1.x of bash-completion, if installed.
BASH_COMPLETION="${BASH_IT_HOMEBREW_PREFIX}/opt/bash-completion@1/etc/bash_completion"
if [[ -r "$BASH_COMPLETION" ]]
if [[ -r "${BASH_COMPLETION}" ]]
then
source "$BASH_COMPLETION"
source "${BASH_COMPLETION}"
else
unset BASH_COMPLETION
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
if [[ .kitchen.yml -nt .kitchen.list.yml || .kitchen.local.yml -nt .kitchen.list.yml ]]
then
@ -6,9 +11,18 @@ function __kitchen_instance_list () {
kitchen list --bare > .kitchen.list.yml
fi
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]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
COMPREPLY=()
@ -27,5 +41,9 @@ function __kitchen_options () {
return 0
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F __kitchen_options kitchen

View File

@ -6,6 +6,10 @@
function _tmux_expand ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
[ "$cur" != "${cur%\\}" ] && cur="$cur"'\';
if [[ "$cur" == \~*/* ]]
then
@ -22,6 +26,10 @@ function _tmux_expand ()
function _tmux_filedir ()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
local IFS='
';
_tmux_expand || return 0;
@ -31,19 +39,48 @@ function _tmux_filedir ()
return 0;
fi;
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 cur="${1}"
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 cur="${1}"
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 cur="${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/:/\\\\:/')"
sessions="$(echo "${sessions}" | sed -e 's/:/\\\\:/')"
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 i cmd cmd_index option option_index
local opts=""
@ -195,6 +241,10 @@ function _tmux() {
return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F _tmux tmux

View File

@ -23,7 +23,12 @@
# SOFTWARE.
function __pwdln() {
function __pwdln()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
pwdmod="${PWD}/"
itr=0
until [[ -z "$pwdmod" ]];do
@ -31,9 +36,18 @@ function __pwdln() {
pwdmod="${pwdmod#*/}"
done
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
echo "${PWD}/.vagrant"
return 0
@ -48,9 +62,18 @@ function __vagrantinvestigate() {
done
fi
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]}"
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"
@ -162,5 +185,9 @@ function _vagrant() {
;;
esac
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F _vagrant vagrant

View File

@ -1,10 +1,24 @@
#!/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 " "
############### 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 '"')
TOTAL=$(vboxmanage list vms | cut -d' ' -f1 | tr -d '"')
@ -20,9 +34,18 @@ function __vboxmanage_startvm() {
(( $MATCH == 0 )) && AVAILABLE="$AVAILABLE $VM "
done
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-)
PRUNED=""
@ -39,10 +62,19 @@ function __vboxmanage_list() {
fi
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=""
if [ "x$1" == "x" ]
then
@ -57,9 +89,18 @@ function __vboxmanage_list_vms() {
done
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=""
if [ "${1}" == "" ]
then
@ -75,9 +116,18 @@ function __vboxmanage_list_runningvms() {
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 "acpisleepbutton keyboardputscancode guestmemoryballoon"
echo "gueststatisticsinterval usbattach usbdetach vrde vrdeport"
@ -95,9 +145,18 @@ function __vboxmanage_controlvm() {
# <hostport>,[<guestip>],<guestport>
# 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)
opts=$realopts$(vboxmanage | grep -i vboxmanage | cut -d' ' -f2 | grep -v '\[' | sort | uniq)
pruned=""
@ -151,9 +210,18 @@ function __vboxmanage_default() {
# COMPREPLY=($(compgen -W "${pruned}" -- ${cur}))
echo $pruned
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
local cur p1 p2 p3 p4 opts
COMPREPLY=()
@ -228,5 +296,9 @@ function _vboxmanage() {
done
# echo "Got to end withoug completion"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F _vboxmanage vboxmanage

View File

@ -1,6 +1,11 @@
# shellcheck shell=bash
__vuejs_completion() {
__vuejs_completion()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
# shellcheck disable=SC2155
local prev=$(_get_pword)
# 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"))
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F __vuejs_completion vue

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
exit_code=0
for file in "$@"; do
for file in "${@}"; do
# Confirm file is executable
#
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 "--append-to-config (-a): Keep existing config file and append bash-it templates at the end"
echo "--overwrite-backup (-f): Overwrite existing backup"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# enable a thing
@ -38,6 +42,10 @@ function _bash-it_load_one()
else
echo "File ${dest} exists, skipping"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Interactively enable several things
@ -71,6 +79,10 @@ function _bash-it_load_some()
esac
done
done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Back up existing profile
@ -84,6 +96,10 @@ function _bash-it_backup()
test -w "$HOME/$CONFIG_FILE" \
&& 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"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Back up existing profile and create new one for bash-it
@ -97,6 +113,10 @@ function _bash-it_backup_new()
_bash-it_backup
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"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Back up existing profile and append bash-it templates at the end
@ -109,6 +129,10 @@ function _bash-it_backup_append()
_bash-it_backup
(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"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function _bash-it_check_for_backup()
@ -153,6 +177,10 @@ function _bash-it_check_for_backup()
else
echo -e "\033[0;32mOverwriting backup...\033[m"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function _bash-it_modify_config_files()
@ -190,18 +218,22 @@ function _bash-it_modify_config_files()
# backup/new by default
_bash-it_backup_new
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
for param in "$@"; do
for param in "${@}"; do
shift
case "$param" in
"--help") set -- "$@" "-h" ;;
"--silent") set -- "$@" "-s" ;;
"--interactive") set -- "$@" "-i" ;;
"--no-modify-config") set -- "$@" "-n" ;;
"--append-to-config") set -- "$@" "-a" ;;
"--overwrite-backup") set -- "$@" "-f" ;;
*) set -- "$@" "$param" ;;
"--help") set -- "${@}" "-h" ;;
"--silent") set -- "${@}" "-s" ;;
"--interactive") set -- "${@}" "-i" ;;
"--no-modify-config") set -- "${@}" "-n" ;;
"--append-to-config") set -- "${@}" "-a" ;;
"--overwrite-backup") set -- "${@}" "-f" ;;
*) set -- "${@}" "$param" ;;
esac
done

View File

@ -12,10 +12,10 @@ if [[ -n "${BASH_IT_THEME:-}" ]]
if [[ -f "${BASH_IT_THEME}" ]]
then
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
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
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

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
LC_ALL='en_US.UTF-8'
printf "%s" "${EPOCHREALTIME:-$SECONDS}"
)
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
: "${COMMAND_DURATION_START_SECONDS:=$(_shell_duration_en)}"
: "${COMMAND_DURATION_ICON:=🕘}"
: "${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)"
############### 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=""
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function _dynamic_clock_icon {
@ -28,9 +50,18 @@ function _dynamic_clock_icon {
# so between 144 and 155 in base 10.
printf -v clock_hand '%x' $(((${1:-${SECONDS}} % 12) + 144))
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 "${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"
fi
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
_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.
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_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
*'noauto'* | *'autoload'*)
: # Do nothing, as configured.
@ -21,9 +31,18 @@ function _bash-it-history-auto-save() {
shopt -q histappend && history -a && return
;;
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
*'noauto'*)
: # Do nothing, as configured.
@ -44,6 +63,10 @@ function _bash-it-history-auto-load() {
: # Do nothing, default.
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
_bash_it_library_finalize_hook+=('_bash-it-history-init')

View File

@ -11,7 +11,8 @@
: "${BASH_IT_LOG_LEVEL_TRACE:=7}"
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 without_extension component_directory
local component_filename component_type component_name
@ -43,14 +44,26 @@ function _bash-it-log-prefix-by-path() {
# shellcheck disable=SC2034
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.
[[ -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'
: _param '1: color of the message'
: _param '2: log level to print before the prefix'
@ -67,9 +80,12 @@ function _bash-it-log-message() {
else
printf '%s\n' "${message}"
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'
: _param '1: message to log'
: _example '$ _log_debug "Loading plugin git..."'
@ -79,9 +95,14 @@ function _log_debug() {
then
_bash-it-log-message "${echo_green:-}" "DEBUG: " "${1}"
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'
: _param '1: message to log'
: _example '$ _log_warning "git binary not found, disabling git plugin..."'
@ -91,9 +112,13 @@ function _log_warning() {
then
_bash-it-log-message "${echo_yellow:-}" " WARN: " "${1}"
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'
: _param '1: message to log'
: _example '$ _log_error "Failed to load git plugin..."'
@ -103,4 +128,5 @@ function _log_error() {
then
_bash-it-log-message "${echo_red:-}" "ERROR: " "${1}"
fi
}

View File

@ -12,11 +12,9 @@ __bp_delay_install="delayed"
source "${BASH_IT?}/vendor/github.com/rcaloras/bash-preexec/bash-preexec.sh"
# Block damanaging user's `$HISTCONTROL`
function __bp_adjust_histcontrol() { :; }
__bp_adjust_histcontrol()
# 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.
# See bash-it/bash-it#1040 and rcaloras/bash-preexec#26
: "${__bp_enable_subshells:=}" # blank
@ -25,19 +23,42 @@ function __bp_require_not_readonly() { :; }
_bash_it_library_finalize_hook+=('__bp_install_after_session_init')
## 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
__bp_trim_whitespace f "${1?}"
_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
__bp_trim_whitespace f "${1?}"
_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
if [[ "${bash_preexec_imported:-${__bp_imported:-missing}}" == "defined" ]]
@ -62,9 +83,18 @@ function safe_append_prompt_command() {
PROMPT_COMMAND="${1};${PROMPT_COMMAND}"
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
if [[ "${bash_preexec_imported:-${__bp_imported:-missing}}" == "defined" ]]
@ -78,4 +108,8 @@ function safe_append_preexec() {
else
_log_error "${FUNCNAME[0]}: can't append to preexec hook because _bash-preexec.sh_ hasn't been loaded"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}

View File

@ -2,13 +2,18 @@
#
# 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 themes IFS=$'\n' cur
if [[ $# -gt '0' ]]
then
themes=("$@")
themes=("${@}")
else
themes=("${BASH_IT?}/themes"/*/*.theme.bash)
themes=("${themes[@]##*/}")
@ -28,10 +33,14 @@ function _bash-it-preview() {
BASH_IT_LOG_LEVEL=0
bash --init-file "${BASH_IT?}/bash_it.sh" -i <<< '_bash-it-flash-term "${#BASH_IT_THEME}" "${BASH_IT_THEME}"'
done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
if [[ -n "${BASH_PREVIEW:-}" ]]
then
_bash-it-preview "${BASH_PREVIEW}" "$@"
_bash-it-preview "${BASH_PREVIEW}" "${@}"
unset BASH_PREVIEW #Prevent infinite looping
fi

View File

@ -47,7 +47,12 @@
# 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'
_param '1: term1'
_param '2: [ term2 ]...'
@ -64,7 +69,7 @@ function _bash-it-search() {
fi
local -a args=()
for word in "$@"; do
for word in "${@}"; do
case "${word}" in
'-h' | '--help')
_bash-it-search-help
@ -90,9 +95,18 @@ function _bash-it-search() {
fi
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-}
${echo_underline_yellow-}USAGE${echo_normal-}
@ -167,26 +181,53 @@ ${echo_underline_yellow-}SUMMARY${echo_normal-}
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 term="${2:-}"
_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}"
shift
local negative
for negative in "$@"; do
for negative in "${@}"; do
[[ "${match}" =~ ${negative} ]] && return 0
done
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'
_param '1: component type, one of: [ aliases | plugins | completions ]'
_param '2: term1 term2 @term3'
@ -201,7 +242,7 @@ function _bash-it-search-component() {
local component_singular action action_func
local -a search_commands=('enable' 'disable')
for search_command in "${search_commands[@]}"; do
if _bash-it-array-contains-element "--${search_command}" "$@"
if _bash-it-array-contains-element "--${search_command}" "${@}"
then
component_singular="${component/es/}" # aliases -> alias
component_singular="${component_singular/ns/n}" # plugins -> plugin
@ -212,7 +253,7 @@ function _bash-it-search-component() {
fi
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 partial_terms=() # terms that should be included if they match partially
@ -263,9 +304,17 @@ function _bash-it-search-component() {
done
_bash-it-search-result "${component}" "${action:-}" "${action_func:-}" "${matches[@]:-}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function _bash-it-search-result() {
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}"
shift
local action="${1:-}"
@ -349,14 +398,32 @@ function _bash-it-search-result() {
((modified)) && _bash-it-component-cache-clean "${component}"
printf "\n"
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}"
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 term="${2:-}"
# 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}"
printf '%b' "${color}${term}"
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 delay=0.05
local term="${2:-}" # calculate length ourselves
@ -383,4 +459,8 @@ function _bash-it-erase-term() {
printf "%.*s" "$i" " "
sleep "${delay}"
done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}

View File

@ -6,7 +6,12 @@
# 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
# filename without path
filename="${1##*/}"
@ -14,9 +19,18 @@ function _bash-it-get-component-name-from-path() {
filename="${filename##*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}"}"
# filename without path, priority or extension
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
# filename without path
filename="${1##*/}"
@ -25,6 +39,10 @@ function _bash-it-get-component-type-from-path() {
# extension without priority or name
filename="${filename##*.}"
echo "${filename}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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!
#
#
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?}"
shift
for e in "$@"; do
for e in "${@}"; do
[[ "$e" == "${element}" ]] && return 0
done
return 1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Dedupe an array (without embedded newlines).
function _bash-it-array-dedup() {
printf '%s\n' "$@" | sort -u
function _bash-it-array-dedup()
{
############ 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
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:-/usr/bin/grep}" "$@"
"${BASH_IT_GREP:-/usr/bin/grep}" "${@}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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:-/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)
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:-/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).
###########################################################################
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
_bash-it-component-pluralize "${1}" component
_bash-it-component-cache-file "${component}" file
@ -94,17 +162,35 @@ function _bash-it-component-help() {
"${func}" | _bash-it-egrep '\[[x ]\]' >| "${file}"
fi
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]//-/_}}"
_bash-it-component-pluralize "${1?${FUNCNAME[0]}: component name required}" _component_to_cache
_file_path="${XDG_CACHE_HOME:-${HOME?}/.cache}/bash/${_component_to_cache?}"
[[ -f "${_file_path}" ]] || mkdir -p "${_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 _component_to_single="${1?${FUNCNAME[0]}: component name required}"
local -i len="$((${#_component_to_single} - 2))"
@ -116,9 +202,18 @@ function _bash-it-component-singularize() {
_component_to_single="${_component_to_single%es}"
fi
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 _component_to_plural="${1?${FUNCNAME[0]}: component name required}"
local -i len="$((${#_component_to_plural} - 1))"
@ -131,9 +226,18 @@ function _bash-it-component-pluralize() {
_component_to_plural="${_component_to_plural}es"
fi
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 cache
local -a components=('aliases' 'plugins' 'completions')
@ -146,29 +250,69 @@ function _bash-it-component-cache-clean() {
_bash-it-component-cache-file "${component}" cache
: >| "${cache:?}"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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}"
_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}"
shift
local term="${1}"
_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}"
_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}"
_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.
@ -178,7 +322,12 @@ function _bash-it-component-list-disabled() {
#
# Examples:
# _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
if [[ -f "${1?}" ]]
@ -199,6 +348,10 @@ function _bash-it-component-item-is-enabled() {
done
return 1
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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:
# _bash-it-component-item-is-disabled alias git && echo "git aliases are disabled"
function _bash-it-component-item-is-disabled() {
! _bash-it-component-item-is-enabled "$@"
function _bash-it-component-item-is-disabled()
{
############ 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_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'
group 'aws'
@ -32,7 +38,14 @@ function awskeys {
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 "Helper to AWS credentials file.\n"
echo -e "Commands:\n"
@ -41,18 +54,38 @@ function __awskeys_help {
echo " show Show the AWS keys associated to a credentials profile"
echo " export Export an AWS credentials profile keys as environment variables"
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)
if [[ -n "${ln}" ]]
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 1 "aws_session_token"
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)"
if [[ -n $"{credentials_list}" ]]
then
@ -64,9 +97,19 @@ function __awskeys_list {
else
echo "No profiles found in credentials file"
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)"
if [[ -n "${p_keys}" ]]
then
@ -74,9 +117,19 @@ function __awskeys_show {
else
echo "Profile $1 not found in credentials file"
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}"* ]]
then
local p_keys=( $(__awskeys_get $1 | tr -d " ") )
@ -91,13 +144,33 @@ function __awskeys_export {
else
echo "Profile $1 not found in credentials file"
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
############### 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
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
@ -119,6 +192,10 @@ function __awskeys_comp {
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
complete -F __awskeys_comp awskeys

View File

@ -2,7 +2,12 @@
cite about-plugin
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'
group 'base'
if _command_exists ifconfig
@ -14,17 +19,35 @@ function ips() {
else
echo "You don't have ifconfig or ip command installed!"
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'
param '1: website url'
example '$ down4me http://www.google.com'
group 'base'
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'
group 'base'
list=("http://myip.dnsomatic.com/" "http://checkip.dyndns.com/" "http://checkip.dyndns.org/")
@ -36,9 +59,18 @@ function myip() {
done
res="$(echo "$res" | grep -Eo '[0-9\.]+')"
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'
param '1: filename'
example '$ pickfrom /usr/share/dict/words'
@ -52,9 +84,18 @@ function pickfrom() {
length="$(wc -l < "$file")"
n=$((RANDOM * length / 32768 + 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'
param 'optional integer length'
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)"
echo "With spaces (easier to memorize): ${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
@ -78,7 +123,12 @@ fi
if _command_exists markdown && _command_exists browser
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'
param '1: markdown file'
example '$ pmdown README.md'
@ -88,7 +138,12 @@ if _command_exists markdown && _command_exists browser
}
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'
param 'one or more directories to create'
example '$ mkcd foo'
@ -96,37 +151,73 @@ function mkcd() {
example '$ mkcd foo foo1 foo2 fooN'
example '$ mkcd /tmp/img/photos/large /tmp/img/photos/self /tmp/img/photos/Beijing'
group 'base'
mkdir -p -- "$@" && cd -- "${!#}" || return
mkdir -p -- "${@}" && cd -- "${!#}" || return
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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'
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?'
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'
param '1: directory name'
group 'base'
case $OSTYPE in
*'darwin'*)
du -hd 1 "$@"
du -hd 1 "${@}"
;;
*'linux'*)
du -h --max-depth=1 "$@"
du -h --max-depth=1 "${@}"
;;
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'
param 'if not set, display todo item'
param '1: todo text'
@ -135,7 +226,7 @@ function t() {
if _bash-it-component-item-is-enabled plugin todo
then
todo.sh "$@"
todo.sh "${@}"
return
elif [[ ! -f "${todotxt}" && -f ~/.t ]]
then
@ -146,52 +237,83 @@ function t() {
then
cat "${todotxt}"
else
echo "$@" >| "${todotxt}"
echo "${@}" >| "${todotxt}"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
if _command_exists mkisofs
then
function mkiso() {
about 'creates iso from current dir in the parent dir (unless defined)'
param '1: ISO name'
param '2: dest/path'
param '3: src/path'
example 'mkiso'
example 'mkiso ISO-Name dest/path src/path'
group 'base'
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)'
param '1: ISO name'
param '2: dest/path'
param '3: src/path'
example 'mkiso'
example 'mkiso ISO-Name dest/path src/path'
group 'base'
local isoname="${1:-${PWD##*/}}"
local destpath="${2:-../}"
local srcpath="${3:-${PWD}}"
local isoname="${1:-${PWD##*/}}"
local destpath="${2:-../}"
local srcpath="${3:-${PWD}}"
if [[ ! -f "${destpath%/}/${isoname}.iso" ]]
then
echo "writing ${isoname}.iso to ${destpath} from ${srcpath}"
mkisofs -V "${isoname}" -iso-level 3 -r -o "${destpath%/}/${isoname}.iso" "${srcpath}"
else
echo "${destpath%/}/${isoname}.iso already exists"
fi
}
if [[ ! -f "${destpath%/}/${isoname}.iso" ]]
then
echo "writing ${isoname}.iso to ${destpath} from ${srcpath}"
mkisofs -V "${isoname}" -iso-level 3 -r -o "${destpath%/}/${isoname}.iso" "${srcpath}"
else
echo "${destpath%/}/${isoname}.iso already exists"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
fi
# 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'
param 'filename'
group 'base'
local filename="${1?}" filetime
filetime=$(date +%Y%m%d_%H%M%S)
cp -a "${filename}" "${filename}_${filetime}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
if ! _command_exists del
then
function del() {
about 'move files to hidden folder in tmp, that gets cleared on each reboot'
param 'file or folder to be deleted'
example 'del ./file.txt'
group 'base'
mkdir -p /tmp/.trash && mv "$@" /tmp/.trash
}
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'
param 'file or folder to be deleted'
example 'del ./file.txt'
group 'base'
mkdir -p /tmp/.trash && mv "${@}" /tmp/.trash
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
fi

View File

@ -1,7 +1,12 @@
# shellcheck shell=bash
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
if _command_exists upower
then
@ -20,9 +25,18 @@ function ac_adapter_connected() {
then
WMIC Path Win32_Battery Get BatteryStatus /Format:List | grep -q 'BatteryStatus=2'
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
if _command_exists upower
then
@ -41,9 +55,18 @@ function ac_adapter_disconnected() {
then
WMIC Path Win32_Battery Get BatteryStatus /Format:List | grep -q 'BatteryStatus=1'
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%)'
group 'battery'
@ -75,9 +98,18 @@ function battery_percentage() {
else
echo "${command_output}"
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'
group 'battery'
@ -143,4 +175,8 @@ function battery_charge() {
echo "${danger_color}UNPLG${normal?}"
;;
esac
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}

View File

@ -3,7 +3,12 @@
cite about-plugin
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'
example '$ echo "<h1>hi mom!</h1>" | browser'
example '$ ron -5 man/rip.5.ron | browser'
@ -23,10 +28,19 @@ function browser() {
cat /dev/stdin > $f
open $f
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!'
example '$ wmate google.com'
group 'browser'
@ -63,9 +77,18 @@ EOT`
reference wmate
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'
example '$ raw google.com'
group 'browser'
@ -79,4 +102,8 @@ function raw() {
reference raw
fi
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}

View File

@ -4,19 +4,28 @@ about-plugin 'Simplify `curl cht.sh/<query>` to `cht.sh <query>`'
# Play nicely if user already installed cht.sh cli tool
if ! _command_exists cht.sh
then
function cht.sh () {
about 'Executes a cht.sh curl query using the provided arguments'
param ' [ ( topic [sub-topic] ) | ~keyword ] [ :list | :help | :learn ]'
example '$ cht.sh :help'
example '$ cht.sh :list'
example '$ cht.sh tar'
example '$ cht.sh js "parse json"'
example '$ cht.sh python :learn'
example '$ cht.sh rust :list'
group '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'
param ' [ ( topic [sub-topic] ) | ~keyword ] [ :list | :help | :learn ]'
example '$ cht.sh :help'
example '$ cht.sh :list'
example '$ cht.sh tar'
example '$ cht.sh js "parse json"'
example '$ cht.sh python :learn'
example '$ cht.sh rust :list'
group 'cht-sh'
# Separate arguments with '/', preserving spaces within them
local query=$(IFS=/ ; echo "$*")
curl "cht.sh/${query}"
}
# Separate arguments with '/', preserving spaces within them
local query=$(IFS=/ ; echo "$*")
curl "cht.sh/${query}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
fi

View File

@ -2,7 +2,12 @@
cite about-plugin
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 current_time
current_time="$(_shell_duration_en)"
@ -12,6 +17,10 @@ function precmd_return_notification() {
printf '\a'
fi
return 0
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
safe_append_prompt_command 'precmd_return_notification'

View File

@ -1,126 +1,333 @@
# shellcheck shell=bash
# shellcheck disable=SC2005
function __() {
echo "$@"
function __()
{
############ 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
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
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
shift
out="$("__$next" "$@")"
out="$("__$next" "${@}")"
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
shift
out="$("__$next" "$@")"
out="$("__$next" "${@}")"
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
shift
out="$("__$next" "$@")"
out="$("__$next" "${@}")"
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
shift
out="$("__$next" "$@")"
out="$("__$next" "${@}")"
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
shift
out="$("__$next" "$@")"
out="$("__$next" "${@}")"
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
shift
out="$("__$next" "$@")"
out="$("__$next" "${@}")"
echo "${out:+${out};}7"
}
function __crossed() {
function __crossed()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
next=$1
shift
out="$("__$next" "$@")"
out="$("__$next" "${@}")"
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"
############### 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"
############### 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"
############### 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"
############### 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"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function __color_red() {
function __color_red()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
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"
############### 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"
############### 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"
############### 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"
############### 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"
############### 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"
############### 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 == "$g" && $g == "$b" ]] && echo $((r / 11 + 232)) && return # gray range above 232
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}"
shift
case "${1}" in
@ -142,56 +349,168 @@ function __color() {
next=$1
shift
out="$("__$next" "$@")"
out="$("__$next" "${@}")"
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
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
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'
group 'dirs'
@ -54,8 +59,12 @@ function dirs-help() {
echo "7 : Change to stack location 7."
echo "8 : Change to stack location 8."
echo "9 : Change to stack location 9."
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Add bookmarking functionality
# Usage:
@ -79,16 +88,30 @@ fi
alias L='cat "${BASH_IT_DIRS_BKS?}"'
# 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'
param '1: directory'
example '$ G ..'
group 'dirs'
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'
param '1: bookmark name'
example '$ S mybkmrk'
@ -104,9 +127,18 @@ function S() {
echo "${1}"=\""${PWD}"\" >> "${BASH_IT_DIRS_BKS?}"
# shellcheck disable=SC1090
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'
param '1: bookmark name'
example '$ R mybkmrk'
@ -119,6 +151,10 @@ function R() {
sed "/$1/d" "${BASH_IT_DIRS_BKS?}" > "${BASH_IT_DIRS_BKS?}.new"
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

View File

@ -1,7 +1,12 @@
cite about-plugin
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'
group 'docker-compose'
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 up -d
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
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'
group 'docker'
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'
group 'docker'
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'
group 'docker'
docker ps --filter status=exited -q | xargs docker rm --volumes
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'
group 'docker'
param '1: Name of the container to enter'
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'
group 'docker'
if [ -z "${1}" ]
@ -43,9 +84,18 @@ function docker-remove-images() {
# Strip out duplicate IDs before attempting to remove the image(s)
docker rmi $(echo ${ID_ARRAY[@]} | tr ' ' '\n' | sort -u | tr '\n' ' ')
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'
group 'docker'
if hash dot 2>/dev/null
@ -63,15 +113,33 @@ function docker-image-dependencies() {
else
>&2 echo "Can't show dependencies; Graphiz is not installed"
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'
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'
group 'docker'
param '1: image archive name'
@ -81,4 +149,8 @@ function docker-archive-content() {
then
tar -xzOf $1 manifest.json | jq '[.[] | .RepoTags] | add'
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}

View File

@ -1,7 +1,12 @@
cite about-plugin
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'
param '1: Name of the command to explain'
example '$ explain # interactive mode. Type commands to explain in REPL'
@ -22,4 +27,9 @@ explain () {
echo "explain interactive mode."
echo "explain 'cmd -o | ...' one quoted command to explain it."
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...'
# 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 OPTIND=1
while getopts "hv" opt; do
@ -56,7 +61,7 @@ End-Of-Usage
*.tar.Z) tar "x${verbose}Zf" "${1}" -C "$filedirname/$targetdirname" ;;
*.bz2) bunzip2 "${1}" ;;
*.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}" ;;
*.pax) pax -r -f "${1}" ;;
*.pkg) pkgutil --expand "${1}" "${1:0:-4}" ;;
@ -73,4 +78,8 @@ End-Of-Usage
shift
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'
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"
group "fzf"
param "1: Search term"
@ -30,9 +35,18 @@ fe() {
local files
files=($(fzf-tmux --query="${1}" --multi --select-1 --exit-0))
[[ -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"
group "fzf"
param "1: Directory to browse, or . if omitted"
@ -42,4 +56,8 @@ fcd() {
dir=$(find ${1:-.} -path '*/\.*' -prune \
-o -type d -print 2> /dev/null | fzf +m) &&
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: gifski (from `brew install gifski` or github.com/ImageOptim/gifski)
# 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.'
group 'gif'
param '1: MOV/AVI/MP4 file name(s)'
@ -65,7 +70,7 @@ function v2gif() {
fi
# 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
return 2
}
@ -217,9 +222,18 @@ function v2gif() {
done
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.'
group 'gif'
param '1: GIF/video file name(s)'
@ -235,7 +249,7 @@ function any2webm() {
local args out_size
# 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
return 2
}
@ -329,4 +343,8 @@ function any2webm() {
done
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"
git remote add origin "${GIT_HOSTING}:${1}".git
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function git_first_push {
about 'push into origin refs/heads/master'
group 'git'
echo "Running: 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'
group 'git'
BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "Publishing ${BRANCH} to remote origin"
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'
group 'git'
@ -36,30 +57,67 @@ function git_revert() {
git reset --soft "HEAD@{1}"
git commit -m "Revert to ${1}"
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'
group 'git'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function is_clean() {
if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]
then
echo "Your branch is dirty, please commit your changes"
kill -INT $$
fi
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) != "" ]]
then
echo "Your branch is dirty, please commit your changes"
kill -INT $$
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function commit_exists() {
if git rev-list --quiet "${1:?}"
then
echo "Commit ${1} does not exist"
kill -INT $$
fi
function commit_exists()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
if git rev-list --quiet "${1:?}"
then
echo "Commit ${1} does not exist"
kill -INT $$
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
read -p "Do you want to keep all changes from rolled back revisions in your working tree? [Y/N]" RESP
case "${RESP}" in
@ -79,7 +137,6 @@ function git_rollback() {
;;
esac
done
}
if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]
then
@ -106,25 +163,52 @@ function git_rollback() {
else
echo "you're currently not in a git repository"
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"
group 'git'
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)
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'
param '1: file or path fragment to ignore'
group 'git'
echo "${1}" >> .git/info/exclude
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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'
group 'git'
@ -161,8 +245,12 @@ function git_info() {
echo "you're currently not in a git repository"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function git_stats {
about 'display stats per author'
group 'git'
@ -210,9 +298,18 @@ function git_stats {
else
echo "you're currently not in a git repository"
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'
group 'git'
param '1: the language/type of the project, used for determining the contents of the .gitignore file'
@ -234,9 +331,18 @@ function gittowork() {
fi
echo "${result}" >> .gitignore
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'
group 'git'
example '$ gitignore-reload'
@ -288,9 +394,18 @@ function gitignore-reload() {
git add .
echo >&2 "Files readded. Commit your new changes now."
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 |
# ---------------------------------------------------------------
@ -331,4 +446,7 @@ function git-changelog() {
NEXT=${DATE}
done
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}

View File

@ -1,14 +1,23 @@
cite about-plugin
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'
group 'gitstatus'
unset SCM_GIT_USE_GITSTATUS
_command_exists gitstatus_stop && gitstatus_stop
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# No scm-check
[[ $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,
# while preserving ordering.
# 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'
_group 'go'
if [[ -z $GOPATH ]]
@ -34,5 +39,9 @@ _bash-it-gopath-pathmunge() {
pathmunge "${paths[i]}/bin"
fi
done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
_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
# 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)"
############### 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)" ]]
then
exec env -u PATH -u GOROOT -u GOPATH -u GOENV_OLD_VERSION "${0/-/}" --login
fi
unset GOENV_OLD_VERSION
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
preexec_functions+=(_bash-it-goenv-preexec)
precmd_functions+=(_bash-it-goenv-precmd)

View File

@ -1,7 +1,12 @@
cite about-plugin
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 result
@ -9,4 +14,8 @@ function gw() {
# Call gradle
"${result:-gradle}" $*
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}

View File

@ -1,25 +1,52 @@
cite about-plugin
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'
group 'hg'
hg status --no-color 2> /dev/null \
| awk '$1 == "?" { print "?" } $1 != "?" { print "!" }' \
| 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'
group 'hg'
[[ `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'
group 'hg'
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)
: "${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'
# - Make sure formatting doesn't interfer with our parsing
@ -33,4 +38,8 @@ function top-history() {
--table \
--table-columns 'Command Count,Command Name' \
--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_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'
group 'javascript'
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'
group 'javascript'
@ -24,9 +38,18 @@ function jquery_install {
version="${1}"
fi
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'
group 'javascript'
@ -38,4 +61,8 @@ function jquery_ui_install {
fi
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
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'
param '1: site directory'
group 'jekyll'
@ -45,9 +50,18 @@ function editpost() {
ret="$?"
popd > /dev/null || 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'
param '1: site directory'
group 'jekyll'
@ -189,9 +203,18 @@ function newpost() {
ret="$?"
popd > /dev/null || 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'
param '1: site directory'
group 'jekyll'
@ -224,9 +247,18 @@ function testsite() {
ret="$?"
popd > /dev/null || 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'
param '1: site directory'
group 'jekyll'
@ -260,9 +292,18 @@ function buildsite() {
ret="$?"
popd > /dev/null || 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'
param '1: site directory'
group 'jekyll'
@ -298,8 +339,12 @@ function deploysite() {
ret="$?"
popd > /dev/null || return "$ret"
return "$ret"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# Load the Jekyll config
if [[ -s "$HOME/.jekyllconfig" ]]
then

View File

@ -1,28 +1,63 @@
cite about-plugin
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'
group 'jgitflow'
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'
group 'jgitflow'
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'
group 'jgitflow'
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'
group 'jgitflow'
@ -30,18 +65,43 @@ function feature-finish {
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----------------------------------------------------------------\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'
group 'jgitflow'
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'
group 'jgitflow'
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
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
then
eval "$(jump shell bash "${JUMP_OPTS[@]}")"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
__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
# 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'
param '*: files to concatenate (as normally passed to cat)'
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'
param '*: the files to paginate with less'
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
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'
group 'nginx'
@ -18,9 +23,18 @@ function nginx_reload() {
echo "Nginx pid file not found"
return 0
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'
group 'nginx'
@ -34,9 +48,18 @@ function nginx_stop() {
echo "Nginx pid file not found"
return 0
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'
group 'nginx'
@ -48,11 +71,24 @@ function nginx_start() {
else
echo "Couldn't start nginx"
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'
group 'nginx'
nginx_stop && nginx_start
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}

View File

@ -19,13 +19,22 @@ fi
if ! _command_exists nvm
then
function nvm() {
echo "Bash-it no longer bundles the nvm script. Please install the latest version from"
echo ""
echo "https://github.com/creationix/nvm.git"
echo ""
echo "if you want to use nvm. You can keep this plugin enabled once you have installed 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 ""
echo "https://github.com/creationix/nvm.git"
echo ""
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
fi

View File

@ -7,14 +7,28 @@ if [[ "${OSTYPE}" != 'darwin'* ]]
return 1
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"
about "Shows the OS X Time Machine destination/mount point"
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"
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
echo "${line##*/}"
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"
about "Shows all of the backups for the specified machine"
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
echo "$line"
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"
about "Shows all of the backups for the specified machine, except for the most recent backup"
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
echo "$line"
done
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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"
sudo "-${SUDO_ASKPASS:+A}v" # validate without running a command, using `ssh-askpass` if available.
(while sudo "-${SUDO_ASKPASS:+A}v"; do
@ -68,14 +109,32 @@ function _tm_startsudo() {
done) &
SUDO_PID="$!"
trap _tm_stopsudo SIGINT SIGTERM
}
function _tm_stopsudo() {
kill "$SUDO_PID"
trap - SIGINT SIGTERM
sudo -k
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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"
about "Deletes all of the backups for the specified machine, with the exception of the most recent one"
param "1: Machine name (optional)"
@ -93,4 +152,8 @@ function time-machine-delete-old-backups() {
done <<< "$(time-machine-list-old-backups "$COMPUTERNAME")"
_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'
fi
function tab() {
function tab()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
about 'opens a new terminal tab'
group 'osx'
@ -26,53 +31,115 @@ function tab() {
do script with command " cd \"$PWD\"; $*" in window 0
end tell
EOF
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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"
############### 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'
param '1: man page to view'
example '$ pman bash'
group 'osx'
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'
param '1: Ruby method, module, or class'
example '$ pri Array'
group 'osx'
ri -T "${1}" | open -fa 'Preview'
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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'
param '1: url'
group 'osx'
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'
example '$ refresh-launchpad'
group 'osx'
defaults write com.apple.dock ResetLaunchPad -bool TRUE
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'
example 'list-jvms'
group 'osx'
@ -92,9 +159,18 @@ function list-jvms() {
fi
printf '%s\t%s\t%s\n' "${i}" "${JVMS[i]##*/}" "${JVMS_STATES[i]}"
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'
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" \
&& echo "Enabled ${DEFAULT_JVM} as default JVM"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}

View File

@ -4,45 +4,85 @@ cite about-plugin
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} ]]
then
echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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.
__pack_init_completion()
function __pack_init_completion()
{
############ STACK_TRACE_BUILDER #####################
Function_Name="${FUNCNAME[0]}"
Function_PATH="${Function_PATH}/${Function_Name}"
######################################################
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
shift
index=0
for w in "$@"; do
for w in "${@}"; do
[[ $w = "$word" ]] && return
index=$((index+1))
done
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
for w in "$@"; do
for w in "${@}"; do
[[ $w = "$word" ]] && return
done
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]}"
case $cur in
-*)
@ -140,23 +180,50 @@ __pack_handle_reply()
then
compopt -o nospace
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
# 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}"
_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}"
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]}"
# 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))
############### 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]}"
if __pack_contains_word "${words[c]}" "${must_have_one_noun[@]}"
@ -225,10 +301,19 @@ __pack_handle_noun()
nouns+=("${words[c]}")
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]}"
local next_command
@ -246,10 +331,19 @@ __pack_handle_command()
c=$((c+1))
__pack_debug "${FUNCNAME[0]}: looking for ${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 ]]
then
__pack_handle_reply
@ -279,10 +373,19 @@ __pack_handle_word()
__pack_handle_noun
fi
__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"
command_aliases=()
@ -326,10 +429,19 @@ _pack_build()
must_have_one_flag=()
must_have_one_noun=()
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"
command_aliases=()
@ -373,10 +485,19 @@ _pack_run()
must_have_one_flag=()
must_have_one_noun=()
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"
command_aliases=()
@ -406,10 +527,19 @@ _pack_rebase()
must_have_one_flag=()
must_have_one_noun=()
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"
command_aliases=()
@ -442,10 +572,19 @@ _pack_create-builder()
must_have_one_flag+=("-b")
must_have_one_noun=()
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"
command_aliases=()
@ -474,10 +613,19 @@ _pack_set-run-image-mirrors()
must_have_one_flag+=("-m")
must_have_one_noun=()
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"
command_aliases=()
@ -501,10 +649,19 @@ _pack_inspect-builder()
must_have_one_flag=()
must_have_one_noun=()
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"
command_aliases=()
@ -528,10 +685,19 @@ _pack_set-default-builder()
must_have_one_flag=()
must_have_one_noun=()
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"
command_aliases=()
@ -555,10 +721,19 @@ _pack_version()
must_have_one_flag=()
must_have_one_noun=()
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"
command_aliases=()
@ -582,10 +757,19 @@ _pack_completion()
must_have_one_flag=()
must_have_one_noun=()
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"
command_aliases=()
@ -618,10 +802,19 @@ _pack_root_command()
must_have_one_flag=()
must_have_one_noun=()
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
declare -A flaghash 2>/dev/null || :
declare -A aliashash 2>/dev/null || :
@ -645,8 +838,13 @@ __start_pack()
local nouns=()
__pack_handle_word
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
if [[ $(type -t compopt) = "builtin" ]]
then
complete -o default -F __start_pack pack

View File

@ -22,12 +22,20 @@ if [[ ${BASH_VERSINFO[0]} -lt 4 ]]
return
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
#TODO: "${histlines[@]/*( )+([[:digit:]])*( )/}"
local l
l="$(history | tail -r | sed -e 's/^\ *[0-9]*\ *//' | percol --query "${READLINE_LINE:-}")"
READLINE_LINE="${l}"
READLINE_POINT=${#l}
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
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'
group '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'
group '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'
group 'postgres'
@ -47,34 +70,74 @@ function postgres_status {
else
echo "Postgres service [RUNNING]"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
function is_postgres_running {
$POSTGRES_BIN/pg_ctl -D $PGDATA status | grep -F -o "no server running"
function is_postgres_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'
group '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'
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'
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}"
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'
group 'projects'
@ -54,6 +59,9 @@ function pj() {
esac
"${cmd:-cd}" "${dest}"
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}
alias pjo="pj open"

View File

@ -1,7 +1,12 @@
# shellcheck shell=bash
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'
group 'proxy'
@ -17,9 +22,17 @@ function disable-proxy() {
npm-disable-proxy
ssh-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'
group 'proxy'
@ -35,9 +48,17 @@ function enable-proxy() {
npm-enable-proxy
ssh-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'
group 'proxy'
@ -53,9 +74,17 @@ function enable-proxy-alt() {
npm-enable-proxy "${http_proxy:-}" "${https_proxy:-}"
ssh-enable-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'
group 'proxy'
@ -69,9 +98,17 @@ function show-proxy() {
git-global-show-proxy
svn-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'
group 'proxy'
@ -90,9 +127,17 @@ Run 'glossary proxy' to show the available proxy functions with a short descript
EOF
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'
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 ""
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'
group 'proxy'
@ -117,9 +170,17 @@ function npm-show-proxy() {
echo "npm HTTPS proxy: $(npm config get https-proxy)"
echo "npm proxy exceptions: $(npm config get noproxy)"
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'
group 'proxy'
@ -130,9 +191,17 @@ function npm-disable-proxy() {
npm config delete noproxy
echo "Disabled npm proxy settings"
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'
group 'proxy'
@ -147,9 +216,17 @@ function npm-enable-proxy() {
npm config set noproxy "${my_no_proxy:-}" || return
echo "Enabled npm proxy settings"
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'
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) HTTPS proxy: $(git config --global --get https.proxy)"
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'
group 'proxy'
@ -173,9 +258,17 @@ function git-global-disable-proxy() {
git config --global --unset-all https.proxy
echo "Disabled global Git proxy settings"
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'
group 'proxy'
@ -187,9 +280,17 @@ function git-global-enable-proxy() {
git config --global --add https.proxy "${BASH_IT_HTTPS_PROXY:?}"
echo "Enabled global Git proxy settings"
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'
group 'proxy'
@ -200,9 +301,17 @@ function git-show-proxy() {
echo "Git HTTP proxy: $(git config --get http.proxy)"
echo "Git HTTPS proxy: $(git config --get https.proxy)"
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'
group 'proxy'
@ -212,9 +321,17 @@ function git-disable-proxy() {
git config --unset-all https.proxy
echo "Disabled Git project proxy settings"
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'
group 'proxy'
@ -226,9 +343,17 @@ function git-enable-proxy() {
git config --add https.proxy "${BASH_IT_HTTPS_PROXY:?}"
echo "Enabled Git project proxy settings"
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'
group 'proxy'
@ -256,9 +381,17 @@ if (config.has_section('global')):
print 'http-proxy-exceptions: ' + proxy_exceptions
END
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'
group 'proxy'
@ -285,9 +418,17 @@ if config.has_section('global'):
print 'Disabled SVN proxy settings'
END
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'
group 'proxy'
@ -322,9 +463,17 @@ with open(os.path.expanduser('~/.subversion/servers'), 'wb') as configfile:
print 'Enabled SVN proxy settings'
END
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)'
group 'proxy'
@ -359,9 +508,17 @@ function ssh-show-proxy() {
}
' ~/.ssh/config | column -t
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'
group 'proxy'
@ -370,9 +527,17 @@ function ssh-disable-proxy() {
sed -e's/^.*ProxyCommand/# ProxyCommand/' "${BASH_IT_SED_I_PARAMETERS[@]}" ~/.ssh/config
echo "Disabled SSH config proxy settings"
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'
group 'proxy'
@ -381,4 +546,7 @@ function ssh-enable-proxy() {
sed -e's/# ProxyCommand/ ProxyCommand/' "${BASH_IT_SED_I_PARAMETERS[@]}" ~/.ssh/config
echo "Enabled SSH config proxy settings"
fi
############### Stack_TRACE_BUILDER ################
Function_PATH="$( dirname ${Function_PATH} )"
####################################################
}

View File

@ -12,7 +12,12 @@ else
return 1
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'
param '1: python module to open'
example '$ pyedit requests'
@ -33,4 +38,7 @@ function pyedit() {
echo "$EDITOR ${xpyc%.*}.py"
${VISUAL:-${EDITOR:-${ALTERNATE_EDITOR:-nano}}} "${xpyc%.*}.py"
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'
# 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.'
group 'rails'
@ -16,4 +21,7 @@ function killrails() {
echo "[FAIL] Error killing Rails server"
return 1
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