Open Jaymon opened 1 year ago
I think I could also add a prompt
param that if set to to True would prompt for the value also, so the order of operation would be:
environ_key
or environ_name
paramprompt
is TrueThinking about this a little more, for environment variables:
@arg("--foo", "-f", "$FOO")
Which basically says you can get the argument from the --foo
or -f
flags or the FOO
environment variable.
And for the prompt, I think maybe something like this?
@arg("--foo", missing=prompt)
Where the missing
argument can take a callback or something. Likewise, maybe:
@arg("--foo", action="prompt")
Would say that the foo
value should prompt for a value? Or maybe the action should be prompt_if_missing
or something like that.
It would be cool to make it easier to set a value either through the command line or through the environment, so something like:
Could work like this:
or like this:
and it would do all the requirement checking and things like that, so:
would fail because
--foo
wasn't passed in.I might not even need something like
@envarg
, it might be good enough to just pass inenvsrc
into the@arg
decorator