forked from Bash-it/bash-it
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "where" from "https://github.com/gaelicWizard/where.git@main" git-vendor-name: where git-vendor-dir: vendor/github.com/gaelicWizard/where git-vendor-repository: https://github.com/gaelicWizard/where.git git-vendor-ref: main
- Loading branch information
1 parent
8989290
commit b05b572
Showing
5 changed files
with
697 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# shellcheck shell=bash | ||
# | ||
# Load _where.bash from the vendors folder | ||
|
||
: "${WHERE_HOOK_SOURCE:=false}" | ||
: "${WHERE_EXPIRATION:=3600}" | ||
|
||
# shellcheck source=../github.com/gaelicWizard/where/_where.bash | ||
source "${BASH_IT}/vendor/github.com/gaelicWizard/where/_where.bash" | ||
|
||
function _where_from_here() | ||
{ | ||
local type="${BASH_COMMAND[1]:-${1:-}}" | ||
type="${type%% *}" | ||
# ${BASH_SOURCE[1]} is the file that called us, | ||
# ${BASH_LINENO[0]} is the line number of that file. | ||
_where_from_to_index+=( "${type:-thing} ${BASH_LINENO[0]:-NaN} ${BASH_SOURCE[1]:-/dev/stdin}" ) | ||
} | ||
alias alias='_where_from_here alias && builtin alias' | ||
|
||
function _where_from_here_process() | ||
{ | ||
local -i i _where_from_caller_lineno | ||
local _where_from_caller_type _where_from_caller_line_and_source _where_from_caller_source | ||
for i in "${!_where_from_to_index[@]}" | ||
do | ||
_where_from_caller_type="${_where_from_to_index[i]%% *}" | ||
_where_from_caller_line_and_source="${_where_from_to_index[i]#* }" | ||
_where_from_caller_source="${_where_from_caller_line_and_source#* }" | ||
_where_from_caller_lineno="${_where_from_caller_line_and_source%% *}" | ||
[[ "${_where_from_caller_source:-/dev/stdin}" == "/dev/stdin" ]] && continue | ||
_bash-it-array-contains-element "${_where_from_caller_source}" "${_where_from_aliases_to_index[@]}" \ | ||
|| _where_from_aliases_to_index+=( "${_where_from_caller_source}" ) | ||
unset '_where_from_to_index[i]' | ||
done | ||
|
||
for i in "${!_where_from_aliases_to_index[@]}" | ||
do | ||
_where_from "${_where_from_aliases_to_index[i]}" | ||
unset '_where_from_aliases_to_index[i]' | ||
done | ||
} | ||
|
||
_where_from_aliases_to_index+=( "${BASH_SOURCE[@]}" ) | ||
|
||
_bash_it_library_finalize_hook+=( '_where_from_here_process' ) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.