Browse Source

feat: resolve async results in node-print

Kyle P Davis 5 years ago
parent
commit
1270f82d8c
1 changed files with 2 additions and 2 deletions
  1. 2 2
      .profile

+ 2 - 2
.profile

@@ -87,8 +87,8 @@ alias l="ls -FC"
 alias d="l"
 alias d="l"
 alias tree="tree -CF"
 alias tree="tree -CF"
 alias grep="grep --color --exclude-dir={.svn,.git,node_modules}"
 alias grep="grep --color --exclude-dir={.svn,.git,node_modules}"
-alias node-print="node -p -e 'const [,f=\".\",e=\"this\"]=process.argv; (function(){ with(this) return eval(e); }).call(require(path.resolve(f)))'"
-alias ts-node-print="TS_NODE_FILES=true node -r ts-node/register -p -e 'const [,f=\".\",e=\"this\"]=process.argv; (function(){ with(this) return eval(e); }).call(require(path.resolve(f)))'"
+alias node-print="node -e 'const [,f=\".\",e=\"this\"]=process.argv; eval(\"(async function(){ with(this) return (\"+e+\"); })\").call(require(path.resolve(f))).then(console.log)'"
+alias ts-node-print="TS_NODE_FILES=true node -r ts-node/register -e 'const [,f=\".\",e=\"this\"]=process.argv; eval(\"(async function(){ with(this) return (\"+e+\"); })\").call(require(path.resolve(f))).then(console.log)'"
 
 
 # color diffs
 # color diffs
 ! command -v colordiff &>/dev/null  ||  alias diff="colordiff"
 ! command -v colordiff &>/dev/null  ||  alias diff="colordiff"