-
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
Fix fromRawWindowsCommandLine
(now fromRawCommandLine
), fixes #2197
#2206
Conversation
@@ -178,7 +178,7 @@ let testCases = | |||
let assemblies = [ Guid.NewGuid().ToString() ] | |||
let proc = FxCop.composeCommandLine p assemblies | |||
let expected = | |||
sprintf """%s /c "/f:\"%s\"" "/o:\"%s\"" /s /v""" dummy | |||
sprintf """%s /c /f:\"%s\" /o:\"%s\" /s /v""" dummy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like there was a slight behavior change here. @SteveGilham I hope this still works. Actually I'm a bit puzzled that this even works with the argument containing the quoted quotes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The escaping of quotes is required when they fall within a quoted parameter, and only then.
This style works
"/o:\"_Reports/FxCopReport.xml\""
and this style works
/o:"_Reports/FxCopReport.xml"
but this one (the one as per the diff above) doesn't
/o:\"_Reports/FxCopReport.xml\"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this command line style is similar to the problem this PR tries to solve (#2197)
Does fxcop
accept "/o:_Reports/FxCopReport.xml"
(ie without the inner quotes)?
Which would simplify this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes (with the proviso that the file name contains no spaces).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So "/o:_Reports/with space/FxCopReport.xml"
doesn't work even it is correctly escaped and given to fxcop as single argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"/o:_Reports/with space/FxCopReport.xml"
works it's /o:_Reports/with space/FxCopReport.xml
that, of course, doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok thanks for confirming, than we should do it like ed0bb86.
I think this is actually ready, but I'd like to wait until @vbfox reviews and gives feedback about |
Concat API is made for being piped and it's ordering is weird if not used like that... It's documented but I admit it's weird. I'm tempted to align the lib to the standard modules naming, renaming |
So in the end I won't change Append but i'll change concat signature to go with the |
(Breaking change, see fsprojects/FAKE#2206 for the confusion created by the previous API)
Ok 1.0.0 published, let's see ! |
{ Args = a.Args |> CmdLine.appendSeq s } | ||
//Arguments.OfArgs(Seq.append a.Args s) | ||
|
||
/// Forward API from https://github.com/vbfox/FoxSharp/tree/master/src/BlackFox.CommandLine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I understand why but it mean that the API in FAKE might diverge at some point.
Also you're losing both the "." style API and doc comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the APIs diverge something most likely breaks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I was not speaking about breakage, mostly playing catch-up with whatever is added on one side needing an equivalent PR on the other
let fromArray s = { Args = CmdLine.fromArray s } | ||
let toList (a:Arguments) = CmdLine.toList a.Args | ||
let toArray (a:Arguments) = CmdLine.toArray a.Args | ||
let toStringForMsvcr e (a:Arguments) = CmdLine.toStringForMsvcr e a.Args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a little too low level.
If you wrap, maybe add a fromCmdLine
or something and users can go to my lib directly if they need advanced features
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I just don't want people to convert back and forth ... Maybe with a different entry point? (see new changes)
Co-Authored-By: matthid <[email protected]>
Well, I hope you are a bit more careful with releasing breaking changes in the future ;) |
/// |> CreateProcess.fromCmdLine "dotnet.exe" | ||
/// |> Proc.run | ||
/// |> ignore | ||
let fromCmdLine command args = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vbfox Maybe that is Okish if we says fake only has build-in APIs for working with argument lists and properly escaping them and other weird stuff (or the builder-API) is external
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that but i'm not 100% objective on the subjects :)
It also suggest that other builder libraries could happen.
If needed I can produce another package with only the escaping part completely separate from the builder one. FAKE core would then depend on it and each FAKE package could use whatever builder it wants.
Not sure it's worth the complexity but it's doable
Honestly, somehow I'm a bit nervous with this change. Probably because the dependency is "out of control" and a potential source of breakage at the very core ;) |
I feel like something that is so core to fake should preferably be included out ouf the box. Every module should probably use this api in the long run, so having a bit more control might be nice. |
I'll follow SemVer as much as I can so not before 2.0 ;) whenever it's soon or not will depend on problems found XD Anything less than 1.0 is free for all (That's also why I bumped VsWhere, no way to change it now it's too used) |
I can't really help much on that part, taking dependencies is always a risk. And it's also a bit scary for me too. I added you as a collaborator on the repo (There is also VsWhere that FAKE references) so if you ends up using it we can work together keeping the lib compatible. |
@vbfox Also related: We could include the thing via paket-files, but that is not something I'd like to do for various reasons (just something I wanted to mention here) |
Well I use it in FAKE libraries but also in code not linked to FAKE at all and Now why FAKE shouldn't copy paste the code, then include it I don't have any good reason except maintenance (Always the consequence of NIH syndrome).
Once you have a command line string, the framework contains a perfectly suitable class to start a process ;) |
@matthid we can discuss on gitter/slack whatever if you want |
It's a bit of an outside discussion, but it was one of the design goals to be able to use the packages standalone which we didn't achieve apparently. It would be nice if you could elaborate on that (either here or a separate issue). However that is only partially related to this.
Sure, feel free to ping me :). However, there shouldn't be the impression that I own fake and need to be convinced. In fact it feels like there might be a deeper issue (maybe with how I maintain the repository?!) which we hopefully uncover with the discussion above. Personally, I'm probably fine with merging as is, but I can see users asking why they need to use some other component to build command lines or Also the aspect from @kblohm |
…s workaround for #2197 and usage of external libraries like https://github.com/vbfox/FoxSharp/tree/master/src/BlackFox.CommandLine
OK I think I have figured out how I want to do this. Basically the problem of #2197 was that there is no "raw" API. With the most recent commit I changed If there is no reason against this change this is probably how I want to do it. What do you think @vbfox and @kblohm ? I also added documentation on how you can use BlackFox.CommandLine with this "fixed" API. |
👍, It does a double parsing when an external lib is used but it can be removed if needed and that's not much of an issue. I'm a fan of small libs & compositions 😉 |
fromRawWindowsCommandLine
(now fromRawCommandLine
), fixes #2197
I feel like support to build commandline-arguments should be included. Starting external processes is one of the main use-cases of FAKE, so it should be as easy as possible.
Consistency does make it easier to get started. I looked into some of the existing modules before i started on one and all of them did the command-line stuff differently. At least for first time contributors, a dedicated way of doing all the command-line-building would make it easier. |
Description
/cc @vbfox