@oclif/command

oclif base command

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
Last updated 7 years ago by oclif-bot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @oclif/command 
SYNC missed versions from official npm registry.

@oclif/command

This library been replaced by @oclif/core and is now in maintenance mode. We will only consider PRs that address security concerns.

oclif base command

Version CircleCI Appveyor CI Known Vulnerabilities Downloads/week License

This is about half of the main codebase for oclif. The other half lives in @oclif/config. This can be used directly, but it probably makes more sense to build your CLI with the generator.

Usage

Without the generator, you can create a simple CLI like this:

TypeScript

#!/usr/bin/env ts-node

import * as fs from 'fs'
import {Command, flags} from '@oclif/command'

class LS extends Command {
  static flags = {
    version: flags.version(),
    help: flags.help(),
    // run with --dir= or -d=
    dir: flags.string({
      char: 'd',
      default: process.cwd(),
    }),
  }

  async run() {
    const {flags} = this.parse(LS)
    let files = fs.readdirSync(flags.dir)
    for (let f of files) {
      this.log(f)
    }
  }
}

LS.run()
.catch(require('@oclif/errors/handle'))

JavaScript

#!/usr/bin/env node

const fs = require('fs')
const {Command, flags} = require('@oclif/command')

class LS extends Command {
  async run() {
    const {flags} = this.parse(LS)
    let files = fs.readdirSync(flags.dir)
    for (let f of files) {
      this.log(f)
    }
  }
}

LS.flags = {
  version: flags.version(),
  help: flags.help(),
  // run with --dir= or -d=
  dir: flags.string({
    char: 'd',
    default: process.cwd(),
  }),
}

LS.run()
.catch(require('@oclif/errors/handle'))

Then run either of these with:

$ ./myscript
...files in current dir...
$ ./myscript --dir foobar
...files in ./foobar...
$ ./myscript --version
myscript/0.0.0 darwin-x64 node-v9.5.0
$ ./myscript --help
USAGE
  $ @oclif/command

OPTIONS
  -d, --dir=dir  [default: /Users/jdickey/src/github.com/oclif/command]
  --help         show CLI help
  --version      show CLI version

See the generator for all the options you can pass to the command.

Current Tags

  • 1.6.0-rc1.2                                ...           help-beta (5 years ago)
  • 1.8.36                                ...           latest (a year ago)

