Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in parse() #229

Closed
tunnckoCore opened this issue Mar 27, 2020 · 1 comment
Closed

bug in parse() #229

tunnckoCore opened this issue Mar 27, 2020 · 1 comment
Labels
🗄 area/interface This affects the public interface 🏡 area/internal This affects the hidden internals 👶 semver/patch This is a backwards-compatible fix 🐛 type/bug This is a problem

Comments

@tunnckoCore
Copy link
Member

tunnckoCore commented Mar 27, 2020

update .parse method to

    const helaArgv = this.result.helaSettings.argv
    const argz = this.settings.singleMode ? helaArgv._ : helaArgv._.slice(1)
    this.result.helaSettings.argv._ = argz

(remove the first argument if not in single mode)

Currently it is causing toFlags to stringify the argv._ which includes the "current command" and this makes problems.

For example, when running hela build the argv (first argument) that is passed to the .action has argv._ === ['build'], with above update it will be empty array. For getting args, flags, argv and etc, you can access the bigger picture from the second passed argument, which looks like the following

{
    commandName: 'build',
    parsedArgv: { _: [Array] },
    rawArgs: [ 'build' ],
    flags: {
      _: [],
      cwd: '/home/charlike/github/tunnckoCore/opensource',
      showStack: false,
      verbose: false
    },
    helaSettings: {
      cwd: '/home/charlike/github/tunnckoCore/opensource',
      version: '3.0.0',
      singleMode: false,
      allowUnknownFlags: true,
      defaultsToHelp: true,
      argv: [Object]
    },
    args: [],
    command: {
      commandName: 'build',
      rawName: 'build',
      description: 'Build output files, using Babel',
      config: [Object],
      args: [],
      flags: [Map],
      examples: [],
      aliases: [Array],
      handler: [Function],
      hasRequired: [],
      hasMultiple: []
    }
  }
@tunnckoCore tunnckoCore added 🏡 area/internal This affects the hidden internals 🐛 type/bug This is a problem 👶 semver/patch This is a backwards-compatible fix 🗄 area/interface This affects the public interface labels Mar 27, 2020
@tunnckoCore
Copy link
Member Author

not relevant anymore. i guess that was before i implemented yaro, latest is on tunnckocore/opensource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗄 area/interface This affects the public interface 🏡 area/internal This affects the hidden internals 👶 semver/patch This is a backwards-compatible fix 🐛 type/bug This is a problem
Projects
None yet
Development

No branches or pull requests

1 participant