mainargs icon indicating copy to clipboard operation
mainargs copied to clipboard

Flags optional arguments

Open steinybot opened this issue 1 year ago • 1 comments

Is it possible to have a flag with optional arguments?

I want to be able to pass --mirror and --mirror <path>. Either mirror is missing, present without a value, or present with a value.

steinybot avatar Aug 12 '24 06:08 steinybot

Currently it is not possible. It might be possible to implement, with some caveats (e.g. <path> would not be able to start with - or --, <path> would take precedence over mainargs.Leftover), but those may be OK tradeoffs for the convenience

lihaoyi avatar Aug 14 '24 17:08 lihaoyi