diff --git a/.za-bgn-bin-or-src-function-body b/.za-bgn-bin-or-src-function-body index afa8fe5..66c3e39 100644 --- a/.za-bgn-bin-or-src-function-body +++ b/.za-bgn-bin-or-src-function-body @@ -6,8 +6,8 @@ local name="$2" bin="$3" dir="${4#%}" integer run_type="$1" set_gem_home="$5" \ - set_node_path="$6" set_cwd="$7" \ - use_all_null="$8" use_err_null="$9" use_out_null="$10" + set_node_path="$6" set_virtualenv="$7" set_cwd="$8" \ + use_all_null="$9" use_err_null="$10" use_out_null="$11" local nl=$'\n' tab=$' ' @@ -15,7 +15,8 @@ REPLY="function ${(q)name} { local bindir=${(qqq)bin:h} ${${(M)set_gem_home:#1}:+local -x GEM_HOME=${(qqq)dir}} ${${(M)set_node_path:#1}:+local -x NODE_PATH=${(qqq)dir}/node_modules} - local -xU PATH=${${(M)set_node_path:#1}:+${(qqq)dir}/node_modules/.bin:}${${(M)set_gem_home:#1}:+${(qqq)dir}/bin:}\"\$bindir\":\"\$PATH\" + ${${(M)set_virtualenv:#1}:+local -x VIRTUALENV=${(qqq)dir}/venv} + local -xU PATH=${${(M)set_virtualenv:#1}:+${(qqq)dir}/venv/bin:}${${(M)set_node_path:#1}:+${(qqq)dir}/node_modules/.bin:}${${(M)set_gem_home:#1}:+${(qqq)dir}/bin:}\"\$bindir\":\"\$PATH\" ${${(M)set_cwd:#1}:+"local oldpwd=${(qqq)PWD} () { setopt localoptions noautopushd; builtin cd -q ${(qqq)dir}; }"} " diff --git a/.za-bgn-bin-or-src-function-body-cygwin b/.za-bgn-bin-or-src-function-body-cygwin index a0576ba..09b39be 100644 --- a/.za-bgn-bin-or-src-function-body-cygwin +++ b/.za-bgn-bin-or-src-function-body-cygwin @@ -6,8 +6,8 @@ local name="$2" bin="$3" dir="${4#%}" integer run_type="$1" set_gem_home="$5" \ - set_node_path="$6" set_cwd="$7" \ - use_all_null="$8" use_err_null="$9" use_out_null="$10" + set_node_path="$6" set_virtualenv="$7" set_cwd="$8" \ + use_all_null="$9" use_err_null="$10" use_out_null="$11" local nl=$'\n' tab=$' ' @@ -19,7 +19,8 @@ REPLY=" set bindir=${binh} ${${(M)set_gem_home:#1}:+set GEM_HOME=${dir}} ${${(M)set_node_path:#1}:+set NODE_PATH=${dir}\\node_modules} -set PATH=${${(M)set_node_path:#1}:+${dir}\node_modules\.bin;}${${(M)set_gem_home:#1}:+${dir}\\bin;}%bindir%;%PATH% +${${(M)set_virtualenv:#1}:+set VIRTUALENV=${dir}\\venv} +set PATH=${${(M)set_node_path:#1}:+${dir}\node_modules\.bin;}${${(M)set_virtualenv:#1}:+${dir}\venv\bin;}${${(M)set_gem_home:#1}:+${dir}\\bin;}%bindir%;%PATH% ${${(M)set_cwd:#1}:+"set oldpwd=%cd% cd ${dir}"} " diff --git a/.za-bgn-mod-function-body b/.za-bgn-mod-function-body index a0e6956..27d6093 100644 --- a/.za-bgn-mod-function-body +++ b/.za-bgn-mod-function-body @@ -4,8 +4,8 @@ # Returns the body of the function wrapping a function local name="$1" target_func="$2" dir="${3#%}" -integer set_gem_home="$4" set_node_path="$5" set_cwd="$6" \ - use_all_null="$7" use_err_null="$8" use_out_null="$9" +integer set_gem_home="$4" set_node_path="$5" set_virtualenv="$6" set_cwd="$7" \ + use_all_null="$8" use_err_null="$9" use_out_null="$10" if [[ "$name" = "$target_func" ]]; then target_func="${target_func}--za-bgn-orig" @@ -15,6 +15,7 @@ fi REPLY="function $name { ${${(M)set_gem_home:#1}:+local -x GEM_HOME=${(qqq)dir}} ${${(M)set_node_path:#1}:+local -x NODE_PATH=${(qqq)dir}/node_modules} +${${(M)set_virtualenv:#1}:+local -x VIRTUALENV=${(qqq)dir}/venv} ${${(M)set_cwd:#1}:+"local oldpwd=${(qqq)PWD} () { setopt localoptions noautopushd; builtin cd -q ${(qqq)dir}; }"} ${(qqq)target_func} \"\$@\"" diff --git a/README.md b/README.md index cb20363..5fae5d1 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,13 @@ - [    **`gem'[{path-to-binary} <-] !{gem-name} [-> {name-of-the-function}]; …'`**](#nbspnbspnbsp-gempath-to-binary---gem-name---name-of-the-function-) - [3. **`node'{node-module}; …'`**](#3-nodenode-module-) - [    **`node'[{path-to-binary} <-] !{node-module} [-> {name-of-the-function}]; …'`**](#nbspnbspnbsp-nodepath-to-binary---node-module---name-of-the-function-) - - [4. **`fmod'[{g|n|c|N|E|O}:]{function-name}; …'`**](#4-fmodgncneofunction-name-) + - [4. **`pip'{pip-package}; …'`**](#3-pippip-package-) + - [    **`pip'[{path-to-binary} <-] !{pip-package} [-> {name-of-the-function}]; …'`**](#nbspnbspnbsp-pippath-to-binary---pip-package---name-of-the-function-) + - [5. **`fmod'[{g|n|c|N|E|O}:]{function-name}; …'`**](#4-fmodgncneofunction-name-) - [    **`fmod'[{g|n|c|N|E|O}:]{function-name} -> {wrapping-function-name}; …'`**](#nbspnbspnbsp-fmodgncneofunction-name---wrapping-function-name-) - - [5. **`sbin'[{g|n|c|N|E|O}:]{path-to-binary}[ -> {name-of-the-script}]; …'`**](#5-sbingncneopath-to-binary---name-of-the-script-) - - [6. **`fsrc'[{g|n|c|N|E|O}:]{path-to-script}[ -> {name-of-the-function}]; …'`**](#6-fsrcgncneopath-to-script---name-of-the-function-) - - [7. **`ferc'[{g|n|c|N|E|O}:]{path-to-script}[ -> {name-of-the-function}]; …'`**](#7-fercgncneopath-to-script---name-of-the-function-) + - [6. **`sbin'[{g|n|c|N|E|O}:]{path-to-binary}[ -> {name-of-the-script}]; …'`**](#5-sbingncneopath-to-binary---name-of-the-script-) + - [7. **`fsrc'[{g|n|c|N|E|O}:]{path-to-script}[ -> {name-of-the-function}]; …'`**](#6-fsrcgncneopath-to-script---name-of-the-function-) + - [8. **`ferc'[{g|n|c|N|E|O}:]{path-to-script}[ -> {name-of-the-function}]; …'`**](#7-fercgncneopath-to-script---name-of-the-function-) - [Additional Zinit commands](#additional-zinit-commands) - [Cygwin support](#cygwin-support) @@ -31,18 +33,20 @@ A Zsh-Zinit annex (i.e. an extension) that provides functionality, which allows to: 1. Run programs and scripts without adding anything to `$PATH`, - 2. Install and run Ruby [gems](https://github.com/rubygems/rubygems) and - [Node](https://github.com/npm/cli) modules from within a local directory - with + 2. Install and run Ruby [gems](https://github.com/rubygems/rubygems), + [Node](https://github.com/npm/cli) and [Python](https://python.org) + modules from within a local directory with [$GEM_HOME](https://guides.rubygems.org/command-reference/#gem-environment) - and + , [$NODE_PATH](https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders) + and + [$VIRTUALENV](https://docs.python.org/3/tutorial/venv.html) automatically set, 3. Run programs, scripts and functions with automatic `cd` into the plugin or snippet directory, plus also with automatic standard output & standard error redirecting. 4. Source scripts through an automatically created function with the above - `$GEM_HOME`, `$NODE_PATH` and `cd` features available, + `$GEM_HOME`, `$NODE_PATH`, `$VIRTUALENV` and `cd` features available, 5. Create the so called `shims` known from [rbenv](https://github.com/rbenv/rbenv) – the same feature as the first item of this enumaration – of running a program without adding anything @@ -83,7 +87,7 @@ will automatically create a function that will wrap the binary and provide it on the command line like if it was being placed in the `$PATH`. Also, like mentioned in the enumeration, the function can automatically -export `$GEM_HOME`, `$NODE_PATH` shell variables and also automatically cd +export `$GEM_HOME`, `$NODE_PATH`, `$VIRTUALENV` shell variables and also automatically cd into the plugin or snippet directory right before executing the binary and then cd back to the original directory after the execution is finished. @@ -150,9 +154,11 @@ There are 7 ice-modifiers provided and handled by the annex. They are: binaries. 4. `node''` – installs and updates node_modules + creates functions for binaries of the modules. - 5. `fmod''` – creates wrapping functions for other functions. - 6. `fsrc''` – creates functions that source given scripts. - 7. `ferc''` – the same as `fsrc''`, but using an alternate script-loading + 5. `pip''` – installs and updates python packages into a virtualenv + creates + functions for binaries of the packages. + 6. `fmod''` – creates wrapping functions for other functions. + 7. `fsrc''` – creates functions that source given scripts. + 8. `ferc''` – the same as `fsrc''`, but using an alternate script-loading method. **The ice-modifiers in detail:** @@ -208,6 +214,7 @@ path or as `{name-of-the-function}`. The optional preceding flags mean: - `g` – set `$GEM_HOME` variable to `{plugin-dir}`, - `n` – set `$NODE_PATH` variable to `{plugin-dir}/node_modules`, + - `p` – set `$VIRTUALENV` variable to `{plugin-dir}/venv`, - `c` – cd to the plugin's directory before running the program and then cd back after it has been run, - `N` – append `&>/dev/null` to the call of the binary, i.e. redirect both @@ -300,7 +307,41 @@ has been used. --- -## 4. **`fmod'[{g|n|c|N|E|O}:]{function-name}; …'`** +## 4. **`pip'{pip-package}; …'`** +##     **`node'[{path-to-binary} <-] !{pip-package} [-> {name-of-the-function}]; …'`** + +Installs the node module of name `{pip-package}` inside the plugin's or +snippet's directory. + +In the second form it also creates a wrapper function identical to the one +created with `fbin''` ice. + +Example: + +```zsh +% zinit delete zdharma/null +Delete /home/sg/.zinit/plugins/zdharma---null? +[yY/n…] +y +Done (action executed, exit code: 0) +% zinit ice node'ansible <- !ansible -> ansible; ansible-lint' +% zinit load zdharma/null +…installation messages… +% which remark +ansible () { + local bindir="/home/sg/.zinit/plugins/zdharma---null/venv/bin" + local -x VIRTUALENV="/home/sg/.zinit/plugins/zdharma---null"/venv + "$bindir"/"ansible" "$@" +} +``` + +In this case the name of the binary program provided by the node module is +different from its name, hence the second form with the `b <- a -> c` syntax +has been used. + +--- + +## 5. **`fmod'[{g|n|c|N|E|O}:]{function-name}; …'`** ##     **`fmod'[{g|n|c|N|E|O}:]{function-name} -> {wrapping-function-name}; …'`** It wraps given function with the ability to set `$GEM_HOME`, etc. – the @@ -335,8 +376,8 @@ README.md --- -## 6. **`fsrc'[{g|n|c|N|E|O}:]{path-to-script}[ -> {name-of-the-function}]; …'`** -## 7. **`ferc'[{g|n|c|N|E|O}:]{path-to-script}[ -> {name-of-the-function}]; …'`** +## 7. **`fsrc'[{g|n|c|N|E|O}:]{path-to-script}[ -> {name-of-the-function}]; …'`** +## 8. **`ferc'[{g|n|c|N|E|O}:]{path-to-script}[ -> {name-of-the-function}]; …'`** Creates a wrapper function that at each invocation sources the given file. The second ice, `ferc''` works the same with the single difference that it diff --git a/z-a-bin-gem-node.plugin.zsh b/z-a-bin-gem-node.plugin.zsh index 1e645ca..b09af16 100644 --- a/z-a-bin-gem-node.plugin.zsh +++ b/z-a-bin-gem-node.plugin.zsh @@ -27,7 +27,7 @@ autoload .za-bgn-bin-or-src-function-body \ hook:\!atload-50 \ →za-bgn-atload-handler \ →za-bgn-help-handler \ - "fbin''|sbin|sbin''|gem''|node''|fmod''|fsrc''|ferc''" # also register new ices + "fbin''|sbin|sbin''|gem''|node''|pip''|fmod''|fsrc''|ferc''" # also register new ices @zinit-register-annex "z-a-bin-gem-node" \ hook:atclone-50 \ diff --git a/→za-bgn-atclone-handler b/→za-bgn-atclone-handler index c9bce4b..e149875 100644 --- a/→za-bgn-atclone-handler +++ b/→za-bgn-atclone-handler @@ -51,6 +51,52 @@ if [[ -n "${ICE[gem]}" ]] { } } +if [[ -n "${ICE[pip]}" ]] { + local -a pip_defs srcdst tmpsdst imods umods + pip_defs=( "${(s.;.)ICE[pip]}" ) + + local pip + integer perform_update=0 + + for pip ( $pip_defs ) { + srcdst=( ${(@s.->.)pip} ) + tmpsdst=( ${(@s.<-.)srcdst[1]} ) + if (( ${#tmpsdst} > 1 )); then + srcdst=( "${tmpsdst[1]}" "${tmpsdst[2]}" "${srcdst[2]:-${tmpdist[2]#\!}}" ) + else + srcdst=( "${tmpsdst[1]#\!}" "${tmpsdst[1]}" "${srcdst[2]:-${srcdst[1]#\!}}" ) + fi + srcdst=( "${srcdst[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" ) + srcdst[2]=${srcdst[2]#\!} + + # Substitute the standard keywords and param''-s + @zinit-substitute 'srcdst[1]' 'srcdst[2]' 'srcdst[3]' + + if [[ "$hook" = *atclone-<-> ]]; then + imods+=( ${srcdst[2]} ) + elif [[ "$hook" = *atpull-<-> && -n ${srcdst[2]} ]]; then + umods+=( ${srcdst[2]} ) + perform_update=1 + break + fi + } + + (( ${#imods} )) && \ + ( builtin cd -q "$dir" && command python3 -m venv venv && VIRTUALENV=venv(:A) command venv/bin/pip install "${imods[@]}" ) + + (( perform_update )) && (( ${#umods} )) && \ + ( + builtin cd -q "$dir" && { + if (( !OPTS[opt_-q,--quiet] )) { + print -P -- "%F{38}bin-gem-node annex: %F{154}Updating the pip packages...%f" + VIRTUALENV=venv(:A) command venv/bin/pip install --upgrade "${umods[@]}" + } else { + VIRTUALENV=venv(:A) command venv/bin/pip install -q --upgrade "${umods[@]}" + } + } + ) +} + if [[ -n "${ICE[node]}" ]] { local -a node_defs srcdst tmpsdst mods node_defs=( "${(s.;.)ICE[node]}" ) @@ -111,7 +157,7 @@ if (( ${+ICE[sbin]} )) { builtin cd -q "$dir" || return for sbin ( $sbins "" ) { - integer set_gem_home=0 set_node_path=0 set_cwd=0 \ + integer set_gem_home=0 set_node_path=0 set_virtualenv=0 set_cwd=0 \ use_all_null=0 use_err_null=0 use_out_null=0 if [[ -z $sbin && ${#sbins} -eq 0 ]] { @@ -137,12 +183,13 @@ if (( ${+ICE[sbin]} )) { srcdst=( ${(@s.->.)sbin} ) srcdst=( "${srcdst[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" ) - [[ ${srcdst[1]} = [gncNEO]#g[gncNEO]#:* ]] && set_gem_home=1 - [[ ${srcdst[1]} = [gncNEO]#n[gncNEO]#:* ]] && set_node_path=1 - [[ ${srcdst[1]} = [gncNEO]#c[gncNEO]#:* ]] && set_cwd=1 - [[ ${srcdst[1]} = [gncNEO]#N[gncNEO]#:* ]] && use_all_null=1 - [[ ${srcdst[1]} = [gncNEO]#E[gncNEO]#:* ]] && use_err_null=1 - [[ ${srcdst[1]} = [gncNEO]#O[gncNEO]#:* ]] && use_out_null=1 + [[ ${srcdst[1]} = [gnpcNEO]#g[gnpcNEO]#:* ]] && set_gem_home=1 + [[ ${srcdst[1]} = [gnpcNEO]#n[gnpcNEO]#:* ]] && set_node_path=1 + [[ ${srcdst[1]} = [gnpcNEO]#p[gnpcNEO]#:* ]] && set_virtualenv=1 + [[ ${srcdst[1]} = [gnpcNEO]#c[gnpcNEO]#:* ]] && set_cwd=1 + [[ ${srcdst[1]} = [gnpcNEO]#N[gnpcNEO]#:* ]] && use_all_null=1 + [[ ${srcdst[1]} = [gnpcNEO]#E[gnpcNEO]#:* ]] && use_err_null=1 + [[ ${srcdst[1]} = [gnpcNEO]#O[gnpcNEO]#:* ]] && use_out_null=1 srcdst[1]=${srcdst[1]#[a-zA-Z]#:} # Substitute the standard keywords and param''-s @@ -168,7 +215,7 @@ if (( ${+ICE[sbin]} )) { .za-bgn-bin-or-src-function-body-cygwin 0 \ "$fnam" \ "$target_binary" "$dir" "$set_gem_home" \ - "$set_node_path" "$set_cwd" "$use_all_null" \ + "$set_node_path" "$set_virtualenv" "$set_cwd" "$use_all_null" \ "$use_err_null" "$use_out_null" builtin print -r -- "$REPLY" \ >! "$file.cmd" @@ -178,7 +225,7 @@ if (( ${+ICE[sbin]} )) { .za-bgn-bin-or-src-function-body 0 \ "$fnam" \ "$target_binary" "$dir" "$set_gem_home" \ - "$set_node_path" "$set_cwd" "$use_all_null" \ + "$set_node_path" "$set_virtualenv" "$set_cwd" "$use_all_null" \ "$use_err_null" "$use_out_null" builtin print -r -- "#!/usr/bin/env zsh$nl$nl$REPLY$nl$nl$fnam \"\$@\"" \ diff --git a/→za-bgn-atdelete-handler b/→za-bgn-atdelete-handler index a840337..87cd4a8 100644 --- a/→za-bgn-atdelete-handler +++ b/→za-bgn-atdelete-handler @@ -19,7 +19,7 @@ if (( ${+ICE[sbin]} )) { sbins=( ${(s.;.)ICE[sbin]} ) local sbin - integer set_gem_home set_node_path + integer set_gem_home set_node_path set_virtualenv ( builtin cd -q "$dir" @@ -47,9 +47,10 @@ if (( ${+ICE[sbin]} )) { srcdst=( ${(@s.->.)sbin} ) srcdst=( "${srcdst[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" ) - [[ ${srcdst[1]} = (g|ng|gn):* ]] && set_gem_home=1 || set_gem_home=0 - [[ ${srcdst[1]} = (n|gn|ng):* ]] && set_node_path=1 || set_node_path=0 - srcdst[1]=${srcdst[1]#(n|g|gn|ng):} + [[ ${srcdst[1]} = [gnpcNEO]#g[gnpcNEO]#:* ]] && set_gem_home=1 || set_gem_home=0 + [[ ${srcdst[1]} = [gnpcNEO]#n[gnpcNEO]#:* ]] && set_node_path=1 || set_node_path=0 + [[ ${srcdst[1]} = [gnpcNEO]#p[gnpcNEO]#:* ]] && set_virtualenv=1 || set_virtualenv=0 + srcdst[1]=${srcdst[1]#[a-zA-Z]#:} # Substitute the standard keywords and param''-s @zinit-substitute 'srcdst[1]' 'srcdst[2]' diff --git a/→za-bgn-atload-handler b/→za-bgn-atload-handler index 2fe0bde..d074012 100644 --- a/→za-bgn-atload-handler +++ b/→za-bgn-atload-handler @@ -80,6 +80,39 @@ if [[ -n "${ICE[node]}" ]] { } } +# +# pip'' ice +# + +if [[ -n "${ICE[pip]}" ]] { + local -a pips srcdst tmpsdst + pips=( "${(s.;.)ICE[pip]}" ) + + local pip + integer add_fbin + + for pip ( $pips ) { + srcdst=( ${(@s.->.)pip} ) + tmpsdst=( ${(@s.<-.)srcdst[1]} ) + if (( ${#tmpsdst} > 1 )); then + srcdst=( "${tmpsdst[1]}" "${tmpsdst[2]}" "${srcdst[2]:-${tmpdist[2]#\!}}" ) + else + srcdst=( "${tmpsdst[1]#\!}" "${tmpsdst[1]}" "${srcdst[2]:-${srcdst[1]#\!}}" ) + fi + srcdst=( "${srcdst[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" ) + [[ ${srcdst[2]} = \!* ]] && add_fbin=1 || add_fbin=0 + srcdst[2]=${srcdst[2]#\!} + + # Substitute the standard keywords and param''-s + @zinit-substitute 'srcdst[1]' 'srcdst[2]' 'srcdst[3]' + + if (( add_fbin )); then + local target_binary="p:$dir/venv/bin/${srcdst[1]}" + ICE[fbin]+="${ICE[fbin]:+;}$target_binary -> ${srcdst[3]}" + fi + } +} + # # fbin'' ice – also inheriting any exclamation-mark gems # or node modules @@ -95,7 +128,7 @@ if (( ${+ICE[fbin]}${+ICE[fsrc]}${+ICE[ferc]} > 0 )) { integer run_type=0 for fbin ( $fbins "" "" $fsrcs "" "" $fercs "" ) { - integer set_gem_home=0 set_node_path=0 set_cwd=0 \ + integer set_gem_home=0 set_node_path=0 set_virtualenv=0 set_cwd=0 \ use_all_null=0 use_err_null=0 use_out_null=0 [[ "$fbin" = "" ]] && { run_type=1; continue; } @@ -127,12 +160,13 @@ if (( ${+ICE[fbin]}${+ICE[fsrc]}${+ICE[ferc]} > 0 )) { srcdst=( ${(@s.->.)fbin} ) srcdst=( "${srcdst[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" ) - [[ ${srcdst[1]} = [gncNEO]#g[gncNEO]#:* ]] && set_gem_home=1 - [[ ${srcdst[1]} = [gncNEO]#n[gncNEO]#:* ]] && set_node_path=1 - [[ ${srcdst[1]} = [gncNEO]#c[gncNEO]#:* ]] && set_cwd=1 - [[ ${srcdst[1]} = [gncNEO]#N[gncNEO]#:* ]] && use_all_null=1 - [[ ${srcdst[1]} = [gncNEO]#E[gncNEO]#:* ]] && use_err_null=1 - [[ ${srcdst[1]} = [gncNEO]#O[gncNEO]#:* ]] && use_out_null=1 + [[ ${srcdst[1]} = [gnpcNEO]#g[gnpcNEO]#:* ]] && set_gem_home=1 + [[ ${srcdst[1]} = [gnpcNEO]#n[gnpcNEO]#:* ]] && set_node_path=1 + [[ ${srcdst[1]} = [gnpcNEO]#p[gnpcNEO]#:* ]] && set_virtualenv=1 + [[ ${srcdst[1]} = [gnpcNEO]#c[gnpcNEO]#:* ]] && set_cwd=1 + [[ ${srcdst[1]} = [gnpcNEO]#N[gnpcNEO]#:* ]] && use_all_null=1 + [[ ${srcdst[1]} = [gnpcNEO]#E[gnpcNEO]#:* ]] && use_err_null=1 + [[ ${srcdst[1]} = [gnpcNEO]#O[gnpcNEO]#:* ]] && use_out_null=1 srcdst[1]=${srcdst[1]#[a-zA-Z]#:} # Substitute the standard keywords and param''-s @@ -143,7 +177,7 @@ if (( ${+ICE[fbin]}${+ICE[fsrc]}${+ICE[ferc]} > 0 )) { .za-bgn-bin-or-src-function-body "$run_type" \ "${srcdst[2]:-${srcdst[1]:t}}" \ "$target_binary" "$dir" "$set_gem_home" \ - "$set_node_path" "$set_cwd" "$use_all_null" \ + "$set_node_path" "$set_virtualenv" "$set_cwd" "$use_all_null" \ "$use_err_null" "$use_out_null" eval "$REPLY" } @@ -160,17 +194,18 @@ if [[ -n "${ICE[fmod]}" ]] { local fmod for fmod ( $fmods ) { - integer set_gem_home=0 set_node_path=0 set_cwd=0 \ + integer set_gem_home=0 set_node_path=0 set_virtualenv=0 set_cwd=0 \ use_all_null=0 use_err_null=0 use_out_null=0 srcdst=( ${(@s.->.)fmod} ) srcdst=( "${srcdst[@]//((#s)[[:space:]]##|[[:space:]]##(#e))/}" ) - [[ ${srcdst[1]} = [gncNEO]#g[gncNEO]#:* ]] && set_gem_home=1 - [[ ${srcdst[1]} = [gncNEO]#n[gncNEO]#:* ]] && set_node_path=1 - [[ ${srcdst[1]} = [gncNEO]#c[gncNEO]#:* ]] && set_cwd=1 - [[ ${srcdst[1]} = [gncNEO]#N[gncNEO]#:* ]] && use_all_null=1 - [[ ${srcdst[1]} = [gncNEO]#E[gncNEO]#:* ]] && use_err_null=1 - [[ ${srcdst[1]} = [gncNEO]#O[gncNEO]#:* ]] && use_out_null=1 + [[ ${srcdst[1]} = [gnpcNEO]#g[gnpcNEO]#:* ]] && set_gem_home=1 + [[ ${srcdst[1]} = [gnpcNEO]#n[gnpcNEO]#:* ]] && set_node_path=1 + [[ ${srcdst[1]} = [gnpcNEO]#p[gnpcNEO]#:* ]] && set_virtualenv=1 + [[ ${srcdst[1]} = [gnpcNEO]#c[gnpcNEO]#:* ]] && set_cwd=1 + [[ ${srcdst[1]} = [gnpcNEO]#N[gnpcNEO]#:* ]] && use_all_null=1 + [[ ${srcdst[1]} = [gnpcNEO]#E[gnpcNEO]#:* ]] && use_err_null=1 + [[ ${srcdst[1]} = [gnpcNEO]#O[gnpcNEO]#:* ]] && use_out_null=1 srcdst[1]=${srcdst[1]#[a-zA-Z]#:} # Substitute the standard keywords and param''-s @@ -180,7 +215,7 @@ if [[ -n "${ICE[fmod]}" ]] { .za-bgn-mod-function-body "${srcdst[2]:-${srcdst[1]}}" \ "$target_function" "$dir" "$set_gem_home" \ - "$set_node_path" "$set_cwd" "$use_all_null" \ + "$set_node_path" "$set_virtualenv" "$set_cwd" "$use_all_null" \ "$use_err_null" "$use_out_null" eval "$REPLY" }