JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 58
  • Score
    100M100P100Q72151F
  • License ISC

nv-cli-basic =============== - nv-cli-basic - for creat cli project - similiar to minimist, more simple

Package Exports

  • nv-cli-basic
  • nv-cli-basic/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nv-cli-basic) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

nv-cli-basic

  • nv-cli-basic
  • for creat cli project
  • similiar to minimist, more simple

install

  • npm install nv-cli-basic

usage

const creat_argv = require("nv-cli-basic");

example

bin.js

#!/usr/bin/env node

const creat_argv = require("nv-cli-basic");

var cfg = {
    alias: {
        'efi':'e',
        'disabled':'d',
        'count':'c',
        'name':'n'
    },
    boolean: ["disabled"],
    string:  ["name"],
    defaults: {
        'count':1000
    },
    description: {
        'efi':'efi params',
        'disabled':'if the control-plane is disabled',
        'name':'the name,always treated as string',
        'count':'testing times, default 1000'
    }
}


var argv = creat_argv(cfg)

console.log(argv);

console.log("--generated usage: ----")

console.log(argv.usage("projname"));


console.log("---please input and then ctrl-D ---")

function handler(s) {
    return(s.split("\n").join(" @@@@ "))
}

argv.rwstream(handler);

output

# node bin.js xy "b c d" -e fgh --efi 123 "({200:300})" -g ggg -n 55555555


Argv {
  efi: [ 123, { '200': 300 } ],
  g: 'ggg',
  name: '55555555',
  _: [ 'xy', 'b c d' ],
  e: [ 123, { '200': 300 } ],
  n: '55555555',
  disabled: false,
  d: false,
  count: 1000,
  c: 1000
}
--generated usage: ----
Usage: projname [options]
Options:
    -e, --efi             efi params
    -d, --disabled        if the control-plane is disabled
    -n, --name            the name,always treated as string
    -c, --count           testing times, default 1000

---please input and then ctrl-D ---

aaa
bbb
ccc
ddd
 @@@@ aaa @@@@ bbb @@@@ ccc @@@@ ddd @@@@

nv-cli-basic-#

METHODS

argv.alias_                argv.amd_                  argv.boolean_
argv.cfg_                  argv.constructor           argv.defaults_
argv.description_          argv.input_stream          argv.output_stream
argv.pre_post_tem          argv.rwstream              argv.string_
argv.usage

LICENSE

  • ISC