unified sed multiline

This commit is contained in:
Wryn Wagner 2021-09-21 10:21:06 -06:00
parent a664016232
commit ba53bbffc2
2 changed files with 9 additions and 7 deletions

View File

@ -107,12 +107,12 @@ _CA__ERROR_CLEANUP() {
[[ $CODE_ACTIVATOR__DISABLE_SHORTCUT -eq 0 ]] && { [[ $CODE_ACTIVATOR__DISABLE_SHORTCUT -eq 0 ]] && {
_CA__ZSH_SHORTCUT_PLUGIN() { _CA__ZSH_SHORTCUT_PLUGIN() {
local OPTIONS=$(_CA__GET_COMMANDS_AND_PROJECTS | sed 's/\s\+/\n/g') local OPTIONS=$(_CA__GET_COMMANDS_AND_PROJECTS | _CA__SED_MULTILINE)
[ ! $__CUSTOM_ENV_ACTIVE ] && OPTIONS=$(echo $OPTIONS | grep -v 'deactivate') [ ! $__CUSTOM_ENV_ACTIVE ] && OPTIONS=$(echo $OPTIONS | grep -v 'deactivate')
local ARGUMENT=$(\ local ARGUMENT=$(\
echo $OPTIONS \ echo $OPTIONS \
| sed 's/\s\+/\n/g' \ | _CA__SED_MULTILINE \
| $_CA__FZF --prompt 'select a project: ' \ | $_CA__FZF --prompt 'select a project: ' \
) )

View File

@ -22,7 +22,7 @@ _CA__GET_FULL_PATH() {
local FULL_BASE_DIR=$(\ local FULL_BASE_DIR=$(\
echo $CODE_ACTIVATOR__DIRS \ echo $CODE_ACTIVATOR__DIRS \
| sed 's/\s\+/\n/g' \ | _CA__SED_MULTILINE \
| grep "^.*/$PROJECT_ROOT_SHORT$" \ | grep "^.*/$PROJECT_ROOT_SHORT$" \
) )
@ -44,17 +44,17 @@ _CA__SELECT_BASE_DIR() {
BASE_NAMES=($BASE_NAMES $(basename $dir)) BASE_NAMES=($BASE_NAMES $(basename $dir))
done done
echo $CODE_ACTIVATOR__DIRS | sed 's/\s\+/\n/g' \ echo $CODE_ACTIVATOR__DIRS | _CA__SED_MULTILINE \
| grep $(\ | grep $(\
echo $BASE_NAMES \ echo $BASE_NAMES \
| sed 's/\s\+/\n/g' \ | _CA__SED_MULTILINE \
| $_CA__FZF --prompt 'select base directory : ') | $_CA__FZF --prompt 'select base directory : ')
} }
_CA__GET_REMOTE_TARGET() { _CA__GET_REMOTE_TARGET() {
local REMOTE_TARGET=$(\ local REMOTE_TARGET=$(\
echo $CODE_ACTIVATOR__KNOWN_TARGETS \ echo $CODE_ACTIVATOR__KNOWN_TARGETS \
| sed 's/\s\+/\n/g' \ | _CA__SED_MULTILINE \
| $_CA__FZF --print-query --prompt 'set a remote target : ' \ | $_CA__FZF --print-query --prompt 'set a remote target : ' \
| tail -1 \ | tail -1 \
) )
@ -107,7 +107,7 @@ _CA__SELECT_VIRTUAL_ENV() {
VERSION=$(\ VERSION=$(\
nodeenv --list 2>&1 \ nodeenv --list 2>&1 \
| sed 's/\s\+/\n/g' \ | _CA__SED_MULTILINE \
| $_CA__FZF --prompt 'select a node version : '\ | $_CA__FZF --prompt 'select a node version : '\
) )
@ -159,6 +159,8 @@ _CA__INIT_CUSTOM_ENV() {
cp $CUSTOM_ENV_TEMPLATE $CUSTOM_ENV cp $CUSTOM_ENV_TEMPLATE $CUSTOM_ENV
} }
_CA__SED_MULTILINE() { sed 's/\s\+/\n/g'; }
##################################################################### #####################################################################
export _CA__HELPERS_LOADED=1 export _CA__HELPERS_LOADED=1