75lb / command-line-args

A mature, feature-complete library to parse command-line options.
MIT License
679 stars 107 forks source link

How to set a boolean value that defaults to true to false. #113

Closed LiamKarlMitchell closed 3 years ago

LiamKarlMitchell commented 3 years ago
{ name: 'dryrun', type: Boolean, defaultValue: true, description: 'Prevents writing changes' },

I tried --dryrun=false --dryrun=0 --dryrun=n --dryrun false

Ended up just using Number type argument.

https://github.com/75lb/command-line-args/blob/master/lib/argv-parser.mjs#L45 Could this be modified to check if there is an attached value and if so if its truthy set to true falsey set to false?

75lb commented 3 years ago

Already answered here