This package has been deprecated

Author message:

This library is no longer maintained.

@adobe/oclif-base-index-command

1.0.2 • Public • Published

oclif Version Downloads/week Build Status Build status License Greenkeeper badge

oclif-base-index-command

Base oclif command for routing index.js (to support subcommands with no colons).

The Problem

For example, if you have a command foo with topics (sub-commands) bar and baz:

src
├── commands
│   └── foo
│       ├── index.js
│       ├── bar.js
│       ├── baz.js

The topics bar and baz are called this way:

my-cli foo:bar
my-cli foo:baz

However, what if you want to call them this way?

my-cli foo bar
my-cli foo baz

oclif does not support this out of the box.

This way of structuring sub-commands is important to support legacy CLIs so that they may be ported to oclif, and reduce friction for adoption.

The Solution

First, add this package to your CLI repo:

npm install @adobe/oclif-base-index-command

In your index.js (see tree structure above), add BaseIndexCommand as your class' superclass:

const BaseIndexCommand = require('@adobe/oclif-base-index-command')

class IndexCommand extends BaseIndexCommand {
  // don't override run(), let the superclass handle it
  // for the "no-colon" routing functionality
}

IndexCommand.description = `Your command's description here`


module.exports = IndexCommand

Now these commands will work without the colon topic separator:

my-cli foo bar
my-cli foo baz

Readme

Keywords

Package Sidebar

Install

npm i @adobe/oclif-base-index-command

Weekly Downloads

4

Version

1.0.2

License

Apache-2.0

Unpacked Size

18 kB

Total Files

4

Last publish

Collaborators

  • dylandepass
  • djaeggi
  • adobehalls
  • fullcolorcoder
  • marbec
  • tripod
  • garthdb
  • lazd
  • adobe-admin
  • patrickfulton
  • trieloff
  • shazron
  • krisnye
  • dcpfsdk
  • natebaldwin
  • devongovett
  • aspro83
  • symanovi
  • dpfister
  • stefan-guggisberg
  • korra
  • rofe
  • kptdobe