function parameterDeclarationToYargs (yargs, parameter, declaration) {
  const optionName = _.kebabCase(parameter)

  let option = {}
  if (declaration.description) {
    option.describe = declaration.description
  }
  if (declaration.type) {
    if (declaration.type === 'integer') {
      option.type = 'number'
    } else {
      option.type = declaration.type
    }
  }
  if (declaration.enum) {
    option.choices = declaration.enum
  }
  if (declaration.default) {
    option.default = declaration.default
  }
  if (declaration.required) {
    option.demandOption = declaration.required
  }
  if (declaration.conflicts) {
    option.conflicts = declaration.conflicts
  }
  yargs.option(optionName, option)

  yargs.coerce(optionName, (value) => {
    if (declaration.type === 'array') {
      return _.map(value, (value) => {
        return validateParameterValue(`${optionName}[]`, declaration.item, declaration.format, value)
      })
    }

    return validateParameterValue(optionName, declaration.type, declaration.format, value)
  })
}
function parameterDeclarationToYargs (yargs, parameter, declaration) {
  const optionName = _.kebabCase(parameter)

  let option = {}
  if (declaration.description) {
    option.describe = declaration.description
  }
  if (declaration.type) {
    if (declaration.type === 'integer') {
      option.type = 'number'
    } else {
      option.type = declaration.type
    }
  }
  if (declaration.enum) {
    option.choices = declaration.enum
  }
  if (declaration.default) {
    option.default = declaration.default
  }
  if (declaration.required) {
    option.demandOption = declaration.required
  }
  if (declaration.conflicts) {
    option.conflicts = declaration.conflicts
  }
  yargs.option(optionName, option)

  yargs.coerce(optionName, (value) => {
    if (declaration.type === 'array') {
      return _.map(value, (value) => {
        return validateParameterValue(`${optionName}[]`, declaration.item, declaration.format, value)
      })
    }

    return validateParameterValue(optionName, declaration.type, declaration.format, value)
  })
}
function parameterDeclarationToYargs ( yargs , parameter , declaration ) { const optionName = _ . kebabCase ( parameter ) let option = { } if ( declaration . description ) { option . describe = declaration . description } if ( declaration . type ) { if ( declaration . type === 'integer' ) { option . type = 'number' } else { option . type = declaration . type } } if ( declaration . enum ) { option . choices = declaration . enum } if ( declaration . default ) { option . default = declaration . default } if ( declaration . required ) { option . demandOption = declaration . required } if ( declaration . conflicts ) { option . conflicts = declaration . conflicts } yargs . option ( optionName , option ) yargs . coerce ( optionName , ( value ) => { if ( declaration . type === 'array' ) { return _ . map ( value , ( value ) => { return validateParameterValue ( ` ${ optionName } ` , declaration . item , declaration . format , value ) } ) } return validateParameterValue ( optionName , declaration . type , declaration . format , value ) } ) }
Converts parameter declaration to yargs
Converts parameter declaration to yargs