Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Incorrect -- passed to commands #81

Closed
victorhurdugaci opened this issue Apr 21, 2016 · 2 comments
Closed

Incorrect -- passed to commands #81

victorhurdugaci opened this issue Apr 21, 2016 · 2 comments

Comments

@victorhurdugaci
Copy link
Contributor

victorhurdugaci commented Apr 21, 2016

Today:

  • dotnet watch -> dotnet run
  • dotnet watch --exit-on-change -> dotnet run -- --exit-on-change
  • dotnet watch --exit-on-change -- --arg -> dotnet run -- --arg (and the watcher gets the argument --exit-on-change
  • dotnet watch --command publish -- -f net451 -> dotnet publish -- -f net451 (which is incorrect because publish doesn't accept --).

So, we've optimized watch to work simply with run but we've introduced two bugs:

  1. You cannot run commands that don't accept a -- (most of them)
  2. You cannot pass arguments to run, not to the app being published.

I propose we make the following change.

Keep the current behaviour for run:

  • No arguments -> dotnet run
  • dotnet watch <args> -> dotnet run -- <args>

Change the behaviour for --command to not assume that the command accepts --:

  • dotnet watch --command test -- --foo -> dotnet test --foo
  • dotnet watch --command run -- -f net451 -> dotnet run -f net451

These two commands are then equivalent:

  1. dotnet watch --foo
  2. dotnet watch --command run -- -- --foo (yes, there's a double --. The first -- separates the watcher arguments and the second one separates dotnet run arguments).

So, everytime you specify --command we pass whatever is after -- verbatim. If --command is not specified, we append -- and then pass the rest of the arguments.

cc @glennc @muratg

@muratg
Copy link

muratg commented Apr 22, 2016

@victorhurdugaci Is this blocking docker folks?

cc @danroth27

@victorhurdugaci
Copy link
Contributor Author

Yes, I was just writing an rc2 ask mode request. I have a fix for it. It's very simple

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants