cmd-ts
cmd-ts copied to clipboard
Issues with flags
import * as cli from "cmd-ts";
cli.flag({
long: "skip",
type: cli.boolean, // First of all it's possible to specify type here. Unessesery I think.
defaultValue: () => true, // Default value gets printed in help but is not actually a default in handler.
defaultValueIsSerializable: true,
})
I encountered the same problem with the defaultValue on a flag.
Ahhhh okay. So the problem that defaultValue isn’t used?
Ahhhh okay. So the problem is that defaultValue isn’t used?
As far as I can tell, yes. In my case, If I want a flag to be turned on by default (i.e. be equal to true), when it is not specified in the arguments, it is false after parsing.