-
Notifications
You must be signed in to change notification settings - Fork 36
Make it possible to add default subcommand #925
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
Conversation
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
PR HealthLicense Headers ✔️
All source files should start with a license header. This check can be disabled by tagging the PR with API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with
Breaking changes
|
| Package | Change | Current Version | New Version | Needed Version | Looking good? |
|---|---|---|---|---|---|
| args | Breaking | 2.7.0 | 2.8.0 | 3.0.0 Got "2.8.0" expected >= "3.0.0" (breaking changes) |
This check can be disabled by tagging the PR with skip-breaking-check.
Coverage ⚠️
| File | Coverage |
|---|---|
| pkgs/args/lib/command_runner.dart | 💚 97 % ⬆️ 0 % |
| pkgs/args/lib/src/allow_anything_parser.dart | 💔 67 % ⬇️ 11 % |
| pkgs/args/lib/src/arg_parser.dart | 💚 94 % |
| pkgs/args/lib/src/parser.dart | 💚 99 % ⬆️ 0 % |
This check for test coverage is informational (issues shown here will not fail the PR).
This check can be disabled by tagging the PR with skip-coverage-check.
Changelog Entry ✔️
| Package | Changed Files |
|---|
Changes to files need to be accounted for in their respective changelogs.
This check can be disabled by tagging the PR with skip-changelog-check.
|
A was looking at adding a subcommand to I think this is the simplest way. Can you take a look @lrhn? (You commented before on #103 :) ) |
natebosch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to model this as picking a default named subcommand, instead of adding a single unnamed subcommand? The usage string is probably awkward to formulate either way, but it might be a little easier to show a default in the list of commands than to split the subcommand/no subcommand usage.
Allow designating a top-level command or a subcommand as a default one by passing `isDefault: true` to `addCommand` or `addSubcommand`. Default command will be selected by argument parser if no sibling command matches. This allows creating command line interfaces where both `program command` and `program command subcommand` are runnable Fixes dart-lang#103
|
Thanks for the review @natebosch
Yeah, I think this is a much better model. I have rewritten code to match this model. Can you take another look? |
|
@natebosch Thanks! Can you take a final look, as I was doing the final testing I realized that behavior of I have now changed the code to make Does this change look reasonable to you? Thanks. (I have also updated pubspec.yaml and CHANGELOG.md to remove |
Good catch. Yes that sounds like the right behavior to me.
We'll want to make sure it lands smoothly in the Dart SDK repo and in google3 before we publish. https://github.com/dart-lang/sdk/blob/main/docs/External-Package-Maintenance.md#publishing-a-package Let me know if you'd like me to help with that. |
|
Thanks.
Ah! I actually got it backwards in my head for some reason. I was thinking I need to publish before the roll, but it makes sense that I need to roll it first. (roll is actually the only thing I care about - because I want to use this in the SDK :)) |
Make it possible to add default subcommand (designated by an empty
name) for a branch command: default subcommand will be run when no other
subcommand is selected. This allows creating command line interfaces
where both
program commandandprogram command subcommandarerunnable.
Fixes #103
Contribution guidelines:
dart format.Many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.
Note: The Dart team is trialing Gemini Code Assist. Don't take its comments as final Dart team feedback. Use the suggestions if they're helpful; otherwise, wait for a human reviewer.