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
Global arguments should have a way to provide a limited set of choices or a type coercion for the application.
Two examples are the built-in --verbosity, which has a limited set of choices, and charmcraft's --project-dir, which provides a validator:
verbosity=GlobalArgument(
"verbosity",
"option",
None,
"--verbosity",
"Set the verbosity level to 'quiet', 'brief', 'verbose', 'debug' or 'trace'",
choices=[mode.name.lower() formodeinEmitterMode],
)
project_dir=GlobalArgument(
"project_dir",
"option",
None,
"--project_dir",
"Set the base directory for the project.",
validator=pydantic.DirectoryPath,
)
choices matches argparse, validator is chosen instead of type since that's already used.
Why it needs to get done
Right now an app needs to parse and provide error messages for this by itself, but craft-cli can often do this itself.
The text was updated successfully, but these errors were encountered:
What needs to get done
Global arguments should have a way to provide a limited set of choices or a type coercion for the application.
Two examples are the built-in
--verbosity
, which has a limited set of choices, and charmcraft's--project-dir
, which provides a validator:choices
matches argparse,validator
is chosen instead oftype
since that's already used.Why it needs to get done
Right now an app needs to parse and provide error messages for this by itself, but
craft-cli
can often do this itself.The text was updated successfully, but these errors were encountered: