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
pub run
syntax not optimzed for common use cases
#22129
Comments
This comment was originally written by @seaneagan Next best would be just having: pub run foo run |
This comment was originally written by @seaneagan Also, it would be more consistent with pub global run foo These should be equivalent: pub run foo |
I agree that "pub run grinder" should run "pub run grinder:grinder", but I don't think we should make it more difficult to run local scripts. The behavior I'd like for "pub run $ident" would be to look for "bin/$ident.dart" in the local package first, and if that doesn't exist run "bin/$ident.dart" in the $ident package. |
This comment was originally written by @seaneagan I like your shadowing proposal, though I'd tweak it to look in "tool" instead of "bin" in the local package. For example, with grinder the convention is to put your grinder script at "tool/grind.dart" (which could easily be changed to "tool/grinder.dart"), not "bin/grinder.dart". |
Bob and I talked about this and we think you're right. We'd like a different syntax for running local executables, though; "pub run $path" should run a local executable at $path if $path isn't a Dart identifier (presumably because it contains directory separators and/or file extensions). This will be a breaking change for running local packages, though, which means we should first add a deprecation message for the old "pub run $ident" syntax that points to the new syntax. If you want to take a crack at this, Sean, we'd welcome your help. |
This comment was originally written by @seaneagan So, these would be equivalent: pub run foo regardless of whether the local package has any foo scripts. And to run a local script you must specify the containing directory: pub run bin/foo Sounds good to me, though it might be nice not to have to specify "tool/" by using the shadowing logic. I would love to help out with that change, but I may wait to see if the pub code base moves to github as that'd make it much easier for me. |
I don't think primary pub development is moving to GitHub in the near future, unfortunately. It needs to access dart2js's source, which is tightly tied to the repo. If you'd like to use git, though, you could use the GitHub mirror of the repo: https://github.com/dart-lang/bleeding_edge/ |
r44819 implements this with a deprecation warning. I'm going to keep this issue open until after 1.10 is released, at which point we should remove the deprecation warning. Added Accepted label. |
This issue has been moved to dart-lang/pub#1235. |
This issue was originally filed by @seaneagan
Currently to run grinder using pub run, it's:
pub run grinder:grinder
This may be somewhat subjective, but running scripts exposed by other packages
bin
directories like this seems like the most common use case, however the most convenient syntax:pub run foo
currently runs a script from the current (in development) package's
bin
dir, which I can't think of many use cases for, since generally during development you want to run scripts from yourtool
directory.I think the ideal would be to have:
pub run grinder
be short for:
pub run grinder:grinder
which runs the grinder package's
bin/grinder.dart
. Then to run scripts in the current packagetool
dir it could be:pub run :script
or to run a script in another directory of the current package:
pub run :test/test
The text was updated successfully, but these errors were encountered: