开发者社区> 镜像站> NPM> octodash
octodash
An opinionated version of dashdash
Last updated 3 years ago by octoblu .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install octodash 
SYNC missed versions from official npm registry.

octodash

An opinionated version of dashdash

Example Usage

const OctoDash = require("octodash")
const CLI_OPTIONS = [
  {
    names: ["first-thing", "f"],
    type: "string",
    env: "FIRST_THING",
    required: true,
    help: "first thing to specify",
  },
  {
    names: ["second-thing", "s"],
    type: "string",
    env: "SECOND_THING",
    help: "second thing to specify",
  },
  {
    names: ["third-thing", "t"],
    type: "base64",
    env: "THIRD_THING",
    default: "Y29vbAo=",
    help: "third thing to specify",
  },
]

const octoDash = new OctoDash({
  argv: process.argv,
  cliOptions: CLI_OPTIONS,
})
const options = octoDash.parseOptions()
console.log("Parsed Options", options)
octoDash.die() // exits with status 0
octoDash.die(new Error("oh no")) // prints error and exists with status code 1

Current Tags

  • 2.0.0                                ...           latest (3 years ago)

20 Versions

  • 2.0.0                                ...           3 years ago
  • 1.5.0                                ...           3 years ago
  • 1.4.0                                ...           3 years ago
  • 1.3.1                                ...           3 years ago
  • 1.3.0                                ...           3 years ago
  • 1.2.5                                ...           3 years ago
  • 1.2.4                                ...           3 years ago
  • 1.2.3                                ...           3 years ago
  • 1.2.2                                ...           3 years ago
  • 1.2.1                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.7                                ...           3 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago