{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/pub/issues/1020","labels_url":"https://api.github.com/repos/dart-lang/pub/issues/1020/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/pub/issues/1020/comments","events_url":"https://api.github.com/repos/dart-lang/pub/issues/1020/events","html_url":"https://github.com/dart-lang/pub/issues/1020","id":85645571,"number":1020,"title":"Ability to detect `pub run` environment","user":{"login":"DartBot","id":8958862,"avatar_url":"https://avatars.githubusercontent.com/u/8958862?v=3","gravatar_id":"","url":"https://api.github.com/users/DartBot","html_url":"https://github.com/DartBot","followers_url":"https://api.github.com/users/DartBot/followers","following_url":"https://api.github.com/users/DartBot/following{/other_user}","gists_url":"https://api.github.com/users/DartBot/gists{/gist_id}","starred_url":"https://api.github.com/users/DartBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DartBot/subscriptions","organizations_url":"https://api.github.com/users/DartBot/orgs","repos_url":"https://api.github.com/users/DartBot/repos","events_url":"https://api.github.com/users/DartBot/events{/privacy}","received_events_url":"https://api.github.com/users/DartBot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dart-lang/pub/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/dart-lang/pub/labels/NotPlanned","name":"NotPlanned","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-06-05T22:20:16Z","updated_at":"2015-06-05T22:20:18Z","closed_at":null,"body":"<a href=\"https://github.com/seaneagan\"><img src=\"https://avatars.githubusercontent.com/u/444270?v=3\" align=\"left\" width=\"96\" height=\"96\"hspace=\"10\"></img></a> **Issue by [seaneagan](https://github.com/seaneagan)**\n_Originally opened as dart-lang/sdk#19580_\n\n----\n\n\nAFAICT `pub run` will break unscripted's tab-completion feature:\n\n&nbsp;&nbsp;&nbsp;&nbsp;https://github.com/seaneagan/unscripted#tab-completion\n\nFor a script named 'foo.dart' the completion script it installs will reference `foo.dart` or `foo` depending on configuration.  But to work with `pub run` it would need to reference `pub run foo` during development, and `foo` during production.  So to support that I would need to be able to detect if the script is being run via `pub run`.  I think a nice way to support that would be a -D parameter, for example pub run could call one of the following:\n\n&nbsp;&nbsp;&nbsp;&nbsp;dart -Dpub.run=true foo.dart\n&nbsp;&nbsp;&nbsp;&nbsp;dart -Dpub.command=run foo.dart\n&nbsp;&nbsp;&nbsp;&nbsp;dart -Dpub.dev=true foo.dart\n\n(the latter 2 would allow supporting `pub serve` as well)\n\nI suppose I could add a hidden argument to all unscripted scripts and instruct my users to add it when using pub run:\n\n&nbsp;&nbsp;&nbsp;&nbsp;pub run foo --pub-run [other args]\n\nbut that is error prone and redundant.\n"},"comment":{"url":"https://api.github.com/repos/dart-lang/pub/issues/comments/109459879","html_url":"https://github.com/dart-lang/pub/issues/1020#issuecomment-109459879","issue_url":"https://api.github.com/repos/dart-lang/pub/issues/1020","id":109459879,"user":{"login":"DartBot","id":8958862,"avatar_url":"https://avatars.githubusercontent.com/u/8958862?v=3","gravatar_id":"","url":"https://api.github.com/users/DartBot","html_url":"https://github.com/DartBot","followers_url":"https://api.github.com/users/DartBot/followers","following_url":"https://api.github.com/users/DartBot/following{/other_user}","gists_url":"https://api.github.com/users/DartBot/gists{/gist_id}","starred_url":"https://api.github.com/users/DartBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DartBot/subscriptions","organizations_url":"https://api.github.com/users/DartBot/orgs","repos_url":"https://api.github.com/users/DartBot/repos","events_url":"https://api.github.com/users/DartBot/events{/privacy}","received_events_url":"https://api.github.com/users/DartBot/received_events","type":"User","site_admin":false},"created_at":"2015-06-05T22:20:18Z","updated_at":"2015-06-05T22:20:18Z","body":"<a href=\"https://github.com/seaneagan\"><img src=\"https://avatars.githubusercontent.com/u/444270?v=3\" align=\"left\" width=\"48\" height=\"48\"hspace=\"10\"></img></a> **Comment by [seaneagan](https://github.com/seaneagan)**\n\n----\n\nYep, and I'd like my users to be able to avoid explicitly running `pub run`\nat all by instead installing their in-development scripts (from \"path\"\npackages, not \"hosted\") to their PATH.  Then I can assume \"script [args]\"\nin all cases, and my users will be able to test their TAB-completion during\ndevelopment.  I'll add a comment to issue dart-lang/pub#970 to request it to support\n\"path\" dependencies, and then file a separate issue if issue dart-lang/pub#970 is\nmarked fixed without that feature.\n\nYou can go ahead and close this one out.  Thanks!"}}