Refactor grinderArgs()
- Dominant language
- Dart
- Stars
- 266
- Forks
- 36
- Avg merge
- 23h 25m
- Merged PRs (30d)
- 2
Description
The purpose of `grinderArgs()` it is to be able to access custom command-line arguments from tasks. However, package:args [currently doesn't allow](http://dartbug.com/14786) 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:
- including help text for them via `grind -h`
- validating custom command-line arguments with task arguments.
It would be really cool to reuse [unscripted](https://pub.dartlang.org/packages/unscripted)'s `Flag` and `Option` annotations:
``` dart
@Task('Deploy the project.')
deploy(
@Option(allowed: const ['local', 'ci', 'test', 'prod'], help: 'Which environment to deploy to.')
String env) {
// ...
}
```
Then `grind -h` would include something like:
```
[deploy] Deploy the project.
--env Which environment to deploy to.
```
If we do keep `grinderArgs()`, I think it should be a getter, and probably move it to `GrinderContext`, or integrate with whatever solution we do for dart-lang/core#31.
Contributor guide
Assessment
This issue has not been assessed yet.