1.0.11 • Published 1 year ago

nv-cli-dynbloc v1.0.11

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

nv-cli-dynbloc

  • cli-tool
  • simple macro tool , let you require block

install

  • npm install nv-cli-dynbloc -g

usage

	Usage: nv_cli_dynbloc [options] 
	Options:
	    -w, --workdir                   workdir, default "./"
	    -c, --worker_cnt_per_cpu        worker count per cpu, default 8
	    -h, --help                      usage

	syntax: 
	  ##dynbloc("<your-macro-file-path-end-with nvmcr.js>"); 

example

		# tree TEST/
		TEST/
		├── blocks
		│   └── nvblk.js
		└── index.js



          # cat TEST/index.js 
	async function main(x,y,z) {
	    while(true) {
		##bloc("./blocks/nvblk.js").mybloc0<x,y,z>();
	    }
	    ##bloc("./blocks/nvblk.js").swap<x,y,z>();
	    return([x,y,z])
	}
	

           # cat TEST/blocks/nvblk.js 



	mybloc0 : (A,B,C) => {
	    let a = A+B;
	    let r = await (a*C);
	    ++A;
	    ++B;
	    C = r;
	}


	swap: (A,B,C) => {
	    let tmp = A;
	    A = B ;
	    B = C ;
	    C = tmp;
	}


          #nv_cli_dynbloc  -w TEST

		async function main(x, y, z) {
		  while (true) {
		    {
		      let a = x + y;
		      let r = await (a * z);
		      ++x;
		      ++y;
		      z = r;
		    }
		  }

		  {
		    let tmp = x;
		    x = y;
		    y = z;
		    z = tmp;
		  }
		  return [x, y, z];
		}

LICENSE

  • ISC