Skip to content

bug: dashdash doesn't check if default values match the type of arg #43

Description

@ORESoftware

Say I have this:

const opts = [
 {
    names: ['force', 'f'],
    type: 'bool',
    help: 'Force everything (and say yes to everything).',
    default: 'foobar'  // should be a boolean, but we give a string
  }
]

last time I checked, dashdash will not complain.

I am guessing that this would also fly, etc:

const opts = [
 {
    names: ['force', 'f'],
    type: 'string',
    help: 'Force everything (and say yes to everything).',
    default:  [1,2,3]  // should be a string, but we have an array of numbers instead
  }
]

the type of the default value should match the type? Or perhaps at least log a warning?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions