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

Incorrect -- passed to commands #81

@victorhurdugaci

Description

@victorhurdugaci

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

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions