You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in some cases a default value for an argument might be from an env. variable (or otherwise computed), in which case using a .default(process.env.FOO) would a) result in bad ux for the user in --help (they wouldn't know where the value comes from), and b) might be expensive
currently the workaround is to keep the argument as optional, put the default value description in the .desc() and use ?? in handler/transform function, which adds a bit of boilerplate
i propose an overload for the .default() method that would accept a function and optionally a textual description of what happens there:
in some cases a default value for an argument might be from an env. variable (or otherwise computed), in which case using a
.default(process.env.FOO)
would a) result in bad ux for the user in--help
(they wouldn't know where the value comes from), and b) might be expensivecurrently the workaround is to keep the argument as optional, put the default value description in the
.desc()
and use??
in handler/transform function, which adds a bit of boilerplatei propose an overload for the
.default()
method that would accept a function and optionally a textual description of what happens there:The text was updated successfully, but these errors were encountered: