-
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
Suggestion: Docopt.Parse overload that takes list rather than array #2433
Comments
I think we could take this low-risk improvement. Is there any reason to not just add an IEnumerable/seq based overload? Regarding the docs: From the beginning I think it was not the best idea to only have the arguments available in the target callback instead of the script context. |
There has not been any activity in this issue for the last 3 months so it will be closed in 14 days if there is no activity. |
A seq-based overload would be the simplest from an API use point of view; I'll plan to do that. (I'd forgotten about this issue, which is why I haven't done that yet. PR coming soonish.) |
Still haven't forgotten about this, but I guess I didn't act on it fast enough for the bot. Reopen please, so I don't lose track of this? |
Closing this doesn't mean that a pull request is no longer welcomed. Quite the reverse: Feel free to send a pull request any time. |
There has not been any activity in this issue for the last 3 months so it will be closed in 14 days if there is no activity. |
Starting work on this now. |
Description
The
Docopt.Parse
method inFake.Core.CommandLineParsing
takes a string array as parameter, which is perfect for handling arguments retrieved viaTarget.getArguments()
. But when I experimented with getting the arguments out of theTargetContext
, where they're stored as a string list, I had to writeparser.Parse(p.Context.Arguments |> Array.ofList)
instead ofparser.Parse(p.Context.Arguments)
. It's just a trivial annoyance, but I would have liked to see aparser.Parse
overload that takes a string list. (Since it's a class method, overloading is possible and should be pretty trivial in this case).Expected behavior
I want to be able to write:
Actual behavior
I currently have to write this instead:
Notes
I know the FAKE docs currently say "Using the current parameter object is not supported yet" because APIs might change. But that actually makes me think of another possible solution, which would be to change the API of
TargetContext
. Specifically, make theTargetContext.Arguments
type to be a string array instead of a string list. Now, that's more complicated than my proposed overload to parser.Parse, which would only add a single line of code. But it might be a simplification; as I looked through the FAKE code for uses ofTargetContext.Arguments
that might have to change, I saw a lot ofList.toArray
calls, so perhaps it would be simpler all around forTargetContext.Arguments
to be a string array. Either way would make me happy. (And honestly, I wouldn't be unhappy if it was left as-is; it's a trivial thing to add aList.toArray
orArray.ofList
call when I need it. It's just a minor bit of friction that could be removed, that's all.)Related information
The text was updated successfully, but these errors were encountered: