=====================================================================

--- New Scripts --------------------------

zsh )
  vundle-vim helpers
   - vim/vundle/edit-build-actions
   - vim/vundle/install
   - vim/vundle/rebuild

  quick install-from-source scripts
   - git/package/install
   - git/package/build    (install --only-build)
   - git/package/download (install --only-pull)
   - git/package/update   (install --update)

  config sym-linker (for source-controlled .configs)
   - config/update    (symlinks + terminfo)
   - config/symlinks  (set all symlinks from settings)
   - config/settings  (edit settings which aren't scwrypts env variables)
   - config/terminfo  (load all terminfo from settings)

--- Changes ------------------------------

- helper comments are now inserted in all env files
- removed underscore prefix for standard AWS environment variables
- added "opening" and "finished editing" comments to __EDIT util
- added __USAGE to format $USAGE variable to std:err
- added __ERROR_CHECK to exit if any __ERROR(s) were called
This commit is contained in:
2022-08-15 18:30:37 -06:00
parent a740a66870
commit 6333a2f6b8
34 changed files with 472 additions and 49 deletions

View File

@ -8,7 +8,7 @@ __PRINT() {
printf "${COLOR}${MESSAGE}${__COLOR_RESET}${LINE_END}"
}
__ERROR() { __PRINT $__RED "ERROR ✖ : $@" >&2; }
__ERROR() { __PRINT $__RED "ERROR ✖ : $@" >&2; ((ERRORS+=1)); }
__SUCCESS() { __PRINT $__GREEN "SUCCESS ✔ : $@" >&2; }
__WARNING() { __PRINT $__ORANGE "WARNING  : $@" >&2; }
__STATUS() { __PRINT $__BLUE "STATUS : $@" >&2; }
@ -23,6 +23,28 @@ __PROMPT() {
__FAIL() { __ERROR "${@:2}"; exit $1; }
__ABORT() { __FAIL 69 'user abort'; }
__ERROR_CHECK() {
[ ! $ERRORS ] && ERRORS=0
[[ $ERRORS -ne 0 ]] && __USAGE
[[ $ERRORS -eq 0 ]] || exit $ERRORS
}
__USAGE() {
[ ! $USAGE ] && return 0
USAGE=$(echo $USAGE | sed "s/^\t\+//; s/\s\+$//")
local USAGE_LINE=$(\
echo $USAGE \
| grep -i '^ *usage *:' \
| sed "s;^[^:]*:;& scwrypts -- $SCWRYPT_NAME;" \
| sed 's/ \{2,\}/ /g; s/scwrypts -- scwrypts/scwrypts/' \
)
local THE_REST=$(echo $USAGE | grep -vi '^ *usage *:' | sed 'N;/^\n$/D;P;D;')
{ echo; __PRINT $__DARK_BLUE "$USAGE_LINE"; echo $THE_REST; echo } >&2
}
__INPUT() {
__PROMPT "${@:2}"
__READ $1
@ -81,5 +103,8 @@ __EDIT() {
__ERROR 'currently in CI, but __EDIT explicitly requires terminal input'
return 1
}
__STATUS "opening '$1' for editing"
$EDITOR $@ </dev/tty >/dev/tty
__SUCCESS "finished editing '$1'!"
}

View File

@ -14,12 +14,6 @@ source ${0:a:h}/credits.zsh
IMPORT_ERROR=0
[ $CI ] && {
export _AWS_PROFILE="$AWS_PROFILE"
export _AWS_ACCOUNT="$AWS_ACCOUNT"
export _AWS_REGION="$AWS_REGION"
}
source ${0:a:h}/dependencies.zsh
_DEP_ERROR=0
_DEPENDENCIES=($(echo $_DEPENDENCIES | sort -u))