How to use @oclif/config - 4 common examples

To help you get started, we’ve selected a few @oclif/config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adobe / aio-cli / src / index.js View on Github external
AIOCommand.run = async (argv, opts) => {
  if (!argv) {
    argv = process.argv.slice(2)
  }

  // oclif originally included the following too ...
  // this resulted in an uncovered line in the tests, and it appeared to never happen anyway
  // seem like it would only
  // ||  module.parent && module.parent.parent && module.parent.parent.filename
  const config = await Config.load(opts || __dirname)

  let subCommand = argv[0]

  // 1. find the first flag ( note: there could be none ... )
  let firstFlag = argv.slice().findIndex(elem => elem.indexOf('-') === 0)
  if (firstFlag < 0) {
    firstFlag = argv.length
  }
  // 2. try to make the biggest topic command by combining with ':'
  // and looking up in this.config.commandIDs
  for (let x = firstFlag; x > -1; x--) {
    subCommand = argv.slice(0, x).join(':')
    // if (config.findTopic(subCommand)) { // <= this works but does not support aliases
    if (config.findCommand(subCommand)) {
      argv = [subCommand].concat(argv.slice(x))
      break
github heroku / heroku-apps / test / commands / config / set.js View on Github external
beforeEach(async () => {
    config = await require('@oclif/config').load()
    cli.mockConsole()
    cli.exit.mock()
  })
  afterEach(() => nock.cleanAll())
github heroku / cli / packages / cli / src / hooks / init / refresh-run.ts View on Github external
async function run() {
  const config = await Config.load({root: __dirname})
  const analytics = new Analytics(config)
  await analytics.submit()
}
run()
github superfly / fly / packages / cli / src / base-command.ts View on Github external
protected showMoreDetailedHelp() {
    const x = new Help(this.config, { all: true })
    x.showCommandHelp(Config.Command.toCached((this.ctor as any) as Config.Command.Class), this.config.topics)
  }

@oclif/config

base config object and standard interfaces for oclif components

MIT
Latest version published 8 months ago

Package Health Score

55 / 100
Full package analysis

Popular @oclif/config functions