yage
fa9bb38462
===================================================================== Finally decided to port personal scripts into a standalone library. --- Release Notes ------------------------ - added support for python, zsh, and zx scripts - added support for "interactive" scripts which drop the user to a REPL - added support for passing arguments to commands - added support for python/node virtualenv management through scwrypts - added contributing and usage docs - updated zsh plugin to write commands to history - licensed under GPLv3 --- New Scripts -------------------------- zsh/scwrypts ) - configure - environment/copy - environment/delete - environment/edit - environment/synchronize - logs/clear - logs/view zsh ) - aws/ecr/login - aws/efs/mount - aws/efs/unmount - aws/route53/backup - aws/s3/media-sync/pull - aws/s3/media-sync/push python ) - redis/interactive =====================================================================
46 lines
1.0 KiB
Bash
46 lines
1.0 KiB
Bash
__CHECK_DEPENDENCIES() {
|
|
local DEPENDENCY
|
|
for DEPENDENCY in $*
|
|
do
|
|
__CHECK_DEPENDENCY $DEPENDENCY || ((__DEPENDENCY_ERROR+=1))
|
|
done
|
|
|
|
__CHECK_COREUTILS || ((__DEPENDENCY_ERROR+=$?))
|
|
|
|
return $__DEPENDENCY_ERROR
|
|
}
|
|
|
|
__CHECK_DEPENDENCY() {
|
|
local DEPENDENCY="$1"
|
|
[ ! $DEPENDENCY ] && return 1
|
|
|
|
command -v $DEPENDENCY >/dev/null 2>&1 || {
|
|
__ERROR "'$1' required but not installed. $(__CREDITS $1)"
|
|
return 1
|
|
}
|
|
}
|
|
|
|
__CHECK_COREUTILS() {
|
|
local COREUTILS=(awk find grep sed)
|
|
local MISSING_DEPENDENCY_COUNT=0
|
|
local NON_GNU_DEPENDENCY_COUNT=0
|
|
|
|
local UTIL
|
|
for UTIL in $(echo $COREUTILS)
|
|
do
|
|
__CHECK_DEPENDENCY $UTIL || { ((MISSING_DEPENDENCY_COUNT+=1)); continue; }
|
|
|
|
$UTIL --version 2>&1 | grep -q 'GNU' || {
|
|
__WARNING "non-GNU version of $UTIL detected"
|
|
((NON_GNU_DEPENDENCY_COUNT+=1))
|
|
}
|
|
done
|
|
|
|
[[ $NON_GNU_DEPENDENCY_COUNT -gt 0 ]] && {
|
|
__WARNING 'scripts rely on GNU coreutils; functionality may be limited'
|
|
__IS_MACOS && __REMINDER 'GNU coreutils can be installed and linked through Homebrew'
|
|
}
|
|
|
|
return $MISSING_DEPENDENCY_COUNT
|
|
}
|