-
Notifications
You must be signed in to change notification settings - Fork 14
Address #27 from fsprojects/Projekt #32
base: master
Are you sure you want to change the base?
Address #27 from fsprojects/Projekt #32
Conversation
@baronfel: thanks a lot for taking a look at this. How do you think your approach affects the ease of automatically generating the docs from the usage text like Paket does? At the moment I copied and pasted manually into https://github.com/fsprojects/Projekt/blob/master/docs/content/index.md, but I'd like to avoid that in the future. |
This library will also do the automatic command line usage generation. The 'description' attribute parameters on the verbs and options are what is used automatically. I can post a screenshot here later after a few pints ;) I think I like this library a bit more than the current rev of UnionArgsParser for verbs. |
So this is what it looks like out of the box. But using the included API I can make this look however you like. Any pointers/requests? I'm guessing to keep it like the previous version? |
…ew parser lib work
Looks ok to me however I'd like the code formatting to follow common formatting guidelines a bit closer: https://github.com/dungpa/fantomas/blob/master/docs/FormattingConventions.md, especially around records. Some lines are also a bit too long. Try keeping them below 120 if possible. |
…Also could purge the version Operation because the new args lib handles that.
Is this more in line? I was able to condense some of the long lines as well as correct the newline/braces situation with the records. I also forgot to annotate the positional parameters with MetaNames, so now the positional parameters have help entries. |
| None -> Library | ||
| _ -> failwith "invalid template argument specified" | ||
[<Verb("init", HelpText = "create a new project")>] | ||
type public InitOptions = |
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.
no need for the 'public' accessor
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.
thanks, will fix.
Ok, this commit should address the pieces that you brought up. Thanks for the detail there. |
@@ -1 +1,2 @@ | |||
UnionArgParser |
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.
Can this be removed?
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 missed it when I purged it from the top-level paket.references.
SourceFiles="@(Templates)" | ||
DestinationFolder="$(OutputPath)\templates\%(Templates.RecursiveDir)" | ||
/> | ||
<Copy SourceFiles="@(Templates)" DestinationFolder="$(OutputPath)\templates\%(Templates.RecursiveDir)" /> |
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 Templates ItemGroup has been removed so this doesn't work anymore.
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.
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 had that problem with VS as well, but I don't normally use VS! I just tried splitting it into a separate file, so create a new Template.targets
:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Templates Include="$(SolutionDir)\templates\**\*.*" />
</ItemGroup>
</Project>
and use <Import Project="Template.targets" />
. Does that trick VS?
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.
Yeah, that worked. So this is one of those times where I begin to realize how much I don't know. Does msbuild not evaluate the Imported elements with the same level of rigor as top-level nodes?
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.
No it absolutely does, but msbuild understands the wildcard perfectly well, I was hoping that the over-eager VS check was implemented separately.
I really like the look of this! Thanks a lot for the PR. Could you tidy the help output up a bit more though please?
|
| ToLower "up" -> Up | ||
| ToLower "down" -> Down | ||
| _ -> failwith "invalid direction specified" | ||
[<Verb("reference", HelpText = "reference a dll")>] |
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.
Currently this verb is for referencing projects. Referencing dlls is planned: #23 (@kjnilsson you fancy it?)
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'll clean that up for sure.
@rneatherway thanks for the feedback on the help text. What we've got there is completely out of the box, and I can customize it to a great extent. I'll spend some time making the text in line with your points. |
There's a bit of a roadblock with this PR, because the version of CommandLine.Parser that supports verbs doesn't allow for the same level of customization as previous versions. It used to be that you could hijack and overwrite the entire help generation, but now you can only use attributes and examples to guide the automatic generation of help usage, as briefly described in (this issue)[https://github.com/gsscoder/commandline/issues/116]. So I can't really address your concerns right now, @rneatherway. :( Maybe we put this one on the back burned for a bit until I or original dev can extend help generation. |
@baronfel that's a real shame, thanks a lot for taking the time to have a crack at this in any case. Hopefully it will be implemented soon, the project does seem to be actively developed right now and it's a fairly important thing. |
I took a pass at unifying the command line args according to issue #27 . I think CommandLine.Parser will work better for this case, due to the command -> verb -> options pattern this utility has.
I added a basic test that verifies that the new implementation is equivalent to the old implementation, but what I'd really like to do is write an FsCheck test that uses the Operation type to generate a command line string via the old parser, and then parse that string using the new parser and compare the resulting Operations.