-
Notifications
You must be signed in to change notification settings - Fork 37
Refactor grinderArgs() #116
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
Comments
Refactoring it's meaning sounds good. We may want to hang the cli args on an instance of a |
Also, I think it'd be great to support positional arguments like this: @Task('Deploy the project.')
deploy(
[@Positional(allowed: const ['local', 'ci', 'test', 'prod'], help: 'Which environment to deploy to.')
String env = 'local']) {
// ...
} Which can be used in the CLI as:
|
I'll take this. I'm going to add support for positional args first e.g. |
I'm in favor of the traditional style. |
The disadvantage with the traditional style is that they are not syntactically scoped to individual tasks, yet they are meant to be consumed by individual tasks. So for one thing there can be conflicts between different tasks. However, traditional named args allow passing args to dependency tasks which don't show up on the command line. |
Awesome! This will be great to have. |
+1 |
I'm going to go with normal --options=... and --flags. However, I'm going to need to fix dart-lang/core#107 first to make it work. |
Update: I'll be starting on this as soon as I finish seaneagan/unscripted#40 which will allow more dynamic sets of options in unscripted, which is needed here. |
Starting on this. Rough plan:
|
The purpose of
grinderArgs()
it is to be able to access custom command-line arguments from tasks. However, package:args currently doesn't allow unknown options to be passed anyway (arg parsing will fail). Ideally a task could declare its own custom command-line options and flags. That would allow:grind -h
It would be really cool to reuse unscripted's
Flag
andOption
annotations:Then
grind -h
would include something like:If we do keep
grinderArgs()
, I think it should be a getter, and probably move it toGrinderContext
, or integrate with whatever solution we do for dart-lang/core#31.The text was updated successfully, but these errors were encountered: