Skip to content

New CLI #2272

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

Closed
wants to merge 2 commits into from
Closed

New CLI #2272

wants to merge 2 commits into from

Conversation

asbjornu
Copy link
Member

@asbjornu asbjornu commented May 12, 2020

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:

  • My code follows the code style of this project.
  • 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.

@svengeance
Copy link
Contributor

svengeance commented May 12, 2020

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

@asbjornu
Copy link
Member Author

Thanks for the feedback @svengeance! I agree with you and will adjust my examples (moved to #2275) accordingly.

@arturcic arturcic closed this Jan 7, 2021
@arturcic arturcic deleted the feature/new-cli branch January 7, 2021 14:25
@arturcic arturcic restored the feature/new-cli branch January 7, 2021 14:27
@arturcic arturcic reopened this Jan 7, 2021
Base automatically changed from master to main January 31, 2021 12:46
@arturcic arturcic modified the milestones: 6.x, 7.x Mar 9, 2022
@arturcic arturcic closed this Feb 23, 2023
@arturcic arturcic deleted the feature/new-cli branch February 23, 2023 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] New CLI
4 participants