args icon indicating copy to clipboard operation
args copied to clipboard

Support "/" options on Windows, and "/?" for help

Open DartBot opened this issue 9 years ago • 4 comments

<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="96" height="96"hspace="10"> Issue by munificent Originally opened as dart-lang/sdk#19806


Right now, args follows Unix conventions (such as they are) for option syntax. Many Windows applications also do that, but Windows also has its own rough conventions. Some don't play nice with what args already supports, but I think we should allow:

  1. "/?" as an alias for "--help".
  2. Long and short options can start with "/" instead of "-" and "--". Combined short options are not supported, so "/foo" is always "--foo" and never "-f -o o".
  3. ":" as a parameter separator, as in "/output:somefile.txt". This will only be supported when the prefix is "/".

DartBot avatar Jun 05 '15 22:06 DartBot

<img src="https://avatars.githubusercontent.com/u/103167?v=3" align="left" width="48" height="48"hspace="10"> Comment by srawlins


I think it would be crazy unexpected if on a non-Windows system, args parsed arguments starting with a / as an option. IE:

my_dart_script --foo=bar /baz

If my_dart_script happens to also have an option "--baz" defined, it should not read "/baz" as an option! I suggest using Platform.isWindows for this feature. This is still a little wonky, however, because then Window folks would still be able to supply options with -- and with /, so the above example is just as confusing, but only for Windows folks.

DartBot avatar Jun 05 '15 22:06 DartBot

<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent


Yeah, I don't think we should support any of this on non-Windows platforms. Platform.isWindows is probably the right approach, but note that that's a breaking change for args. Currently, it doesn't import anything except "dart:io" and it can be used outside of the standalone VM.

DartBot avatar Jun 05 '15 22:06 DartBot

Uri.base can be used now to determine the operating system without importing dart:io.

nex3 avatar Jun 06 '15 00:06 nex3