Compare commits
1 Commits
yage/dev/v
...
v4.4.0
Author | SHA1 | Date | |
---|---|---|---|
3fe01a7263 |
@ -1,3 +1,12 @@
|
|||||||
|
#
|
||||||
|
# typically you do not need to reload this plugin in a single session;
|
||||||
|
# if for some reason you do, you can run the following command and
|
||||||
|
# source this file again
|
||||||
|
#
|
||||||
|
# unset __SCWRYPTS_PLUGIN_LOADED
|
||||||
|
#
|
||||||
|
[[ $__SCWRYPTS_PLUGIN_LOADED =~ true ]] && return 0
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
: \
|
: \
|
||||||
@ -22,59 +31,67 @@ __SCWRYPTS_PARSE() {
|
|||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
SCWRYPTS__ZSH_PLUGIN() {
|
[ $SCWRYPTS_SHORTCUT ] && {
|
||||||
local SCWRYPT_SELECTION NAME TYPE GROUP
|
SCWRYPTS__ZSH_PLUGIN() {
|
||||||
__SCWRYPTS_PARSE || { zle accept-line; return 0; }
|
local SCWRYPT_SELECTION NAME TYPE GROUP
|
||||||
|
__SCWRYPTS_PARSE || { zle accept-line; return 0; }
|
||||||
|
|
||||||
RBUFFER="scwrypts --name $NAME --type $TYPE --group $GROUP"
|
RBUFFER="scwrypts --name $NAME --type $TYPE --group $GROUP"
|
||||||
zle accept-line
|
|
||||||
}
|
|
||||||
|
|
||||||
zle -N scwrypts SCWRYPTS__ZSH_PLUGIN
|
|
||||||
bindkey $SCWRYPTS_SHORTCUT scwrypts
|
|
||||||
unset SCWRYPTS_SHORTCUT
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
SCWRYPTS__ZSH_BUILDER_PLUGIN() {
|
|
||||||
local SCWRYPT_SELECTION NAME TYPE GROUP
|
|
||||||
__SCWRYPTS_PARSE || { echo >&2; zle accept-line; return 0; }
|
|
||||||
echo $SCWRYPT_SELECTION >&2
|
|
||||||
|
|
||||||
scwrypts -n --name $NAME --group $GROUP --type $TYPE -- --help >&2 || {
|
|
||||||
zle accept-line
|
zle accept-line
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
echo
|
|
||||||
|
|
||||||
zle reset-prompt
|
zle -N scwrypts SCWRYPTS__ZSH_PLUGIN
|
||||||
LBUFFER="scwrypts --name $NAME --type $TYPE --group $GROUP -- "
|
bindkey $SCWRYPTS_SHORTCUT scwrypts
|
||||||
|
unset SCWRYPTS_SHORTCUT
|
||||||
}
|
}
|
||||||
|
|
||||||
zle -N scwrypts-builder SCWRYPTS__ZSH_BUILDER_PLUGIN
|
|
||||||
bindkey $SCWRYPTS_BUILDER_SHORTCUT scwrypts-builder
|
|
||||||
unset SCWRYPTS_BUILDER_SHORTCUT
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
SCWRYPTS__ZSH_PLUGIN_ENV() {
|
[ $SCWRYPTS_BUILDER_SHORTCUT ] && {
|
||||||
local RESET='reset'
|
SCWRYPTS__ZSH_BUILDER_PLUGIN() {
|
||||||
local SELECTED=$(\
|
local SCWRYPT_SELECTION NAME TYPE GROUP
|
||||||
{ [ $SCWRYPTS_ENV ] && echo $RESET; scwrypts --list-envs; } \
|
__SCWRYPTS_PARSE || { echo >&2; zle accept-line; return 0; }
|
||||||
| fzf --prompt 'select an environment : ' \
|
echo $SCWRYPT_SELECTION >&2
|
||||||
)
|
|
||||||
|
|
||||||
zle clear-command-line
|
scwrypts -n --name $NAME --group $GROUP --type $TYPE -- --help >&2 || {
|
||||||
[ $SELECTED ] && {
|
zle accept-line
|
||||||
[[ $SELECTED =~ ^$RESET$ ]] \
|
return 0
|
||||||
&& RBUFFER='unset SCWRYPTS_ENV' \
|
}
|
||||||
|| RBUFFER="export SCWRYPTS_ENV=$SELECTED"
|
echo
|
||||||
|
|
||||||
|
zle reset-prompt
|
||||||
|
LBUFFER="scwrypts --name $NAME --type $TYPE --group $GROUP -- "
|
||||||
}
|
}
|
||||||
zle accept-line
|
|
||||||
|
zle -N scwrypts-builder SCWRYPTS__ZSH_BUILDER_PLUGIN
|
||||||
|
bindkey $SCWRYPTS_BUILDER_SHORTCUT scwrypts-builder
|
||||||
|
unset SCWRYPTS_BUILDER_SHORTCUT
|
||||||
}
|
}
|
||||||
|
|
||||||
zle -N scwrypts-setenv SCWRYPTS__ZSH_PLUGIN_ENV
|
#####################################################################
|
||||||
bindkey $SCWRYPTS_ENV_SHORTCUT scwrypts-setenv
|
|
||||||
unset SCWRYPTS_ENV_SHORTCUT
|
[ $SCWRYPTS_ENV_SHORTCUT ] && {
|
||||||
|
SCWRYPTS__ZSH_PLUGIN_ENV() {
|
||||||
|
local RESET='reset'
|
||||||
|
local SELECTED=$(\
|
||||||
|
{ [ $SCWRYPTS_ENV ] && echo $RESET; scwrypts --list-envs; } \
|
||||||
|
| fzf --prompt 'select an environment : ' \
|
||||||
|
)
|
||||||
|
|
||||||
|
zle clear-command-line
|
||||||
|
[ $SELECTED ] && {
|
||||||
|
[[ $SELECTED =~ ^$RESET$ ]] \
|
||||||
|
&& RBUFFER='unset SCWRYPTS_ENV' \
|
||||||
|
|| RBUFFER="export SCWRYPTS_ENV=$SELECTED"
|
||||||
|
}
|
||||||
|
zle accept-line
|
||||||
|
}
|
||||||
|
|
||||||
|
zle -N scwrypts-setenv SCWRYPTS__ZSH_PLUGIN_ENV
|
||||||
|
bindkey $SCWRYPTS_ENV_SHORTCUT scwrypts-setenv
|
||||||
|
unset SCWRYPTS_ENV_SHORTCUT
|
||||||
|
}
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
|
__SCWRYPTS_PLUGIN_LOADED=true
|
||||||
|
@ -25,7 +25,7 @@ export SCWRYPTS_ROOT__scwrypts="$SCWRYPTS_ROOT"
|
|||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
DEFAULT_CONFIG="$SCWRYPTS_ROOT/zsh/lib/config.user.zsh"
|
DEFAULT_CONFIG="$SCWRYPTS_ROOT__scwrypts/zsh/lib/config.user.zsh"
|
||||||
source "$DEFAULT_CONFIG"
|
source "$DEFAULT_CONFIG"
|
||||||
|
|
||||||
USER_CONFIG_OVERRIDES="$SCWRYPTS_CONFIG_PATH/config.zsh"
|
USER_CONFIG_OVERRIDES="$SCWRYPTS_CONFIG_PATH/config.zsh"
|
||||||
|
@ -12,7 +12,10 @@ SCWRYPTS__RUN() { # context wrapper to run scwrypts within scwrypts
|
|||||||
local EXIT_CODE=0
|
local EXIT_CODE=0
|
||||||
((SUBSCWRYPT+=1))
|
((SUBSCWRYPT+=1))
|
||||||
|
|
||||||
SUBSCWRYPT=$SUBSCWRYPT $SCWRYPTS_ROOT/scwrypts $@
|
SCWRYPTS_LOG_LEVEL=$SCWRYPTS_LOG_LEVEL \
|
||||||
|
SUBSCWRYPT=$SUBSCWRYPT \
|
||||||
|
$SCWRYPTS_ROOT__scwrypts/scwrypts $@
|
||||||
|
|
||||||
EXIT_CODE=$?
|
EXIT_CODE=$?
|
||||||
|
|
||||||
((SUBSCWRYPT-=1))
|
((SUBSCWRYPT-=1))
|
||||||
|
@ -94,7 +94,7 @@ SCWRYPTS__GET_RUNSTRING() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RUNSTRING="SCWRYPTS_ENV=$ENV_NAME; $RUNSTRING"
|
RUNSTRING="SCWRYPTS_ENV=$ENV_NAME; $RUNSTRING"
|
||||||
RUNSTRING="source $SCWRYPTS_ROOT/zsh/lib/import.driver.zsh; $RUNSTRING"
|
RUNSTRING="source $SCWRYPTS_ROOT__scwrypts/zsh/lib/import.driver.zsh; $RUNSTRING"
|
||||||
|
|
||||||
local _VIRTUALENV=$(eval echo '$SCWRYPTS_VIRTUALENV_PATH__'$SCWRYPT_GROUP'/$SCWRYPT_TYPE/bin/activate')
|
local _VIRTUALENV=$(eval echo '$SCWRYPTS_VIRTUALENV_PATH__'$SCWRYPT_GROUP'/$SCWRYPT_TYPE/bin/activate')
|
||||||
[ -f $_VIRTUALENV ] && RUNSTRING="source $_VIRTUALENV; $RUNSTRING"
|
[ -f $_VIRTUALENV ] && RUNSTRING="source $_VIRTUALENV; $RUNSTRING"
|
||||||
|
@ -124,7 +124,7 @@ UPDATE_VIRTUALENV__scwrypts__py() {
|
|||||||
PIP_INSTALL_ARGS+=(--no-cache-dir)
|
PIP_INSTALL_ARGS+=(--no-cache-dir)
|
||||||
PIP_INSTALL_ARGS+=(-r requirements.txt)
|
PIP_INSTALL_ARGS+=(-r requirements.txt)
|
||||||
|
|
||||||
cd "$SCWRYPTS_ROOT/py"
|
cd "$SCWRYPTS_ROOT__scwrypts/py"
|
||||||
pip install ${PIP_INSTALL_ARGS[@]}
|
pip install ${PIP_INSTALL_ARGS[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ ACTIVATE_VIRTUALENV__scwrypts__zx() {
|
|||||||
UPDATE_VIRTUALENV__scwrypts__zx() {
|
UPDATE_VIRTUALENV__scwrypts__zx() {
|
||||||
local NPM_INSTALL_ARGS=()
|
local NPM_INSTALL_ARGS=()
|
||||||
|
|
||||||
cd "$SCWRYPTS_ROOT/zx"
|
cd "$SCWRYPTS_ROOT__scwrypts/zx"
|
||||||
npm install ${NPM_INSTALL_ARGS[@]}
|
npm install ${NPM_INSTALL_ARGS[@]}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user