fsprojects / Argu

A declarative CLI argument parser for F#
https://fsprojects.github.io/Argu
MIT License
451 stars 75 forks source link

fix(ArgumentParser): Correct default programName when run via wrapper #233

Closed bartelink closed 6 months ago

bartelink commented 6 months ago

When running via a wrapper such as dotnet or dotnet tool run (see https://github.com/fsprojects/Argu/pull/232 for more of the full scenario), the default logic derives the programName as dotnet, i.e. the exit error message becomes:

ERROR: unrecognized argument: 'equinox-common-test'.
USAGE: dotnet sync cosmos <snipped>

Another common case of this is that VS in ~2019 used to run in a wrapper, so the message would be correct if you Ctrl-F5 run, but not if you F5-run; who knows if that has changed...

bartelink commented 6 months ago

This is prompted by me carted along messy code that overrides this for years.

I removed my shims recently, having erroneously assumed it was fixed, so I'm proposing this breaking change, for better or worse!

If anyone is concerned this is too heavy a change, then I can make a new static method to opt-in, as laid out in https://github.com/fsprojects/Argu/issues/171#issuecomment-1951184161