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

Discover and inject task parameters #286

Open
seaneagan opened this issue Jul 9, 2015 · 0 comments
Open

Discover and inject task parameters #286

seaneagan opened this issue Jul 9, 2015 · 0 comments

Comments

@seaneagan
Copy link
Contributor

Followup of #281 in support of #175.

@Task annotated methods will be able to use the same exact API as unscripted to define method parameters that represent positionals, options, and flags, and have those discovered and injected with command-line arguments.

For example:

@Task()
bump(
    @Positional(help: 'The type of release being performed.', allowed: const ['major', 'minor', 'patch', 'build', 'release'])
    String releaseType),
    {@Option(help: 'Do a pre-release with this prefix e.g. "dev"')
     String preId,
     @Flag(help: 'Whether to do a pre-release')
     bool pre} {
  var args = ['bump', releaseType];
  if (pre) args.add('--pre');
  if (preId != null) args.addAll(['--pre-id', preId]);

  new PubApp.global('den').run(args);
}

As in unscripted, all metadata (Positional, Option, Flag and their parameters) is optional.

This will require a lot of the same code existing in unscripted, so I may need to factor that out into a shared library or package along with some of the code that went in in #281.

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