cmd-ts icon indicating copy to clipboard operation
cmd-ts copied to clipboard

Issues with flags

Open elderapo opened this issue 4 years ago • 4 comments

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,
})

elderapo avatar May 09 '21 21:05 elderapo

I encountered the same problem with the defaultValue on a flag.

AurumTheEnd avatar May 24 '23 14:05 AurumTheEnd

Ahhhh okay. So the problem that defaultValue isn’t used?

Schniz avatar May 24 '23 20:05 Schniz

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.

AurumTheEnd avatar May 29 '23 12:05 AurumTheEnd