Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there support for making invoke.yaml context settings cli flags? #984

Open
red8888 opened this issue Jan 24, 2024 · 0 comments
Open

Is there support for making invoke.yaml context settings cli flags? #984

red8888 opened this issue Jan 24, 2024 · 0 comments

Comments

@red8888
Copy link

red8888 commented Jan 24, 2024

CLI frameworks like Cobra work like this, your params aren't just settable as cli flags, but also in a config file.

It appears pyinvoke separates the two.

I can define cli flags on the individual funcs

@task
def show_config(ctx: Context, myflag: str, myotherflag: str):

But "configuration" is an entirely separate thing: https://docs.pyinvoke.org/en/latest/concepts/configuration.html

Is it at all possible to define flags as part of configuration like this:

ns = Collection()
col = Collection.from_module("my_module")
col.configure({"myflag": "default value", "myotherflag": "default value"})
ns.add_collection(col)

@task
def show_config(ctx: Context) # Have the decorator magically inject myflag and myotherflag from config

Is there a way I could add this myself if its not supported?

I looks like I can't expand a dict like this right?

d = dict(p1=1, p2=2)
@task
def my_cmd(ctx: Context, **d):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant