1
1
#! /usr/bin/env bash
2
- # :: nx 1.0.3 ::
2
+ # :: nx 1.0.4 ::
3
3
# shellcheck disable=SC2139 # shellcheck.net/wiki/SC2139 # allow parameter expansion within alias strings #
4
4
function nx() ( local pkg=" " cmd=" " npmcmds=" "
5
5
npmcmds=" $( npm -h | awk ' /access/,/whoami/' | sed -E ' s/ (help|start|test),//g' | xargs | sed ' s/, /|/g' ) " || true
@@ -17,9 +17,11 @@ function nx() ( local pkg="" cmd="" npmcmds=""
17
17
done
18
18
# :: call "nvm use" automatically before running commands :: to enable auto-nvm behavior, export NX_NVM=1; source "$HOME/nx/nx.sh" ::
19
19
[[ " ${NX_NVM} " =~ ^(1| true| TRUE)$ ]] && nvm use & > /dev/null
20
- # :: await confirmation of current node+npm versions before executing command :: to enable await-confirm behavior, export NX_CONFIRM=1; source "$HOME/nx/nx.sh" ::
20
+ # :: await confirmation of current node+npm versions before executing command :: to enable await-confirm behavior, export NX_CONFIRM=1 source "$HOME/nx/nx.sh" ::
21
21
if [[ " ${NX_CONFIRM} " =~ ^(1| true| TRUE)$ ]]; then
22
22
read -rsn1 -p " ${cmd[*]} ${* } " $' \n ' " ${cmd[*]// ?/ ˙} ${*// ?/ ˙} " $' \n ' " Press any key to run · CTRL+C to cancel · node $( node -v ) · npm $( npm -v ) " $' \n\n '
23
+ elif ! [[ " ${NX_QUIET} " =~ ^(1| true| TRUE)$ ]]; then
24
+ echo " ${cmd[*]} ${* } " $' \n ' " ${cmd[*]// ?/ ˙} ${*// ?/ ˙} " $' \n ' " node $( node -v | tr -d ' v' ) · npm $( npm -v | tr -d ' v' ) " $' \n\n '
23
25
fi
24
26
if (( $# )) ; then
25
27
" ${cmd[@]} " " ${@ } " # :: execute npm command with additional args::
@@ -33,7 +35,7 @@ function nx() ( local pkg="" cmd="" npmcmds=""
33
35
# ns -> npm start nk -> npm link ni -> npm install nu -> npm uninstall nis, nid, nus, nud -> npm [un]install --save[-dev]
34
36
if ! [[ " ${NX_ALIASES} " =~ ^(0| false| FALSE)$ ]]; then
35
37
alias " ${NX_COMMAND:- n} " =' nx'
36
- for word in $( tr -cs ' [:alnum:]._-/' ' ' <<< " ${NX_ALIASES:-install,uninstall,start,test,build,format,lint,k/link,publish,help}" ) ; do
38
+ for word in $( tr -cs ' [:alnum:]._-/' ' ' <<< " ${NX_ALIASES:-install,uninstall,start,test,build,format,lint,k/link,publish,help},${NX_EXTEND_ALIASES:-} " ) ; do
37
39
[[ " ${NX_COMMAND} " =~ ^(0| false| FALSE)$ ]] && NX_COMMAND=' nx'
38
40
alias " ${NX_COMMAND:- n}${word: 0: 1} " =" nx ${word# [a-z]/ } " ; [[ -n " ${NX_VERBOSE} " ]] && alias " ${NX_COMMAND:- n}${word: 0: 1} "
39
41
if [[ " ${word} " =~ ^(un)? install$ ]]; then
0 commit comments