-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warn when fail to parse cmd line args. Close #1082 #1090
Warn when fail to parse cmd line args. Close #1082 #1090
Conversation
Print a warning when fail to parse command line args with Argu. We still fall back to try and run with the pre-2.1.8 argument style. Extracted exception formatting from the traceException function, so it could be used when tracing an exception as a warning. This should help avoid confusion, as witnessed in fsprojects#1072 and fsprojects#594.
WIP Warn when fail to parse cmd line args. Close #1082
oups I merged WIP. Should I revert? |
I think it should work OK, so maybe leave it in and see what happens if/when people notice it? |
I think that message is incorrect |
This is doing what I expect, because the invocation Currently we try and parse with Argu. If that fails, we fall back to the pre-Argu CLI code. In the example here, Argu has failed and we show a warning, because you are not using the Argu based CLI. For example, with Argu, you'd use I was aiming for this warning to point out that you're using the pre-Argu CLI, so you could change to the Argu style. Hence I would expect it to show here. However, to complicate this, the Argu configuration does not currently support multiple targets like you are issuing here. I could remedy this though. Make sense? Happy to Skype/Hangout if not, would be good to get it sorted. |
CompileAlone is just a build script parameter. Looks like we introduced deeper issues |
Just to confirm though, your build should have still run fine. Did it? The only new thing here is a warning. If there are deeper issues, they were introduced when the Argu code was merged. Try |
On the positive side, I'm happy that the warning is shining a light on the confusion! |
Yes the build runs fine (for couple of years now)
|
Yes, so only the warning is new. Is it possible to try |
The thing is: I will have to change 160 build configs ;-) 2016-01-21 12:56 GMT+01:00 Ben Taylor [email protected]:
|
Understood. I wasn't expecting you to do that, just wanted to know if it does actually work in your scenario. If there is any easy way to try one, let me know how it goes. I'll start thinking about what we can do to sort things out! |
yeah it actually works. but I wished we can keep that part of the syntax and just remove things that are really a conflict |
Makes sense. I could probably pre-parse to look for this part of the syntax and convert it to the Argu style. Could trace the conversion too, so people could see. Will have a look when back at the mill. |
I was pointed here by @forki after pointing this change on the chat, so here are my 2c. Old style arguments are a lot more readable and when you use fake everyday in the command line they are really easy to type / use. I think that they should still work by default without warning or being deprecated. That's easy to type & remember : fake test WithCoverage only Database=foo (In our scripts The new version is a lot less rememberable : fake test -ef WithCoverage -ef only -ev Database foo In our specific case we always wrap So the conversion, allowing a mix of both worlds would be a perfect solution 👍
|
Thanks for writing up your 2c. It's my fault, because I should have included the warning in the original 2014 PR, or made it more clear that backwards compat was only about not breaking existing scripts. It did not include support for mixing the two, because the original PR was done to support the How about this. A PR that:
This PR would eliminate the warning you see AND kill off any problems with people mixing, which is not currently supported. It should also be fairly simple, assuming the switches are available from the Argu API. We could then take time and look if a blend might work. Perhaps we could take the original style and convert them into Argu style, so we don't have two CLI parsers? I'm not sure how easy this would be, but the first PR would give us time and keep things correct for those people that are mixing and getting confused. |
The proposed PR seem good as a first step to allow old style argument when only them are provided and make clear that for now mixing isn't supported. |
* Fail build when Argu parse fails AND Argu switches detected. See fsprojects#1090. * Fallback to old if parse fails and no Argu switches. * Also as WIP function to map from old to new. NOT TESTED YET OR IN * USE. * Add Argu to test project for tests.
* Fail build when Argu parse fails AND Argu switches detected. See fsprojects#1090. * Fallback to old if parse fails and no Argu switches. * Also as WIP function to map from old to new. NOT TESTED YET OR IN * USE. * Add Argu to test project for tests.
* Fail build when Argu parse fails AND Argu switches detected. See fsprojects#1090. * Fallback to old if parse fails and no Argu switches. * Also as WIP function to map from old to new. NOT TESTED YET OR IN * USE. * Add Argu to test project for tests.
Print a warning when fail to parse command line args with Argu. We still fall back to try and run with the pre-2.1.8 argument style.
Extracted exception formatting from the traceException function, so it could be used when tracing an exception as a warning.
This should help avoid confusion, as witnessed in #1072 and #594.
It looks like the image below. This was the result of
ben.fsx target=Bob -st
, which is a mix of the old and new. It is traced as a warning, but the text saysError parsing command line arguments...
, so I'm not sure about the use of the word Error here. We show the error and then in green, explain we are trying to fallback. It would be good to get feedback on if this actually makes sense when you read it!