Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion libexec/basher-_deps
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@

set -e

get_vars_from_file() {
local names_pattern="$1";shift
local content_pattern='[a-zA-Z0-9.:/_-]*'
local value_pattern='('"$content_pattern"'|'\'"$content_pattern"\''|"'"$content_pattern"'")'
grep -E '^'"$names_pattern"'='"$value_pattern"'$' "$@"
}

if [ "$#" -ne 1 ]; then
basher-help _deps
exit 1
Expand All @@ -23,7 +30,7 @@ fi

shopt -s nullglob

source "$BASHER_PACKAGES_PATH/$package/package.sh"
eval "$(get_vars_from_file 'DEPS' "$BASHER_PACKAGES_PATH/$package/package.sh")"
IFS=: read -ra deps <<< "$DEPS"

for dep in "${deps[@]}"
Expand Down
9 changes: 8 additions & 1 deletion libexec/basher-_link-bins
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

package="$1"

get_vars_from_file() {
local names_pattern="$1";shift
local content_pattern='[a-zA-Z0-9.:/_-]*'
local value_pattern='('"$content_pattern"'|'\'"$content_pattern"\''|"'"$content_pattern"'")'
grep -E '^'"$names_pattern"'='"$value_pattern"'$' "$@"
}

shopt -s nullglob

if [ -e "$BASHER_PACKAGES_PATH/$package/package.sh" ]; then
source "$BASHER_PACKAGES_PATH/$package/package.sh"
eval "$(get_vars_from_file 'BINS' "$BASHER_PACKAGES_PATH/$package/package.sh")"
IFS=: read -ra bins <<< "$BINS"
fi

Expand Down
9 changes: 8 additions & 1 deletion libexec/basher-_link-completions
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

package="$1"

get_vars_from_file() {
local names_pattern="$1";shift
local content_pattern='[a-zA-Z0-9.:/_-]*'
local value_pattern='('"$content_pattern"'|'\'"$content_pattern"\''|"'"$content_pattern"'")'
grep -E '^'"$names_pattern"'='"$value_pattern"'$' "$@"
}

if [ ! -e "$BASHER_PACKAGES_PATH/$package/package.sh" ]; then
exit
fi

shopt -s nullglob

source "$BASHER_PACKAGES_PATH/$package/package.sh" # TODO: make this secure?
eval "$(get_vars_from_file '(BASH_COMPLETIONS|ZSH_COMPLETIONS)' "$BASHER_PACKAGES_PATH/$package/package.sh")"
IFS=: read -ra bash_completions <<< "$BASH_COMPLETIONS"
IFS=: read -ra zsh_completions <<< "$ZSH_COMPLETIONS"

Expand Down
9 changes: 8 additions & 1 deletion libexec/basher-_unlink-bins
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

package="$1"

get_vars_from_file() {
local names_pattern="$1";shift
local content_pattern='[a-zA-Z0-9.:/_-]*'
local value_pattern='('"$content_pattern"'|'\'"$content_pattern"\''|"'"$content_pattern"'")'
grep -E '^'"$names_pattern"'='"$value_pattern"'$' "$@"
}

if [ -e "$BASHER_PACKAGES_PATH/$package/package.sh" ]; then
source "$BASHER_PACKAGES_PATH/$package/package.sh"
eval "$(get_vars_from_file 'BINS' "$BASHER_PACKAGES_PATH/$package/package.sh")"
IFS=: read -ra bins <<< "$BINS"
fi

Expand Down
9 changes: 8 additions & 1 deletion libexec/basher-_unlink-completions
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

package="$1"

get_vars_from_file() {
local names_pattern="$1";shift
local content_pattern='[a-zA-Z0-9.:/_-]*'
local value_pattern='('"$content_pattern"'|'\'"$content_pattern"\''|"'"$content_pattern"'")'
grep -E '^'"$names_pattern"'='"$value_pattern"'$' "$@"
}

if [ ! -e "$BASHER_PACKAGES_PATH/$package/package.sh" ]; then
exit
fi

shopt -s nullglob

source "$BASHER_PACKAGES_PATH/$package/package.sh" # TODO: make this secure?
eval "$(get_vars_from_file '(BASH_COMPLETIONS|ZSH_COMPLETIONS)' "$BASHER_PACKAGES_PATH/$package/package.sh")"
IFS=: read -ra bash_completions <<< "$BASH_COMPLETIONS"
IFS=: read -ra zsh_completions <<< "$ZSH_COMPLETIONS"

Expand Down
9 changes: 8 additions & 1 deletion libexec/basher-list
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@

set -e

get_vars_from_file() {
local names_pattern="$1";shift
local content_pattern='[a-zA-Z0-9.:/_-]*'
local value_pattern='('"$content_pattern"'|'\'"$content_pattern"\''|"'"$content_pattern"'")'
grep -E '^'"$names_pattern"'='"$value_pattern"'$' "$@"
}

case $1 in
-v)
verbose="true"
Expand Down Expand Up @@ -35,7 +42,7 @@ do

# Check for package.sh file with custom BINS
if [ -e "$BASHER_PACKAGES_PATH/$package_full/package.sh" ]; then
source "$BASHER_PACKAGES_PATH/$package_full/package.sh"
eval "$(get_vars_from_file 'BINS' "$BASHER_PACKAGES_PATH/$package_full/package.sh")"
IFS=: read -ra bins <<< "$BINS"
fi

Expand Down