-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
This code
const argv = require('yargs')
.choices('user', ['Goofy', 'Miky'])
.coerce('user', user => {
switch (user) {
case 'Goofy': return {
firstName: 'Mark',
lastName: 'Pipe'
}
case 'Miky': return {
firstName: 'Elon',
lastName: 'Stone'
}
}
})
will fail because choices will run after coerce. But should it be this way? The obvious purpose of choices is to validate user input but not a generated value. And it would be very good if we will have an opportunity to validate user input and then build some useful value base on it
Reactions are currently unavailable