-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Type: FeatureNew feature or request.New feature or request.
Description
- The following client code should work (see pydantic.BaseSettings for more information on pydantic's settings management):
### dummy.py
import clap
class Context(clap.Context):
foo: str
bar: int = 4
def run(ctx: Context) -> int:
assert isinstance(ctx.foo, str)
assert isinstance(ctx.bar, int)
return 0
main = clap.main_factory(run)- The
fooandbararguments should be derived from the following sources, ordered from least-preferred to most-preferred:- Default value (if specified) in Context class.
- Global YAML configuration file (e.g.
~/.config/clap.yml). - Project-specific YAML configuration file (e.g.
dummy.yml). - Environment variables (e.g.
DUMMY_FOOorDUMMY_BAR) or .env file(s). - Command-line arguments (e.g.
-f|--fooor-b|--bar).
Metadata
Metadata
Assignees
Labels
Type: FeatureNew feature or request.New feature or request.