1.8.36 • Published 2 years ago

@oclif/command v1.8.36

Weekly downloads
1,358,969
License
MIT
Repository
github
Last release
2 years 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@dxatscale/sfpowerscripts@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-automationappsurge-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-pathvasumultiandromeda-ctfmoovi
1.8.30

2 years ago

1.8.31

2 years ago

1.8.32

2 years ago

1.8.33

2 years ago

1.8.34

2 years ago

1.8.35

2 years ago

1.8.36

2 years ago

1.8.29

2 years ago

1.8.25

2 years ago

1.8.26

2 years ago

1.8.27

2 years ago

1.8.28

2 years ago

1.8.23

2 years ago

1.8.24

2 years ago

1.8.22

2 years ago

1.8.21

2 years ago

1.8.20

3 years ago

1.8.18

3 years ago

1.8.19

3 years ago

1.8.2

4 years ago

1.8.1

4 years ago

1.8.9

4 years ago

1.8.10

4 years ago

1.8.8

4 years ago

1.8.11

4 years ago

1.8.7

4 years ago

1.8.12

4 years ago

1.8.6

4 years ago

1.8.13

4 years ago

1.8.5

4 years ago

1.8.14

3 years ago

1.8.4

4 years ago

1.8.15

3 years ago

1.8.3

4 years ago

1.8.16

3 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.1

5 years ago

1.6.0

5 years ago

1.6.0-rc1.1

5 years ago

1.6.0-rc1.2

5 years ago

1.6.0-rc1

5 years ago

1.5.20

5 years ago

1.5.19

6 years ago

1.5.18

6 years ago

1.5.17

6 years ago

1.5.16

6 years ago

1.5.15

6 years ago

1.5.14

6 years ago

1.5.13

6 years ago

1.5.12

6 years ago

1.5.11

6 years ago

1.5.10

6 years ago

1.5.8

6 years ago

1.5.6

7 years ago

1.5.5

7 years ago

1.5.4

7 years ago

1.5.3

7 years ago

1.5.2

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.36

7 years ago

1.4.35

7 years ago

1.4.34

7 years ago

1.4.33

7 years ago

1.4.32

7 years ago

1.4.31

7 years ago

1.4.30

7 years ago

1.4.29

7 years ago

1.4.28

7 years ago

1.4.27

7 years ago

1.4.26

7 years ago

1.4.25

7 years ago

1.4.24

7 years ago

1.4.23

7 years ago

1.4.22

7 years ago

1.4.21

7 years ago

1.4.20

7 years ago

1.4.19

7 years ago

1.4.18

7 years ago

1.4.17

7 years ago

1.4.16

7 years ago

1.4.15

7 years ago

1.4.14

7 years ago

1.4.13

7 years ago

1.4.12

7 years ago

1.4.11

7 years ago

1.4.10

7 years ago

1.4.9

7 years ago

1.4.8

7 years ago

1.4.7

7 years ago

1.4.6

7 years ago

1.4.5

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.25

7 years ago

1.2.24

7 years ago

1.2.23

7 years ago

1.2.22

7 years ago

1.2.21

7 years ago

1.2.20

7 years ago

1.2.19

7 years ago