From fcf492c661582636228642fefc8a23daff9b5693 Mon Sep 17 00:00:00 2001 From: yage Date: Tue, 6 Feb 2024 14:06:44 -0700 Subject: [PATCH] basic runner format; write a MAIN function --- zsh/cloud/aws/ecr/login | 9 +-- zsh/cloud/aws/efs/mount | 7 +-- zsh/cloud/aws/efs/unmount | 7 +-- zsh/cloud/aws/eks/login | 9 +-- zsh/cloud/aws/rds/create-backup | 10 +--- zsh/cloud/aws/rds/interactive-login | 11 +--- zsh/cloud/aws/rds/load-backup | 11 +--- zsh/cloud/aws/route53/backup | 9 +-- zsh/cloud/media-sync/pull | 9 +-- zsh/cloud/media-sync/push | 9 +-- zsh/db/postgres/interactive-pgcli | 10 ++-- zsh/db/postgres/pg_dump | 10 ++-- zsh/db/postgres/pg_restore | 10 ++-- zsh/db/postgres/run-sql | 14 +---- zsh/docker/cleanup | 8 +-- zsh/hello-world | 10 +--- zsh/helm/get-template | 8 --- zsh/helm/update-dependencies | 8 --- zsh/lib/scwrypts/run.module.zsh | 17 ++++++ zsh/media/youtube/download | 10 +--- zsh/media/youtube/get-audio-clip | 10 +--- zsh/misc/tally | 9 --- zsh/office/latex/build-pdf | 10 +--- zsh/office/latex/cleanup | 10 +--- zsh/office/latex/create-new | 11 ++-- zsh/office/latex/get-pdf | 9 +-- zsh/office/latex/open-pdf | 10 +--- zsh/office/memo/open | 10 +--- zsh/office/memo/remove | 10 +--- zsh/redis/curl | 12 +--- zsh/scwrypts/configure | 57 +++++++++--------- zsh/scwrypts/environment/copy | 65 ++++++++++---------- zsh/scwrypts/environment/delete | 61 +++++++++---------- zsh/scwrypts/environment/edit | 75 ++++++++++++------------ zsh/scwrypts/environment/synchronize | 9 +-- zsh/scwrypts/logs/clear | 36 ++++++------ zsh/scwrypts/logs/view | 22 ++++--- zsh/scwrypts/virtualenv/refresh | 49 ++++++++-------- zsh/scwrypts/virtualenv/update-all | 34 +++++------ zsh/system/config/settings | 10 ++-- zsh/system/config/symlinks | 12 +--- zsh/system/config/terminfo | 8 +-- zsh/system/config/update | 15 ++--- zsh/system/packages/build | 10 ++-- zsh/system/packages/download | 10 ++-- zsh/system/packages/install | 10 +--- zsh/system/packages/update | 10 ++-- zsh/system/vim/vundle/edit-build-actions | 10 ++-- zsh/system/vim/vundle/install | 10 +--- zsh/system/vim/vundle/rebuild | 10 ++-- 50 files changed, 298 insertions(+), 522 deletions(-) diff --git a/zsh/cloud/aws/ecr/login b/zsh/cloud/aws/ecr/login index 3bc78fb..415441b 100755 --- a/zsh/cloud/aws/ecr/login +++ b/zsh/cloud/aws/ecr/login @@ -1,10 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use cloud/aws/ecr - -CHECK_ENVIRONMENT ##################################################################### -ECR_LOGIN $@ +MAIN() { + ECR_LOGIN $@ +} diff --git a/zsh/cloud/aws/efs/mount b/zsh/cloud/aws/efs/mount index 28d381b..45dd844 100755 --- a/zsh/cloud/aws/efs/mount +++ b/zsh/cloud/aws/efs/mount @@ -3,11 +3,9 @@ DEPENDENCIES+=(jq) REQUIRED_ENV+=(AWS__EFS__LOCAL_MOUNT_POINT) use cloud/aws/cli - -CHECK_ENVIRONMENT ##################################################################### -EFS_CONNECT() { +MAIN() { GETSUDO || exit 1 [ ! -d $AWS__EFS__LOCAL_MOUNT_POINT ] && { sudo mkdir $AWS__EFS__LOCAL_MOUNT_POINT \ @@ -64,6 +62,3 @@ EFS_CONNECT() { FAIL 2 "unable to mount '$FS_ID'" } } - -##################################################################### -EFS_CONNECT $@ diff --git a/zsh/cloud/aws/efs/unmount b/zsh/cloud/aws/efs/unmount index 358e229..62beca9 100755 --- a/zsh/cloud/aws/efs/unmount +++ b/zsh/cloud/aws/efs/unmount @@ -3,11 +3,9 @@ DEPENDENCIES+=(jq) REQUIRED_ENV+=(AWS__EFS__LOCAL_MOUNT_POINT) use cloud/aws/cli - -CHECK_ENVIRONMENT ##################################################################### -EFS_DISCONNECT() { +MAIN() { [ ! -d "$AWS__EFS__LOCAL_MOUNT_POINT" ] && { STATUS 'no efs currently mounted' exit 0 @@ -32,6 +30,3 @@ EFS_DISCONNECT() { && SUCCESS "done" \ || FAIL 2 "failed to unmount '$EFS'" } - -##################################################################### -EFS_DISCONNECT $@ diff --git a/zsh/cloud/aws/eks/login b/zsh/cloud/aws/eks/login index 8c1cf14..76b0fe7 100755 --- a/zsh/cloud/aws/eks/login +++ b/zsh/cloud/aws/eks/login @@ -1,10 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use cloud/aws/eks - -CHECK_ENVIRONMENT ##################################################################### -EKS__CLUSTER_LOGIN $@ +MAIN() { + EKS__CLUSTER_LOGIN $@ +} diff --git a/zsh/cloud/aws/rds/create-backup b/zsh/cloud/aws/rds/create-backup index f91dfcb..c6fc357 100755 --- a/zsh/cloud/aws/rds/create-backup +++ b/zsh/cloud/aws/rds/create-backup @@ -1,19 +1,11 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use cloud/aws/rds use db/postgres - -CHECK_ENVIRONMENT ##################################################################### -CREATE_BACKUP() { +MAIN() { local DB_HOST DB_PORT DB_NAME DB_USER DB_PASS RDS__GET_DATABASE_CREDENTIALS $@ || return 1 PG_DUMP } - -##################################################################### -CREATE_BACKUP $@ diff --git a/zsh/cloud/aws/rds/interactive-login b/zsh/cloud/aws/rds/interactive-login index 1fe76a7..5e57e9f 100755 --- a/zsh/cloud/aws/rds/interactive-login +++ b/zsh/cloud/aws/rds/interactive-login @@ -1,20 +1,11 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use cloud/aws/rds use db/postgres - -CHECK_ENVIRONMENT ##################################################################### -RDS_INTERACTIVE_LOGIN() { +MAIN() { local DB_HOST DB_PORT DB_NAME DB_USER DB_PASS RDS__GET_DATABASE_CREDENTIALS $@ || return 1 POSTGRES__LOGIN_INTERACTIVE } - - -##################################################################### -RDS_INTERACTIVE_LOGIN $@ diff --git a/zsh/cloud/aws/rds/load-backup b/zsh/cloud/aws/rds/load-backup index 9bb39a2..c8ac1cc 100755 --- a/zsh/cloud/aws/rds/load-backup +++ b/zsh/cloud/aws/rds/load-backup @@ -1,20 +1,11 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use cloud/aws/rds use db/postgres - -CHECK_ENVIRONMENT ##################################################################### -LOAD_BACKUP() { +MAIN() { local DB_HOST DB_PORT DB_NAME DB_USER DB_PASS RDS__GET_DATABASE_CREDENTIALS $@ || return 1 PG_RESTORE } - - -##################################################################### -LOAD_BACKUP $@ diff --git a/zsh/cloud/aws/route53/backup b/zsh/cloud/aws/route53/backup index 562e114..43e1a40 100755 --- a/zsh/cloud/aws/route53/backup +++ b/zsh/cloud/aws/route53/backup @@ -1,11 +1,9 @@ #!/bin/zsh DEPENDENCIES+=(cli53) REQUIRED_ENV+=(AWS_PROFILE) - -CHECK_ENVIRONMENT ##################################################################### -ROUTE53_BACKUP() { +MAIN() { local BACKUP_PATH="$SCWRYPTS_OUTPUT_PATH/$ENV_NAME/aws-dns-backup/$(date '+%Y-%m-%d')" mkdir -p $BACKUP_PATH >/dev/null 2>&1 @@ -25,12 +23,11 @@ ROUTE53_BACKUP() { for P in ${JOBS[@]}; do wait $P >/dev/null 2>&1; done } +##################################################################### + ROUTE53_GET_DOMAINS() { cli53 list --profile $AWS_PROFILE \ | awk '{print $2;}' \ | sed '1d; s/\.$//'\ ; } - -##################################################################### -ROUTE53_BACKUP diff --git a/zsh/cloud/media-sync/pull b/zsh/cloud/media-sync/pull index 00bc144..1903cc7 100755 --- a/zsh/cloud/media-sync/pull +++ b/zsh/cloud/media-sync/pull @@ -1,10 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use cloud/media-sync - -CHECK_ENVIRONMENT ##################################################################### -MEDIA_SYNC__PULL $@ +MAIN() { + MEDIA_SYNC__PULL $@ +} diff --git a/zsh/cloud/media-sync/push b/zsh/cloud/media-sync/push index 20cc77e..000d132 100755 --- a/zsh/cloud/media-sync/push +++ b/zsh/cloud/media-sync/push @@ -1,10 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use cloud/media-sync - -CHECK_ENVIRONMENT ##################################################################### -MEDIA_SYNC__PUSH $@ +MAIN() { + MEDIA_SYNC__PUSH $@ +} diff --git a/zsh/db/postgres/interactive-pgcli b/zsh/db/postgres/interactive-pgcli index fda3987..d323312 100755 --- a/zsh/db/postgres/interactive-pgcli +++ b/zsh/db/postgres/interactive-pgcli @@ -1,9 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use db/postgres - -CHECK_ENVIRONMENT ##################################################################### -POSTGRES__LOGIN_INTERACTIVE $@ + +MAIN() { + POSTGRES__LOGIN_INTERACTIVE $@ +} diff --git a/zsh/db/postgres/pg_dump b/zsh/db/postgres/pg_dump index 4f09fc4..e47cd60 100755 --- a/zsh/db/postgres/pg_dump +++ b/zsh/db/postgres/pg_dump @@ -1,9 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use db/postgres - -CHECK_ENVIRONMENT ##################################################################### -PG_DUMP $@ + +MAIN() { + PG_DUMP $@ +} diff --git a/zsh/db/postgres/pg_restore b/zsh/db/postgres/pg_restore index 3b37396..a5808d3 100755 --- a/zsh/db/postgres/pg_restore +++ b/zsh/db/postgres/pg_restore @@ -1,9 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use db/postgres - -CHECK_ENVIRONMENT ##################################################################### -PG_RESTORE $@ + +MAIN() { + PG_RESTORE $@ +} diff --git a/zsh/db/postgres/run-sql b/zsh/db/postgres/run-sql index 0808c0a..f4f7017 100755 --- a/zsh/db/postgres/run-sql +++ b/zsh/db/postgres/run-sql @@ -1,13 +1,9 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use db/postgres - -CHECK_ENVIRONMENT ##################################################################### -RUN_SQL_POSTGRES() { +MAIN() { + WARNING " \nthis function is in a beta state\n " local _PASS _ARGS=() POSTGRES__SET_LOGIN_ARGS $@ @@ -43,9 +39,3 @@ RUN_SQL_POSTGRES() { && SUCCESS "finished running '$INPUT_FILE'" \ || FAIL 3 "something went wrong running '$INPUT_FILE' (see above)" } - -##################################################################### -WARNING -WARNING 'this function is in a beta state' -WARNING -RUN_SQL_POSTGRES $@ diff --git a/zsh/docker/cleanup b/zsh/docker/cleanup index 1889924..dec86b9 100755 --- a/zsh/docker/cleanup +++ b/zsh/docker/cleanup @@ -1,11 +1,8 @@ #!/bin/zsh DEPENDENCIES+=(docker) -REQUIRED_ENV+=() - -CHECK_ENVIRONMENT ##################################################################### -DOCKER_CLEAN() { +MAIN() { WARNING 'this will prune all docker resources from the current machine' WARNING 'pruned resources are PERMANENTLY DELETED' yN 'continue?' || return 1 @@ -14,6 +11,3 @@ DOCKER_CLEAN() { SUCCESS "IMAGE : $(docker image prune -f 2>/dev/null | tail -n 1)" SUCCESS "VOLUME : $(docker volume prune -f 2>/dev/null | tail -n 1)" } - -##################################################################### -DOCKER_CLEAN $@ diff --git a/zsh/hello-world b/zsh/hello-world index 46193d6..73f48fa 100755 --- a/zsh/hello-world +++ b/zsh/hello-world @@ -1,8 +1,4 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - -CHECK_ENVIRONMENT -##################################################################### - -SUCCESS 'hello world!' +MAIN() { + SUCCESS 'hello world!' +} diff --git a/zsh/helm/get-template b/zsh/helm/get-template index 1467734..195b49e 100755 --- a/zsh/helm/get-template +++ b/zsh/helm/get-template @@ -1,17 +1,9 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use helm use scwrypts - -CHECK_ENVIRONMENT ##################################################################### MAIN() { unset USAGE HELM__TEMPLATE__GET $@ } - -##################################################################### -MAIN $@ diff --git a/zsh/helm/update-dependencies b/zsh/helm/update-dependencies index 1aba64e..14779a0 100755 --- a/zsh/helm/update-dependencies +++ b/zsh/helm/update-dependencies @@ -1,17 +1,9 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use helm use scwrypts - -CHECK_ENVIRONMENT ##################################################################### MAIN() { unset USAGE HELM__DEPENDENCY__UPDATE $@ } - -##################################################################### -MAIN $@ diff --git a/zsh/lib/scwrypts/run.module.zsh b/zsh/lib/scwrypts/run.module.zsh index 3547f44..62dbcf1 100644 --- a/zsh/lib/scwrypts/run.module.zsh +++ b/zsh/lib/scwrypts/run.module.zsh @@ -112,11 +112,28 @@ SCWRYPTS__GET_RUNSTRING() { SCWRYPTS__GET_RUNSTRING__zsh() { __CHECK_DEPENDENCY zsh || return 1 + local SCWRYPT_FILENAME + + [ $(eval echo '$SCWRYPTS_TYPE__'$SCWRYPT_GROUP) ] \ + && SCWRYPT_FILENAME="$GROUP_PATH/$SCWRYPT_NAME" \ + || SCWRYPT_FILENAME="$GROUP_PATH/$SCWRYPT_TYPE/$SCWRYPT_NAME" \ + ; + + echo "source '$SCWRYPT_FILENAME'; CHECK_ENVIRONMENT; MAIN" + + return 0 +} + +SCWRYPTS__GET_RUNSTRING__zsh_v3_compatibility() { + __CHECK_DEPENDENCY zsh || return 1 + [ $(eval echo '$SCWRYPTS_TYPE__'$SCWRYPT_GROUP) ] \ && echo "source $GROUP_PATH/$SCWRYPT_NAME" \ || echo "source $GROUP_PATH/$SCWRYPT_TYPE/$SCWRYPT_NAME" \ ; + WARNING "scwrypts zsh/v3 runstrings are now deprecated; please update to scwrypts v4 format" + return 0 } diff --git a/zsh/media/youtube/download b/zsh/media/youtube/download index a91e3c2..0ac100c 100755 --- a/zsh/media/youtube/download +++ b/zsh/media/youtube/download @@ -1,13 +1,8 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use media/youtube - -CHECK_ENVIRONMENT ##################################################################### -DOWNLOAD_VIDEO() { +MAIN() { local URLS=($@) [[ ${#URLS[@]} -eq 0 ]] && URLS=($(echo '' | FZF_HEAD 'enter URL')) @@ -23,6 +18,3 @@ DOWNLOAD_VIDEO() { && SUCCESS "downloaded to '$YT__OUTPUT_DIR/$FILENAME'" \ || { ERROR "failed to download '$FILENAME'"; return 2; } } - -##################################################################### -DOWNLOAD_VIDEO $@ diff --git a/zsh/media/youtube/get-audio-clip b/zsh/media/youtube/get-audio-clip index 927d245..1edb8c0 100755 --- a/zsh/media/youtube/get-audio-clip +++ b/zsh/media/youtube/get-audio-clip @@ -1,13 +1,8 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use media/youtube - -CHECK_ENVIRONMENT ##################################################################### -GET_AUDIO_CLIP() { +MAIN() { local URLS=($@) [[ ${#URLS[@]} -eq 0 ]] && URLS=($(echo '' | FZF_HEAD 'enter URL')) @@ -49,6 +44,3 @@ GET_AUDIO_CLIP() { && SUCCESS "created clip '$OUTPUT_FILE'" \ || { ERROR "error creating clip '$(basename $OUTPUT_FILE)' (see above)"; return 3; } } - -##################################################################### -GET_AUDIO_CLIP $@ diff --git a/zsh/misc/tally b/zsh/misc/tally index bf9677d..1ac0e72 100755 --- a/zsh/misc/tally +++ b/zsh/misc/tally @@ -1,17 +1,8 @@ #!/bin/zsh -##################################################################### -DEPENDENCIES+=() -REQUIRED_ENV+=() - use misc/tally - -CHECK_ENVIRONMENT ##################################################################### MAIN() { unset USAGE TALLY $@ } - -##################################################################### -MAIN $@ diff --git a/zsh/office/latex/build-pdf b/zsh/office/latex/build-pdf index 7dd4122..39ef9cd 100755 --- a/zsh/office/latex/build-pdf +++ b/zsh/office/latex/build-pdf @@ -1,13 +1,8 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use office/latex - -CHECK_ENVIRONMENT ##################################################################### -PDFLATEX() { +MAIN() { [ ! $1 ] && FAIL 1 'must provide filename' local FILENAME=$(LATEX__GET_MAIN_FILENAME "$1") @@ -26,6 +21,3 @@ PDFLATEX() { SUCCESS "created '$(echo $FILENAME | sed 's/\.[^.]*$/.pdf/')'" } - -##################################################################### -PDFLATEX $@ diff --git a/zsh/office/latex/cleanup b/zsh/office/latex/cleanup index f118eed..efd699b 100755 --- a/zsh/office/latex/cleanup +++ b/zsh/office/latex/cleanup @@ -1,13 +1,8 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use office/latex - -CHECK_ENVIRONMENT ##################################################################### -CLEAN_LATEX_LOGFILES() { +MAIN() { local DIRECTORY=$(SCWRYPTS__GET_REALPATH ".") [ $1 ] && DIRECTORY="$(dirname "$(LATEX__GET_MAIN_FILENAME "$1")")" [ $DIRECTORY ] && [ -d $DIRECTORY ] \ @@ -18,6 +13,3 @@ CLEAN_LATEX_LOGFILES() { SUCCESS "cleaned up latex artifacts in '$DIRECTORY'" } - -##################################################################### -CLEAN_LATEX_LOGFILES $@ diff --git a/zsh/office/latex/create-new b/zsh/office/latex/create-new index 9939994..2a8d394 100755 --- a/zsh/office/latex/create-new +++ b/zsh/office/latex/create-new @@ -1,15 +1,10 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use office/latex - -CHECK_ENVIRONMENT ##################################################################### TEMPLATE_DIR="${0:a:h}/templates" -CREATE_NEW_LATEX_DOCUMENT_FROM_TEMPLATE() { +MAIN() { local DOCUMENT_DIR="$EXECUTION_DIR" local TEMPLATE=$(GET_TEMPLATES | FZF 'select a template') [ ! $TEMPLATE ] && ABORT @@ -39,6 +34,8 @@ CREATE_NEW_LATEX_DOCUMENT_FROM_TEMPLATE() { SUCCESS "finished generating '$(basename $DOCUMENT_FILE)' from '$TEMPLATE'" } +##################################################################### + GET_TEMPLATES() { find "$TEMPLATE_DIR" -type d | sed "s^$TEMPLATE_DIR/*^^; /^$/d" } @@ -59,4 +56,4 @@ SLUGIFY_TITLE() { } ##################################################################### -CREATE_NEW_LATEX_DOCUMENT_FROM_TEMPLATE $@ +MAIN $@ diff --git a/zsh/office/latex/get-pdf b/zsh/office/latex/get-pdf index 9aa399d..a25f5a5 100755 --- a/zsh/office/latex/get-pdf +++ b/zsh/office/latex/get-pdf @@ -1,10 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use office/latex - -CHECK_ENVIRONMENT ##################################################################### -LATEX__GET_PDF $@ +MAIN() { + LATEX__GET_PDF $@ +} diff --git a/zsh/office/latex/open-pdf b/zsh/office/latex/open-pdf index 5071ffb..6b5765d 100755 --- a/zsh/office/latex/open-pdf +++ b/zsh/office/latex/open-pdf @@ -1,18 +1,10 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use office/latex - -CHECK_ENVIRONMENT ##################################################################### -OPEN_PDF() { +MAIN() { local PDF=$(LATEX__GET_PDF $@) [ ! $PDF ] && return 1 OPEN "$PDF" } - -##################################################################### -OPEN_PDF $@ diff --git a/zsh/office/memo/open b/zsh/office/memo/open index 5cffb1b..ec0ff51 100755 --- a/zsh/office/memo/open +++ b/zsh/office/memo/open @@ -1,13 +1,8 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use office/memo - -CHECK_ENVIRONMENT ##################################################################### -OPEN_MEMO() { +MAIN() { local MEMO_NAME=$(MEMO__LIST_ALL | FZF_TAIL 'select/create a memo') [ ! "$MEMO_NAME" ] && ABORT @@ -26,6 +21,3 @@ OPEN_MEMO() { EDIT "$MEMO_FILE" } - -##################################################################### -OPEN_MEMO $@ diff --git a/zsh/office/memo/remove b/zsh/office/memo/remove index b80f2b1..59341fb 100755 --- a/zsh/office/memo/remove +++ b/zsh/office/memo/remove @@ -1,13 +1,8 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use office/memo - -CHECK_ENVIRONMENT ##################################################################### -DELETE_MEMO() { +MAIN() { local MEMO_NAME=$(MEMO__LIST_ALL | FZF 'select a memo to delete') local MEMO_FILE="$MEMO__DIR/$MEMO_NAME.$MEMO__FILETYPE" [ "$MEMO_NAME" ] && [ -f "$MEMO_FILE" ] || ABORT @@ -28,6 +23,3 @@ DELETE_MEMO() { || FAIL 1 "failed to remove memo '$MEMO_NAME'" \ ; } - -##################################################################### -DELETE_MEMO $@ diff --git a/zsh/redis/curl b/zsh/redis/curl index 20c04bd..c5cdd40 100755 --- a/zsh/redis/curl +++ b/zsh/redis/curl @@ -1,13 +1,8 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use redis - -CHECK_ENVIRONMENT ##################################################################### -CURL_WITH_CACHE() { +MAIN() { [ ! $TTL ] && TTL=10 [[ $(REDIS__ENABLED) -eq 0 ]] && { @@ -46,7 +41,6 @@ CURL_WITH_CACHE() { echo $OUTPUT } -GET_URL_KEY() { echo "scwrypts:curl:$1" | sed 's/\s\+/+/g'; } - ##################################################################### -CURL_WITH_CACHE $@ + +GET_URL_KEY() { echo "scwrypts:curl:$1" | sed 's/\s\+/+/g'; } diff --git a/zsh/scwrypts/configure b/zsh/scwrypts/configure index ade04ee..7d5f907 100755 --- a/zsh/scwrypts/configure +++ b/zsh/scwrypts/configure @@ -1,36 +1,33 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use scwrypts/meta - -CHECK_ENVIRONMENT ##################################################################### -USER_CONFIG_OVERRIDES="$SCWRYPTS_CONFIG_PATH/config.zsh" - -[ ! -f "$USER_CONFIG_OVERRIDES" ] && { - STATUS 'first-time setup detected; creating local configuration override...' - cp "$DEFAULT_CONFIG" "$USER_CONFIG_OVERRIDES" - - EDIT $USER_CONFIG_OVERRIDES - - STATUS 'attempting first-time build for virtual environments' - SCWRYPTS__RUN --name scwrypts/virtualenv/update-all --group scwrypts --type zsh \ - && SUCCESS 'finished updating virtualenvs' \ - || WARNING 'unable to create one or more virtualenv (see above)' \ - ; - - REMINDER ' - in the future, you can use the following scwrypt to update required virtual - environments (equivalent to "npm install" or "pip install -r requirements"): +MAIN() { + local USER_CONFIG_OVERRIDES="$SCWRYPTS_CONFIG_PATH/config.zsh" - scwrypts --name scwrypts/virtualenv/update-all --group scwrypts --type zsh - ' -} || { - EDIT "$USER_CONFIG_OVERRIDES" + [ ! -f "$USER_CONFIG_OVERRIDES" ] && { + STATUS 'first-time setup detected; creating local configuration override...' + cp "$DEFAULT_CONFIG" "$USER_CONFIG_OVERRIDES" + + EDIT $USER_CONFIG_OVERRIDES + + STATUS 'attempting first-time build for virtual environments' + SCWRYPTS__RUN --name scwrypts/virtualenv/update-all --group scwrypts --type zsh \ + && SUCCESS 'finished updating virtualenvs' \ + || WARNING 'unable to create one or more virtualenv (see above)' \ + ; + + REMINDER ' + in the future, you can use the following scwrypt to update required virtual + environments (equivalent to "npm install" or "pip install -r requirements"): + + scwrypts --name scwrypts/virtualenv/update-all --group scwrypts --type zsh + ' + } || { + EDIT "$USER_CONFIG_OVERRIDES" + } + + + SUCCESS 'saved new configuration' + REMINDER 'changes which affect the hot-key plugin will require a ZSHRC reload' } - - -SUCCESS 'saved new configuration' -REMINDER 'changes which affect the hot-key plugin will require a ZSHRC reload' diff --git a/zsh/scwrypts/environment/copy b/zsh/scwrypts/environment/copy index 2bd7451..4198ddf 100755 --- a/zsh/scwrypts/environment/copy +++ b/zsh/scwrypts/environment/copy @@ -1,38 +1,35 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use scwrypts/environment-files - -CHECK_ENVIRONMENT ##################################################################### -PROMPT 'choose an environment to copy' -TEMPLATE_ENV_NAME=$(SCWRYPTS__SELECT_ENV) -[ ! $TEMPLATE_ENV_NAME ] && ABORT - -STATUS "selected '$TEMPLATE_ENV_NAME'" - -PROMPT 'enter new environment name' -ENV_NAME=$(echo '' | FZF_HEAD 'new environment') -[ ! $ENV_NAME ] && ABORT -SCWRYPTS__GET_ENV_NAMES | grep -q $ENV_NAME && FAIL 1 "'$ENV_NAME' already exists" - -for GROUP in ${SCWRYPTS_GROUPS[@]} -do - TEMPLATE_ENV_FILE=$(SCWRYPTS__GET_ENV_FILE $TEMPLATE_ENV_NAME $GROUP 2>/dev/null) - ENV_FILE=$(SCWRYPTS__GET_ENV_FILE $ENV_NAME $GROUP 2>/dev/null) - - STATUS "creating environment '$ENV_NAME'" - cat "$TEMPLATE_ENV_FILE" \ - | sed 's/ # from.*//' \ - > "$ENV_FILE" \ - && SUCCESS "created '$ENV_FILE'" \ - || FAIL 2 "something went wrong creating '$ENV_FILE'" -done - -STATUS "synchronizing environments" -SCWRYPTS__RUN --name scwrypts/environment/synchronize --group scwrypts --type zsh -- --no-prompt \ - && SUCCESS "finished copy environment '$TEMPLATE_ENV_NAME > $ENV_NAME'" \ - || FAIL 3 'error during synchronization of new environment (see above)' \ - ; +MAIN() { + PROMPT 'choose an environment to copy' + TEMPLATE_ENV_NAME=$(SCWRYPTS__SELECT_ENV) + [ ! $TEMPLATE_ENV_NAME ] && ABORT + + STATUS "selected '$TEMPLATE_ENV_NAME'" + + PROMPT 'enter new environment name' + ENV_NAME=$(echo '' | FZF_HEAD 'new environment') + [ ! $ENV_NAME ] && ABORT + SCWRYPTS__GET_ENV_NAMES | grep -q $ENV_NAME && FAIL 1 "'$ENV_NAME' already exists" + + for GROUP in ${SCWRYPTS_GROUPS[@]} + do + TEMPLATE_ENV_FILE=$(SCWRYPTS__GET_ENV_FILE $TEMPLATE_ENV_NAME $GROUP 2>/dev/null) + ENV_FILE=$(SCWRYPTS__GET_ENV_FILE $ENV_NAME $GROUP 2>/dev/null) + + STATUS "creating environment '$ENV_NAME'" + cat "$TEMPLATE_ENV_FILE" \ + | sed 's/ # from.*//' \ + > "$ENV_FILE" \ + && SUCCESS "created '$ENV_FILE'" \ + || FAIL 2 "something went wrong creating '$ENV_FILE'" + done + + STATUS "synchronizing environments" + SCWRYPTS__RUN --name scwrypts/environment/synchronize --group scwrypts --type zsh -- --no-prompt \ + && SUCCESS "finished copy environment '$TEMPLATE_ENV_NAME > $ENV_NAME'" \ + || FAIL 3 'error during synchronization of new environment (see above)' \ + ; +} diff --git a/zsh/scwrypts/environment/delete b/zsh/scwrypts/environment/delete index bc64aa2..36c0620 100755 --- a/zsh/scwrypts/environment/delete +++ b/zsh/scwrypts/environment/delete @@ -1,36 +1,33 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use scwrypts/environment-files - -CHECK_ENVIRONMENT ##################################################################### -PROMPT 'choose an environment to delete' -ENV_NAME=$(SCWRYPTS__SELECT_ENV) -[ ! $ENV_NAME ] && ABORT - -ENV_FILES=($(SCWRYPTS__GET_ENV_FILES $ENV_NAME)) - -STATUS "preparing to remove '$ENV_NAME'" - -WARNING " - the '$ENV_NAME' environment will be removed configured options - and stored credentials will be lost forever: - - $(echo $ENV_FILES | sed 's| /|\n - /|g; s/^/ - /') - " - -yN 'continue?' || ABORT - -STATUS "removing environment" -for ENV_FILE in ${ENV_FILES[@]} -do - rm "$ENV_FILE" \ - && SUCCESS "removed '$ENV_FILE'" \ - || ERROR "unable to remove '$ENV_FILE'; is it protected?" \ - ; -done - -CHECK_ERRORS -n || FAIL 2 "some errors ocurred when cleaning up $ENV_NAME" +MAIN() { + PROMPT 'choose an environment to delete' + ENV_NAME=$(SCWRYPTS__SELECT_ENV) + [ ! $ENV_NAME ] && ABORT + + ENV_FILES=($(SCWRYPTS__GET_ENV_FILES $ENV_NAME)) + + STATUS "preparing to remove '$ENV_NAME'" + + WARNING " + the '$ENV_NAME' environment will be removed configured options + and stored credentials will be lost forever: + + $(echo $ENV_FILES | sed 's| /|\n - /|g; s/^/ - /') + " + + yN 'continue?' || ABORT + + STATUS "removing environment" + for ENV_FILE in ${ENV_FILES[@]} + do + rm "$ENV_FILE" \ + && SUCCESS "removed '$ENV_FILE'" \ + || ERROR "unable to remove '$ENV_FILE'; is it protected?" \ + ; + done + + CHECK_ERRORS -n || FAIL 2 "some errors ocurred when cleaning up $ENV_NAME" +} diff --git a/zsh/scwrypts/environment/edit b/zsh/scwrypts/environment/edit index 1e3d660..d8e7e66 100755 --- a/zsh/scwrypts/environment/edit +++ b/zsh/scwrypts/environment/edit @@ -1,45 +1,42 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use scwrypts/environment-files - -CHECK_ENVIRONMENT ##################################################################### -[ $1 ] && ENV_NAME="$1" - -[ ! $1 ] && { - [ $SCWRYPTS_ENV ] \ - && ENV_NAME=$SCWRYPTS_ENV \ - || ENV_NAME=$(SCWRYPTS__SELECT_OR_CREATE_ENV) -} -[ ! $ENV_NAME ] && ABORT - -ENV_FILES=($(SCWRYPTS__GET_ENV_FILES $ENV_NAME 2>/dev/null)) -for ENV_FILE in ${ENV_FILES[@]} -do - [ ! -f "$ENV_FILE" ] && { - STATUS "Creating '$ENV_FILE'..." \ - && mkdir -p "$(dirname "$ENV_FILE")" \ - && touch "$ENV_FILE" \ - && ((CREATED+=1)) \ - && SUCCESS "created '$ENV_NAME'" \ - || { ERROR "failed to create '$ENV_FILE'"; exit 1; } - } - - [ $CREATED ] && [[ $CREATED -gt 0 ]] && { - STATUS "detected new environment files; performing sync" \ - && SCWRYPTS__RUN --name scwrypts/environment/synchronize --group scwrypts --type zsh -- --no-prompt \ - || FAIL 1 "failure during sync for '$ENV_NAME'" \ +MAIN() { + [ $1 ] && ENV_NAME="$1" + + [ ! $1 ] && { + [ $SCWRYPTS_ENV ] \ + && ENV_NAME=$SCWRYPTS_ENV \ + || ENV_NAME=$(SCWRYPTS__SELECT_OR_CREATE_ENV) } + [ ! $ENV_NAME ] && ABORT + + ENV_FILES=($(SCWRYPTS__GET_ENV_FILES $ENV_NAME 2>/dev/null)) + for ENV_FILE in ${ENV_FILES[@]} + do + [ ! -f "$ENV_FILE" ] && { + STATUS "Creating '$ENV_FILE'..." \ + && mkdir -p "$(dirname "$ENV_FILE")" \ + && touch "$ENV_FILE" \ + && ((CREATED+=1)) \ + && SUCCESS "created '$ENV_NAME'" \ + || { ERROR "failed to create '$ENV_FILE'"; exit 1; } + } + + [ $CREATED ] && [[ $CREATED -gt 0 ]] && { + STATUS "detected new environment files; performing sync" \ + && SCWRYPTS__RUN --name scwrypts/environment/synchronize --group scwrypts --type zsh -- --no-prompt \ + || FAIL 1 "failure during sync for '$ENV_NAME'" \ + } + ; + done + + EDIT $ENV_FILES + + SCWRYPTS__RUN --name scwrypts/environment/synchronize --group scwrypts --type zsh -- --no-prompt \ + || FAIL 4 'failed to run environment sync' \ ; -done - -EDIT $ENV_FILES - -SCWRYPTS__RUN --name scwrypts/environment/synchronize --group scwrypts --type zsh -- --no-prompt \ - || FAIL 4 'failed to run environment sync' \ - ; - -SUCCESS "environment '$ENV_NAME' successfully modified" + + SUCCESS "environment '$ENV_NAME' successfully modified" +} diff --git a/zsh/scwrypts/environment/synchronize b/zsh/scwrypts/environment/synchronize index bea43d0..baeab1a 100755 --- a/zsh/scwrypts/environment/synchronize +++ b/zsh/scwrypts/environment/synchronize @@ -1,13 +1,8 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use scwrypts/environment-files - -CHECK_ENVIRONMENT ##################################################################### -SYNCHRONIZE() { +MAIN() { while [[ $# -gt 0 ]] do case $1 in @@ -176,4 +171,4 @@ CLEANUP_ENVIRONMENT_FILE() { } ##################################################################### -SYNCHRONIZE $@ +MAIN $@ diff --git a/zsh/scwrypts/logs/clear b/zsh/scwrypts/logs/clear index c9d0779..7de4f3c 100755 --- a/zsh/scwrypts/logs/clear +++ b/zsh/scwrypts/logs/clear @@ -1,22 +1,20 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - -CHECK_ENVIRONMENT ##################################################################### -cd $SCWRYPTS_ROOT - -STATUS "Found $(ls $SCWRYPTS_LOG_PATH | wc -l) log files" -WARNING " - this will permanently clear all local cloud script logs found in - '$SCWRYPTS_LOG_PATH' -" - -yN 'continue?' || ABORT - -STATUS 'removing logfiles' -rm -rf $SCWRYPTS_LOG_PATH/* \ - && SUCCESS 'done' \ - || { ERROR 'failed :c'; exit 2; }\ - ; +MAIN() { + cd $SCWRYPTS_ROOT + + STATUS "Found $(ls $SCWRYPTS_LOG_PATH | wc -l) log files" + WARNING " + this will permanently clear all local cloud script logs found in + '$SCWRYPTS_LOG_PATH' + " + + yN 'continue?' || ABORT + + STATUS 'removing logfiles' + rm -rf $SCWRYPTS_LOG_PATH/* \ + && SUCCESS 'done' \ + || { ERROR 'failed :c'; exit 2; }\ + ; +} diff --git a/zsh/scwrypts/logs/view b/zsh/scwrypts/logs/view index 5c83c53..f4a03a9 100755 --- a/zsh/scwrypts/logs/view +++ b/zsh/scwrypts/logs/view @@ -1,15 +1,13 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - -CHECK_ENVIRONMENT ##################################################################### -cd $SCWRYPTS_ROOT -PROMPT 'select a script log' -LOG_FILE=$(ls -t $SCWRYPTS_LOG_PATH | FZF 'logfile') -[ ! $LOG_FILE ] && { ERROR 'user abort'; exit 1; } - -STATUS 'opening logfile' -LESS "$SCWRYPTS_LOG_PATH/$LOG_FILE" -SUCCESS 'done' +MAIN() { + cd $SCWRYPTS_ROOT + PROMPT 'select a script log' + LOG_FILE=$(ls -t $SCWRYPTS_LOG_PATH | FZF 'logfile') + [ ! $LOG_FILE ] && { ERROR 'user abort'; exit 1; } + + STATUS 'opening logfile' + LESS "$SCWRYPTS_LOG_PATH/$LOG_FILE" + SUCCESS 'done' +} diff --git a/zsh/scwrypts/virtualenv/refresh b/zsh/scwrypts/virtualenv/refresh index 2bbc5cd..2a09161 100755 --- a/zsh/scwrypts/virtualenv/refresh +++ b/zsh/scwrypts/virtualenv/refresh @@ -1,30 +1,27 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use scwrypts/virtualenv - -CHECK_ENVIRONMENT ##################################################################### -while [[ $# -gt 0 ]] -do - case $1 in - -g | --group ) ENV_GROUP="$2"; shift 1 ;; - esac - shift 1 -done - -[ ! $ENV_GROUP ] && ENV_GROUP=scwrypts - -ENV_TYPE=$(echo $AVAILABLE_VIRTUALENVS | sed 's/ \+/\n/' | FZF 'select an environment to refresh') -[ ! $ENV_TYPE ] && ABORT - -REMINDER " - this will permanently remove all artifacts for the scwrypts $ENV_TYPE environment - (safe unless you have put something important in $(GET_VIRTUALENV_PATH $ENV_GROUP $ENV_TYPE)) - " - -Yn "drop and recreate $ENV_TYPE virtual environment?" || ABORT - -REFRESH_VIRTUALENV $ENV_GROUP $ENV_TYPE +MAIN() { + while [[ $# -gt 0 ]] + do + case $1 in + -g | --group ) ENV_GROUP="$2"; shift 1 ;; + esac + shift 1 + done + + [ ! $ENV_GROUP ] && ENV_GROUP=scwrypts + + ENV_TYPE=$(echo $AVAILABLE_VIRTUALENVS | sed 's/ \+/\n/' | FZF 'select an environment to refresh') + [ ! $ENV_TYPE ] && ABORT + + REMINDER " + this will permanently remove all artifacts for the scwrypts $ENV_TYPE environment + (safe unless you have put something important in $(GET_VIRTUALENV_PATH $ENV_GROUP $ENV_TYPE)) + " + + Yn "drop and recreate $ENV_TYPE virtual environment?" || ABORT + + REFRESH_VIRTUALENV $ENV_GROUP $ENV_TYPE +} diff --git a/zsh/scwrypts/virtualenv/update-all b/zsh/scwrypts/virtualenv/update-all index d6f7c03..af58960 100755 --- a/zsh/scwrypts/virtualenv/update-all +++ b/zsh/scwrypts/virtualenv/update-all @@ -1,25 +1,21 @@ #!/bin/zsh -echo hey -DEPENDENCIES+=() -REQUIRED_ENV+=() - use scwrypts/virtualenv - -CHECK_ENVIRONMENT ##################################################################### -STATUS 'beginning update for all environments' - -FAILED_COUNT=0 - -for ENV_GROUP in ${SCWRYPTS_GROUPS[@]} -do - for ENV_TYPE in ${AVAILABLE_VIRTUALENVS[@]} +MAIN() { + STATUS 'beginning update for all environments' + + FAILED_COUNT=0 + + for ENV_GROUP in ${SCWRYPTS_GROUPS[@]} do - UPDATE_VIRTUALENV $ENV_GROUP $ENV_TYPE || ((FAILED_COUNT+=1)) + for ENV_TYPE in ${AVAILABLE_VIRTUALENVS[@]} + do + UPDATE_VIRTUALENV $ENV_GROUP $ENV_TYPE || ((FAILED_COUNT+=1)) + done done -done - -[[ $FAILED_COUNT -eq 0 ]] \ - && SUCCESS 'all environments up-to-date' \ - || FAIL $FAILED_COUNT "failed to update $FAILED_COUNT more environment(s)" + + [[ $FAILED_COUNT -eq 0 ]] \ + && SUCCESS 'all environments up-to-date' \ + || FAIL $FAILED_COUNT "failed to update $FAILED_COUNT more environment(s)" +} diff --git a/zsh/system/config/settings b/zsh/system/config/settings index ce99066..9eebcbf 100755 --- a/zsh/system/config/settings +++ b/zsh/system/config/settings @@ -1,9 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use system/config - -CHECK_ENVIRONMENT ##################################################################### -EDIT "$CONFIG__USER_SETTINGS" + +MAIN() { + EDIT "$CONFIG__USER_SETTINGS" +} diff --git a/zsh/system/config/symlinks b/zsh/system/config/symlinks index be243d3..e358fdf 100755 --- a/zsh/system/config/symlinks +++ b/zsh/system/config/symlinks @@ -1,19 +1,16 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use system/config - -CHECK_ENVIRONMENT ##################################################################### -SETUP_SYMLINKS() { +MAIN() { while read SYMLINK do SETUP_SYMLINK $(echo $SYMLINK | awk '{print $1;}') $(echo $SYMLINK | awk '{print $2}') done < <(echo $SYMLINKS | sed -n '/^[^#]/p') } +##################################################################### + SETUP_SYMLINK() { [ ! $2 ] && FAIL 1 'must provide SOURCE_CONFIG and TARGET_CONFIG' @@ -42,6 +39,3 @@ SETUP_SYMLINK() { || FAIL 3 "failed to create link '$TARGET_CONFIG'" \ ; } - -##################################################################### -SETUP_SYMLINKS $@ diff --git a/zsh/system/config/terminfo b/zsh/system/config/terminfo index 6f35186..119c871 100755 --- a/zsh/system/config/terminfo +++ b/zsh/system/config/terminfo @@ -1,13 +1,10 @@ #!/bin/zsh DEPENDENCIES+=(tic) -REQUIRED_ENV+=() use system/config - -CHECK_ENVIRONMENT ##################################################################### -SETUP_TERMINFO() { +MAIN() { [ ! $TERMINFO_PATH ] && return 0 [ ! -d $TERMINFO_PATH ] && FAIL 1 "TERMINFO_PATH='$TERMINFO_PATH' does not exist" @@ -22,6 +19,3 @@ SETUP_TERMINFO() { CHECK_ERRORS } - -##################################################################### -SETUP_TERMINFO $@ diff --git a/zsh/system/config/update b/zsh/system/config/update index dcef326..5976380 100755 --- a/zsh/system/config/update +++ b/zsh/system/config/update @@ -1,13 +1,10 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use scwrypts/meta - -CHECK_ENVIRONMENT ##################################################################### -STATUS 'updating all config files and links' -SCWRYPTS__RUN --name system/config/symlinks --group scwrypts --type zsh || exit 1 -SCWRYPTS__RUN --name system/config/terminfo --group scwrypts --type zsh || exit 2 -SUCCESS 'finished updating config files and links' +MAIN() { + STATUS 'updating all config files and links' + SCWRYPTS__RUN --name system/config/symlinks --group scwrypts --type zsh || exit 1 + SCWRYPTS__RUN --name system/config/terminfo --group scwrypts --type zsh || exit 2 + SUCCESS 'finished updating config files and links' +} diff --git a/zsh/system/packages/build b/zsh/system/packages/build index 52547f5..470ae87 100755 --- a/zsh/system/packages/build +++ b/zsh/system/packages/build @@ -1,9 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use scwrypts/meta - -CHECK_ENVIRONMENT ##################################################################### -SCWRYPTS__RUN --name system/packages/install --group scwrypts --type zsh -- --only-build $@ + +MAIN() { + SCWRYPTS__RUN --name system/packages/install --group scwrypts --type zsh -- --only-build $@ +} diff --git a/zsh/system/packages/download b/zsh/system/packages/download index 30f58af..87bb3f9 100755 --- a/zsh/system/packages/download +++ b/zsh/system/packages/download @@ -1,9 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use scwrypts/meta - -CHECK_ENVIRONMENT ##################################################################### -SCWRYPTS__RUN --name system/packages/install --group scwrypts --type zsh -- --only-pull $@ + +MAIN() { + SCWRYPTS__RUN --name system/packages/install --group scwrypts --type zsh -- --only-pull $@ +} diff --git a/zsh/system/packages/install b/zsh/system/packages/install index 4abe529..3e5ca77 100755 --- a/zsh/system/packages/install +++ b/zsh/system/packages/install @@ -1,13 +1,8 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use system/packages/git - -CHECK_ENVIRONMENT ##################################################################### -INSTALL() { +MAIN() { local USAGE=" usage: [...options...] @@ -86,6 +81,3 @@ INSTALL() { [[ $SKIP_BUILD -eq 1 ]] && return 0 BUILD } - -##################################################################### -INSTALL $@ diff --git a/zsh/system/packages/update b/zsh/system/packages/update index 709d7cb..c5c7a1f 100755 --- a/zsh/system/packages/update +++ b/zsh/system/packages/update @@ -1,9 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use scwrypts/meta - -CHECK_ENVIRONMENT ##################################################################### -SCWRYPTS__RUN --name system/packages/install --group scwrypts --type zsh -- --update $@ + +MAIN() { + SCWRYPTS__RUN --name system/packages/install --group scwrypts --type zsh -- --update $@ +} diff --git a/zsh/system/vim/vundle/edit-build-actions b/zsh/system/vim/vundle/edit-build-actions index f2a0a9a..d76c3f4 100755 --- a/zsh/system/vim/vundle/edit-build-actions +++ b/zsh/system/vim/vundle/edit-build-actions @@ -1,9 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use system/vim/vundle - -CHECK_ENVIRONMENT ##################################################################### -EDIT "$VUNDLE__BUILD_DEFINITIONS" + +MAIN() { + EDIT "$VUNDLE__BUILD_DEFINITIONS" +} diff --git a/zsh/system/vim/vundle/install b/zsh/system/vim/vundle/install index 94e0775..f382baa 100755 --- a/zsh/system/vim/vundle/install +++ b/zsh/system/vim/vundle/install @@ -1,13 +1,8 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use system/vim/vundle - -CHECK_ENVIRONMENT ##################################################################### -PLUGIN_INSTALL() { +MAIN() { [ -d "$HOME/.vim/bundle/Vundle.vim" ] || { mkdir -p "$HOME/.vim/bundle/" git clone https://github.com/VundleVim/Vundle.vim.git "$HOME/.vim/bundle/Vundle.vim" @@ -16,6 +11,3 @@ PLUGIN_INSTALL() { VUNDLE__PLUGIN_INSTALL || return 1 VUNDLE__REBUILD_PLUGINS || return 2 } - -##################################################################### -PLUGIN_INSTALL $@ diff --git a/zsh/system/vim/vundle/rebuild b/zsh/system/vim/vundle/rebuild index 210ad6e..a8689bb 100755 --- a/zsh/system/vim/vundle/rebuild +++ b/zsh/system/vim/vundle/rebuild @@ -1,9 +1,7 @@ #!/bin/zsh -DEPENDENCIES+=() -REQUIRED_ENV+=() - use system/vim/vundle - -CHECK_ENVIRONMENT ##################################################################### -VUNDLE__REBUILD_PLUGINS $@ + +MAIN() { + VUNDLE__REBUILD_PLUGINS $@ +}