yage
fec8c5e560
introduce --verbosity flag rather than mixed logging settings; correct color misnaming to ANSI convention; added sanity-check; simplified hello-world; created FZF_USER_INPUT to replace the confusing FZF_HEAD and FZF_TAIL swap INFO for DEBUG v3-to-v4 upgrade docs bring some much-needed tender love and care to the scwrypts runner improved i/o handling on the run executable means this is no longer relevant FINALLY fix the weird cases for zsh/read builtin (particularly around reading one character from tty/pipe/file); also gave a --force-user-input flag in case you want to require user input on a yn prompt update ZLE plugin so it no more make errors FZF_(HEAD|TAIL) refactor to FZF_USER_INPUT plugins/kubectl migration from v3 to v4 plugins/ci migration from v3 to v4 refactor py/lib into python-scwrypts subproject verbosity is stupid lets call it log-level fix bug with virtualenv loading mergedeep to slow so I made my options dict shallow hokay first iteration of python-dudes is ready circleci configuration for python builds npm package for scwrypts 3.9.1 initial build/test steps for nodejs go go ok ok fix output ok ok finalize publish steps
40 lines
986 B
Bash
40 lines
986 B
Bash
__CHECK_REQUIRED_ENV() {
|
|
local SCWRYPTS_LOG_LEVEL=1
|
|
local VAR ERROR=0
|
|
REQUIRED_ENV=($(echo $REQUIRED_ENV | sed 's/\s\+/\n/g' | sort -u))
|
|
for VAR in ${REQUIRED_ENV[@]}; do __CHECK_ENV_VAR $VAR || ((ERROR+=1)); done
|
|
return $ERROR
|
|
}
|
|
|
|
__CHECK_ENV_VAR() {
|
|
local NAME="$1"
|
|
[ ! $NAME ] && return 1
|
|
|
|
local OVERRIDE_VALUE=$(eval echo '$'$NAME'__override')
|
|
[ $OVERRIDE_VALUE ] && export $NAME=$OVERRIDE_VALUE && return 0
|
|
|
|
local OPTIONAL="$2"
|
|
local DEFAULT_VALUE="$3"
|
|
|
|
local VALUE=$(eval echo '$'$NAME)
|
|
[ $VALUE ] && return 0
|
|
|
|
local SELECTION_VALUES=$(eval echo '$'$NAME'__select' | sed 's/,/\n/g; s/ /\n/g')
|
|
[[ $ERROR -eq 0 ]] && [[ ${#SELECTION_VALUES[@]} -gt 0 ]] && {
|
|
local SELECTION=$(echo $SELECTION_VALUES | FZF "select a value for '$NAME'")
|
|
[ $SELECTION ] && {
|
|
export $NAME=$SELECTION
|
|
return 0
|
|
}
|
|
}
|
|
[ $VALUE ] && return 0
|
|
|
|
[ $OPTIONAL ] && {
|
|
[ $DEFAULT_VALUE ] && $NAME="$DEFAULT_VALUE"
|
|
return 0
|
|
} || {
|
|
ERROR "variable '$NAME' required"
|
|
return 1
|
|
}
|
|
}
|