-
Notifications
You must be signed in to change notification settings - Fork 21
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
Expose shared options from sub-task to CLI flags #17
Comments
Would it make sense to instead list all shared options in the global options list always? |
That's a good question. The way it currently works is that global options are attached to the For the following tasks:
foo:
options:
bar: {}
run: echo "${foo}" The # valid
tusk foo --bar
# invalid
tusk --bar foo And the shared options at the top work exactly the same as the task-specific options defined in the task in terms of CLI accessibility. This allows I'd also be hesitant to display it in the task-specific section because it could lead to confusing help messaging. For example, let's say there's a Is this issue a limitation you've run into? It's a use case I haven't hit in my own personal experience, but I probably knock out proper support in the next couple weeks if it would be useful on your end. |
I get that, and I get that it's also good to leave a space where tusk can add new options without risking name conflicts with potential tusk-file shared options. If shared options where to appear before the task, then such conflicts must be handled, e.g. by letting the tuskfile options override the tusk ones. I guess the design you describe in the issue description is perhaps still the best choice. It does mean tusk users can't define global options, and perhaps that's OK.
It's not a priority for us. I did hit a case where I wanted to use shared options, and would want the help text to be displayed. However, with tusks excellent support of arguments, when statements and more, it was easy enough to redesign so that shared options where not needed. E.g. for multiple deploy targets, use |
Currently, a shared option is only exposed if the task that is directly invoked requires that option. While task-specific options can be set on the sub-task, there is no way to allow a shared option to be configurable from the parent task unless the parent task happens to use it.
For example, for the following config file, while
single
anddouble
are configurable,mytask
is not:To preserve the ability to dynamically call sub-tasks through interpolation, it is not possible to know what sub-task shared options will be needed for a task when help documentation is generated.
One possible solution is to allow tasks to list shared options that should be exposed, most likely using one of these syntaxes:
The text was updated successfully, but these errors were encountered: