nv-cli-ifif

1.0.4 • Public • Published

nv-cli-ifif

  • cli tool

  • create a simple project ONLY USING if/else WITHIN a top-while-loop

  • this is a simple version of 【nv-cli-many-block】 + 【nv-cli-state】 + 【nv-cli-ifelse】

  • only support 2 layers

  • only generate sync functions

  • without using parser, just concat string

  • suitable for small-scale(not-many-if-branch). if many if-branch(hundred * hundred: nv-cli-state is suitable

  • nvlang has a ctx-dsl, it convert most code to while + if/else + a-matrix , this pkg for test it.

install

  • npm install nv-cli-ifif -g

usage

          #mkdir WORKDIR

0. nv_cli_ifif_cfg

	Usage: nv_cli_ifif_cfg [options] 
	Options:
	    -w, --workdir        workdir , default "./"
	    -h, --help           usage

	total 8
	-rwxrwxrwx 1 root root 38 Jul  3 17:18 input.def
	-rwxrwxrwx 1 root root 29 Jul  3 17:18 state.def
                                                   ___cfg___.js

1. EDIT input.def AND state.def CREATED BY nv_cli_ifif_cfg

           input.def 
                name name name .....
           state.def
                name name name ....


       0. names must be unique (across two files)
       1. names must be valid js-identifier
       2. names must be lower-case
       3. names CANT BE [
	    "run","main",
	    "prepare","init","while","final",
	    "creat_ctx",
	    "calc_input_hash",
	    "ctx", "state","input","input_hash",
	    "i","j","k",
	    "error",
	    "finish"                        
       ]

2. RUN nv_cli_ifif_creat IN the-same DIR

		Usage: nv_cli_ifif_creat [options] 
		Options:
		    -w, --workdir        workdir , default "./"
		    -h, --help           usage

		WORKDIR# ls -l
		total 40
		-rw-r--r-- 1 root root  226 Jul  3 17:39 ctx.js
		-rw-r--r-- 1 root root  504 Jul  3 17:39 final.lexical.js
		-rw-r--r-- 1 root root  237 Jul  3 17:39 init.lexical.js
		-rwxrwxrwx 1 root root   38 Jul  3 17:39 input.def
		-rw-r--r-- 1 root root  842 Jul  3 17:39 input-def.js
		-rw-r--r-- 1 root root  402 Jul  3 17:39 input-hash-func.js
		-rw-r--r-- 1 root root  192 Jul  3 17:39 prepare.lexical.js
		-rwxrwxrwx 1 root root   29 Jul  3 17:39 state.def
		-rw-r--r-- 1 root root  467 Jul  3 17:39 state-def.js
		drwxr-xr-x 7 root root 4096 Jul  3 17:39 while
                                                             ___cfg___.js

3. EDIT the following files

      0. you can choose to EDIT the following empty files:
         ./input-hash-func.js
         ./ctx.js
         ./prepare.js
         ./init.js

      1. #tree ./while
         check the files and EDIT them

      2. AFTER THAT, you can also choose to EDIT the following empty files:
         ./final.js

4. RUN nv_cli_ifif_make IN the-same DIR. IT will CREAT a ./index.js

			WORKDIR# ls -l | egrep index
			-rw-r--r-- 1 root root 8823 Jul  3 17:40 index.js

others:

clean

        your can use #nv_cli_ifif_clean to remove all the-lecical-files:
            prepare.lexical.js
            init.lexical.js
            </while>
            final.lexical.js

			WORKDIR# ls -l
			total 20
                                                                     ctx.js
                                                                     input-hash-func.js
			-rw-r--r-- 1 root root 8823 Jul  3 17:40 index.js
			-rwxrwxrwx 1 root root   38 Jul  3 17:39 input.def
			-rwxrwxrwx 1 root root   29 Jul  3 17:39 state.def
                                                                     ___cfg___.js

recover

        your can also use #nv_cli_ifif_recover  to recover these files 

example

LICENSE

  • ISC

Readme

Keywords

none

Package Sidebar

Install

npm i nv-cli-ifif

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

89.9 kB

Total Files

70

Last publish

Collaborators

  • ihgazni2