1.0.1 • Published 3 years ago

nv-cli-sctx v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

nv-cli-sctx

  • nv-cli-sctx
  • simple cli tool, creat some templates for single-param-only style programming

install

  • npm install nv-cli-sctx -g

usage

    Usage: nv_cli_sctx [options]
    Options:
        -i, --indent          indent default=1
        -x, --ctx             ctx template
        -p, --params          ctx param names
        -c, --ifcond          if cond else
        -r, --ifrslt          if elif elif... else
        -n, --elifnum         elif numbers of ifrslt,default=2
        -R, --return          return
        -t, --throw           throw
        -b, --break           break
        -C, --continue        continue
        -f, --function        function
        -N, --funcname        function name,defult="func"
        -h, --help            usage

example

    nv-cli-ctx# nv_cli_sctx -x -p a b c
    
        class Ctx {
            _rslt
            _exeception
            _cond
            _rtrn
            _throw
            _break
            _continue
            a
            b
            c
        }
        const _ctx = (D)=> {
            let ctx = new Ctx()
            Object.assign(ctx,D)
            return(ctx)
        }
    
    nv-cli-ctx# nv_cli_sctx -c
        if(ctx._cond) {
        } else {
        }
    nv-cli-ctx#
    
    
    nv-cli-ctx# nv_cli_sctx -r -n 5
        if(ctx._rslt=== ) {
        } else if(ctx._rslt=== ) {
        } else if(ctx._rslt=== ) {
        } else if(ctx._rslt=== ) {
        } else if(ctx._rslt=== ) {
        } else if(ctx._rslt=== ) {
        } else {
        }
    nv-cli-ctx#
    
    
    nv-cli-ctx# nv_cli_sctx -R
    
        if(ctx._rtrn) {
            return(ctx._rslt)
        } else {
    
        }
    
    nv-cli-ctx# nv_cli_sctx -t
    
        if(ctx._throw) {
            throw(ctx._exception)
        } else {
    
        }
    
    nv-cli-ctx# nv_cli_sctx -b
    
        if(ctx._break) {
            break
        } else {
    
        }
    
    nv-cli-ctx# nv_cli_sctx -C
    
        if(ctx._continue) {
            continue
        } else {
    
        }
    
    nv-cli-ctx#
    
    nv-cli-ctx# nv_cli_sctx -f -N myfunc
    
            function myfunc (ctx) {
                /*...*/
                return(ctx)
            }
    
    nv-cli-ctx#

LICENSE

  • ISC