109 Versions

  • 1.8.36 [deprecated]           ...           a year ago
  • 1.8.35 [deprecated]           ...           a year ago
  • 1.8.34 [deprecated]           ...           a year ago
  • 1.8.33 [deprecated]           ...           a year ago
  • 1.8.32 [deprecated]           ...           a year ago
  • 1.8.31 [deprecated]           ...           a year ago
  • 1.8.30 [deprecated]           ...           a year ago
  • 1.8.29 [deprecated]           ...           a year ago
  • 1.8.28 [deprecated]           ...           a year ago
  • 1.8.27 [deprecated]           ...           a year ago
  • 1.8.26 [deprecated]           ...           a year ago
  • 1.8.25 [deprecated]           ...           2 years ago
  • 1.8.24 [deprecated]           ...           2 years ago
  • 1.8.23 [deprecated]           ...           2 years ago
  • 1.8.22 [deprecated]           ...           2 years ago
  • 1.8.21 [deprecated]           ...           2 years ago
  • 1.8.20 [deprecated]           ...           2 years ago
  • 1.8.19 [deprecated]           ...           2 years ago
  • 1.8.18 [deprecated]           ...           2 years ago
  • 1.8.16 [deprecated]           ...           3 years ago
  • 1.8.15 [deprecated]           ...           3 years ago
  • 1.8.14 [deprecated]           ...           3 years ago
  • 1.8.13 [deprecated]           ...           3 years ago
  • 1.8.12 [deprecated]           ...           3 years ago
  • 1.8.11 [deprecated]           ...           3 years ago
  • 1.8.10 [deprecated]           ...           3 years ago
  • 1.8.9 [deprecated]           ...           3 years ago
  • 1.8.8 [deprecated]           ...           3 years ago
  • 1.8.7 [deprecated]           ...           3 years ago
  • 1.8.6 [deprecated]           ...           3 years ago
  • 1.8.5 [deprecated]           ...           3 years ago
  • 1.8.4 [deprecated]           ...           3 years ago
  • 1.8.3 [deprecated]           ...           3 years ago
  • 1.8.2 [deprecated]           ...           3 years ago
  • 1.8.1 [deprecated]           ...           3 years ago
  • 1.8.0 [deprecated]           ...           4 years ago
  • 1.7.0 [deprecated]           ...           4 years ago
  • 1.6.1 [deprecated]           ...           5 years ago
  • 1.6.0 [deprecated]           ...           5 years ago
  • 1.6.0-rc1.2 [deprecated]           ...           5 years ago
  • 1.6.0-rc1.1 [deprecated]           ...           5 years ago
  • 1.6.0-rc1 [deprecated]           ...           5 years ago
  • 1.5.20 [deprecated]           ...           5 years ago
  • 1.5.19 [deprecated]           ...           5 years ago
  • 1.5.18 [deprecated]           ...           5 years ago
  • 1.5.17 [deprecated]           ...           5 years ago
  • 1.5.16 [deprecated]           ...           5 years ago
  • 1.5.15 [deprecated]           ...           5 years ago
  • 1.5.14 [deprecated]           ...           5 years ago
  • 1.5.13 [deprecated]           ...           6 years ago
  • 1.5.12 [deprecated]           ...           6 years ago
  • 1.5.11 [deprecated]           ...           6 years ago
  • 1.5.10 [deprecated]           ...           6 years ago
  • 1.5.8 [deprecated]           ...           6 years ago
  • 1.5.6 [deprecated]           ...           6 years ago
  • 1.5.5 [deprecated]           ...           6 years ago
  • 1.5.4 [deprecated]           ...           6 years ago
  • 1.5.3 [deprecated]           ...           6 years ago
  • 1.5.2 [deprecated]           ...           6 years ago
  • 1.5.1 [deprecated]           ...           6 years ago
  • 1.5.0 [deprecated]           ...           6 years ago
  • 1.4.36 [deprecated]           ...           6 years ago
  • 1.4.35 [deprecated]           ...           6 years ago
  • 1.4.34 [deprecated]           ...           6 years ago
  • 1.4.33 [deprecated]           ...           6 years ago
  • 1.4.32 [deprecated]           ...           6 years ago
  • 1.4.31 [deprecated]           ...           6 years ago
  • 1.4.30 [deprecated]           ...           7 years ago
  • 1.4.29 [deprecated]           ...           7 years ago
  • 1.4.28 [deprecated]           ...           7 years ago
  • 1.4.27 [deprecated]           ...           7 years ago
  • 1.4.26 [deprecated]           ...           7 years ago
  • 1.4.25 [deprecated]           ...           7 years ago
  • 1.4.24 [deprecated]           ...           7 years ago
  • 1.4.23 [deprecated]           ...           7 years ago
  • 1.4.22 [deprecated]           ...           7 years ago
  • 1.4.21 [deprecated]           ...           7 years ago
  • 1.4.20 [deprecated]           ...           7 years ago
  • 1.4.19 [deprecated]           ...           7 years ago
  • 1.4.18 [deprecated]           ...           7 years ago
  • 1.4.17 [deprecated]           ...           7 years ago
  • 1.4.16 [deprecated]           ...           7 years ago
  • 1.4.15 [deprecated]           ...           7 years ago
  • 1.4.14 [deprecated]           ...           7 years ago
  • 1.4.13 [deprecated]           ...           7 years ago
  • 1.4.12 [deprecated]           ...           7 years ago
  • 1.4.11 [deprecated]           ...           7 years ago
  • 1.4.10 [deprecated]           ...           7 years ago
  • 1.4.9 [deprecated]           ...           7 years ago
  • 1.4.8 [deprecated]           ...           7 years ago
  • 1.4.7 [deprecated]           ...           7 years ago
  • 1.4.6 [deprecated]           ...           7 years ago
  • 1.4.5 [deprecated]           ...           7 years ago
  • 1.4.4 [deprecated]           ...           7 years ago
  • 1.4.3 [deprecated]           ...           7 years ago
  • 1.4.2 [deprecated]           ...           7 years ago
  • 1.4.1 [deprecated]           ...           7 years ago
  • 1.4.0 [deprecated]           ...           7 years ago
  • 1.3.3 [deprecated]           ...           7 years ago
  • 1.3.2 [deprecated]           ...           7 years ago
  • 1.3.1 [deprecated]           ...           7 years ago
  • 1.3.0 [deprecated]           ...           7 years ago
  • 1.2.25 [deprecated]           ...           7 years ago
  • 1.2.24 [deprecated]           ...           7 years ago
  • 1.2.23 [deprecated]           ...           7 years ago
  • 1.2.22 [deprecated]           ...           7 years ago
  • 1.2.21 [deprecated]           ...           7 years ago
  • 1.2.20 [deprecated]           ...           7 years ago
  • 1.2.19 [deprecated]           ...           7 years ago
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (14)

© 2010 - cnpmjs.org x YWFE | Home | YWFE