How to use the yargs-parser/lib/tokenize-arg-string function in yargs-parser

To help you get started, we’ve selected a few yargs-parser 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 joefitzgerald / go-plus / lib / lint / linter.js View on Github external
}
    this.deleteMessages()

    const tool: string = (atom.config.get('go-plus.lint.tool'): any)
    const cmd = await this.goconfig.locator.findTool(tool)
    if (!cmd) {
      return
    }

    const options = this.goconfig.executor.getOptions('file', editor)

    let configuredArgs: string | string[] = (atom.config.get(
      'go-plus.lint.args'
    ): any)
    if (typeof configuredArgs === 'string') {
      configuredArgs = configuredArgs ? argparser(configuredArgs) : []
    }

    let args = TOOLS[tool.toLowerCase()].prepareArgs(configuredArgs)
    args = replaceVariables(args, editor.getPath(), options)

    const r: ExecResult = await this.goconfig.executor.exec(cmd, args, options)
    if (!r) {
      return
    }
    const stderr = r.stderr instanceof Buffer ? r.stderr.toString() : r.stderr
    const stdout = r.stdout instanceof Buffer ? r.stdout.toString() : r.stdout
    if (stderr && stderr.trim() !== '') {
      console.log(`${tool}-linter: (stderr) ` + stderr) // eslint-disable-line no-console
    }
    let messages: Array = []
    if (stdout && stdout.trim() !== '') {
github joefitzgerald / go-plus / lib / build / builder.js View on Github external
testCompileArgs(outFile: string, additionalArgs: string = ''): Array {
    const result = ['test']
    // use additional build args even when we compile the tests
    if (additionalArgs && additionalArgs.length) {
      const parsed = argparser(additionalArgs)
      for (let i = 0; i < parsed.length; i++) {
        if (parsed[i] === '-o') {
          // we'll take care of this one, skip over the -o flag
          i++
          continue
        } else if (parsed[i] === '-c' || parsed[i] === '-i') {
          continue
        } else {
          result.push(parsed[i])
        }
      }
    }
    result.push('-c', '-i', '-o', outFile, '.')
    return result
  }
github joefitzgerald / go-plus / lib / build / builder.js View on Github external
async lintInstall(cmd: string, options: ExecutorOptions) {
    const command = this.buildCommand(getgopath(), options.cwd || '')
    const buildArgs = [command]
    let outFile
    if (command === 'build') {
      outFile = this.outFile()
      buildArgs.push('-o')
      buildArgs.push(outFile)
    }
    const additionalArgs = atom.config.get('go-plus.config.additionalBuildArgs')
    if (additionalArgs && additionalArgs.length) {
      const parsed = argparser(additionalArgs)
      buildArgs.push(...parsed)
    }

    // Include the -i flag with go install.
    // See: https://github.com/mdempsky/gocode/issues/79
    if (command === 'install' && !buildArgs.includes('-i')) {
      buildArgs.push('-i')
    }

    buildArgs.push('.')
    this.output.update({
      output: 'Running go ' + buildArgs.join(' '),
      exitcode: 0
    })

    const r = await this.goconfig.executor.exec(cmd, buildArgs, {

yargs-parser

the mighty option parser used by yargs

ISC
Latest version published 2 years ago

Package Health Score

77 / 100
Full package analysis