0.0.5 • Published 2 years ago

nv-cli-find-id v0.0.5

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

nv-cli-find-id

  • cli-tool
  • find idnetifier name in js/ts/json
  • this use RegExp + parser, so its slow IF too many files in path-dir, such as node_modules

install

  • npm install nv-cli-find-id -g

usage

    Usage: nv_find_id [options]
    Options:
        -p, --path            path to search ,default ./
        -s, --string          identifier name to be replaced,exact match
        -r, --regex           identifier name regexp pattern
        -u, --suffixes        default js ts json
        -h, --help            usage

example

find any id match look|Look

    #nv_find_id -r "look|Look"


    ......
    /mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-find-id/node_modules/nv-jsparser-helper/tokenizer.js
    Position { line: 1284, column: 2 } Position { line: 1284, column: 22 }
        ////
        createLookaheadState(state) {
          return new LookaheadState(this, state);
        }
    ==================
    /mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-find-id/node_modules/nv-jsparser-helper/tokenizer.js
    Position { line: 1284, column: 42 } Position { line: 1284, column: 56 }
        new LookaheadState(this, state)
    ==================
    /mnt/sdb/NV5/NV5_/nvcli-/pkgs/JSCODING/nv-cli-find-id/node_modules/nv-jsparser-helper/tokenizer.js
    Position { line: 1285, column: 2 } Position { line: 1285, column: 11 }
        lookahead() {
          const old = this.state;
          this.state = this.createLookaheadState(old);
          this.isLookahead = true; ////读取下一个token

          this.nextToken(); ////取消isLookahead

          this.isLookahead = false;
          const curr = this.state; //返回当前状态
          //恢复为旧状态

          this.state = old;
          return curr;
        }
    ==================
    ....

LICENSE

  • ISC