GitVersion
                                
                                
                                
                                    GitVersion copied to clipboard
                            
                            
                            
                        New CLI
Description
This is the PR for our new CLI. Resolves #2275. Please discuss the implementation there and not in this pull request.
Related Issue
#358, #428, #598, #572.
Motivation and Context
The CLI of GitVersion is a road that has been built as we have walked it, with no planning and no idea of scope or feature set before implementation was started. It has proved difficult to support POSIX file systems due to forward slash / being chosen as the argument separator originally, the argument system doesn't allow for easy documentation generation and perhaps most importantly: Argument parsing is not a core concern of GitVersion, so we're best served to outsource this entire thing to a third-party library.
How Has This Been Tested?
Nothing yet, but it will come.
Checklist:
- [x] My code follows the code style of this project.
 - [x] My change requires a change to the documentation.
 - [ ] I have updated the documentation accordingly.
 - [ ] I have added tests to cover my changes.
 - [ ] All new and existing tests passed.
 
Two things I've noticed --
In your examples you're showing commands like --command:arg. I think it's more usual to see --command arg, ex dotnet build -v DEBUG --runtime win-x64. This is pretty minor though.
Secondly, you're sort of parsing two arguments in one go, and I think this will bite you going forward.
Take the following:
gitversion write --from:file=gitversion.json --to:assemblyinfo=./**/AssemblyInfo.cs
I think this would be much better represented as:
gitversion write --input-type file --input gitversion.json --output-type assemblyinfo --output ./**/AssemblyInfo.cs
It is certainly more verbose, but it gives the users and developers more flexibility when constructing their commands, and it stops you from inventing your own constructs as to how a command should look.
Array-like binding would look like:
gitversion write --output-type projectfile --output project1.csproj --output project2.fsproj
I used input/output as an example (and input-type and output-type sound better than from-type and to-type), but you get the idea
Thanks for the feedback @svengeance! I agree with you and will adjust my examples (moved to #2275) accordingly.