1.8.36 • Published 7 months ago

@oclif/command v1.8.36

Weekly downloads
1,358,969
License
MIT
Repository
github
Last release
7 months ago

@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.

wordup-clizengular-cli@kevinki.ng/contractualize@ahdesigns/kindly@ahdesigns/pomo@microsoft/botframework-cli@microsoft/bf-luis-cli@microsoft/bf-qnamaker@procore/core-scripts@dxatscale/sfpowerscriptsbalena-cli@bot-js/cli@demo./abc@demo./ccc@demo./cli@demo./cli-hooks@demo./cli-plugin-mp@demo./cli-plugin-web@demo./cli-utils@demo./helli@demo./hello@demo./hellu@demo./three@demo./yo@gettruck/sendgrid-clidbdocs-amlcodimd-clianypoint-platform-automation@twilio-labs/plugin-flexappsurge-cli-testgitteee@andresmorelos/dev-clipctlcoldwallet-cli@platformer/platformer-cli@awesome-crowdin/contributors@radar/deploy-clitoyhauler-cli@adobe/aio-cli-plugin-aem-cloud-migration@prisma-tools/schema@kimonocloud/kimono-manifest-generatoraws-ec2-profileswaque-plus@vprok/debug-reset-demo2@vprok/vp-mon1snyk-blacklistrookclinextlesscs_cli_new@innocenzi/use-dotfilesreactness@flatfile/react-demooclif-boilerplatesshhvulcanc@frontierjs/frontierpeopleapicli@omger/exp-gen@fluencyy/hellocliexpgen-omgerbooru-clicryptowerk-clitb-cli-plubin@bi/checkly-cliarchitect-clioctopus-clis@elementthree/neon-clie3-neon-clijot-clitest-hsueh@wonderland/cli-plugin-test-foo@wonderland/cli-plugin-test-barinfra-xyzahm-scriptsams-front-cli@m0hq/json2graphql@emjimadhu/oclif-testt@emjimadhu/vue-schematics-clicsa-clisfdx-plugin-psaoclif-multi-ts-starter@athiththan11/hydrogen-cli@heroku/support-notes@laundry/corebionicmetricscyber-deployer-clicyber-host-clibritive-cli-test1britive-test@laundry/laundry@emjimadhu/oclif-boilerplate@emjimadhu/oclif-testmsgpack-cliedb-cliefrontforcenextftest-elliot-cli@heroku/csa-cliawepatmihirogi-path
1.8.30

9 months ago

1.8.31

8 months ago

1.8.32

8 months ago

1.8.33

8 months ago

1.8.34

8 months ago

1.8.35

8 months ago

1.8.36

7 months ago

1.8.29

9 months ago

1.8.25

10 months ago

1.8.26

10 months ago

1.8.27

10 months ago

1.8.28

9 months ago

1.8.23

11 months ago

1.8.24

11 months ago

1.8.22

1 year ago

1.8.21

1 year ago

1.8.20

1 year ago

1.8.18

1 year ago

1.8.19

1 year ago

1.8.2

2 years ago

1.8.1

2 years ago

1.8.9

2 years ago

1.8.10

2 years ago

1.8.8

2 years ago

1.8.11

2 years ago

1.8.7

2 years ago

1.8.12

2 years ago

1.8.6

2 years ago

1.8.13

2 years ago

1.8.5

2 years ago

1.8.14

2 years ago

1.8.4

2 years ago

1.8.15

2 years ago

1.8.3

2 years ago

1.8.16

2 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.6.0-rc1.1

4 years ago

1.6.0-rc1.2

4 years ago

1.6.0-rc1

4 years ago

1.5.20

4 years ago

1.5.19

5 years ago

1.5.18

5 years ago

1.5.17

5 years ago

1.5.16

5 years ago

1.5.15

5 years ago

1.5.14

5 years ago

1.5.13

5 years ago

1.5.12

5 years ago

1.5.11

5 years ago

1.5.10

5 years ago

1.5.8

5 years ago

1.5.6

5 years ago

1.5.5

5 years ago

1.5.4

5 years ago

1.5.3

5 years ago

1.5.2

5 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.36

6 years ago

1.4.35

6 years ago

1.4.34

6 years ago

1.4.33

6 years ago

1.4.32

6 years ago

1.4.31

6 years ago

1.4.30

6 years ago

1.4.29

6 years ago

1.4.28

6 years ago

1.4.27

6 years ago

1.4.26

6 years ago

1.4.25

6 years ago

1.4.24

6 years ago

1.4.23

6 years ago

1.4.22

6 years ago

1.4.21

6 years ago

1.4.20

6 years ago

1.4.19

6 years ago

1.4.18

6 years ago

1.4.17

6 years ago

1.4.16

6 years ago

1.4.15

6 years ago

1.4.14

6 years ago

1.4.13

6 years ago

1.4.12

6 years ago

1.4.11

6 years ago

1.4.10

6 years ago

1.4.9

6 years ago

1.4.8

6 years ago

1.4.7

6 years ago

1.4.6

6 years ago

1.4.5

6 years ago

1.4.4

6 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.25

6 years ago

1.2.24

6 years ago

1.2.23

6 years ago

1.2.22

6 years ago

1.2.21

6 years ago

1.2.20

6 years ago

1.2.19

6 years ago