Skip to content
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

Add dotnet tool: nbgv #191

Merged
merged 13 commits into from
Jun 25, 2018
Merged

Add dotnet tool: nbgv #191

merged 13 commits into from
Jun 25, 2018

Conversation

AArnott
Copy link
Collaborator

@AArnott AArnott commented Jun 25, 2018

As a high-level summary of the new nbgv dotnet console tool, here is the top-level usage text:

usage: nbgv <command> [<args>]

    install        Prepares a project to have version stamps applied
                   using Nerdbank.GitVersioning.
    get-version    Gets the version information for a project.
    set-version    Updates the version stamp that is applied to a
                   project.
    tag            Creates a git tag to mark a version.
    get-commits    Gets the commit(s) that match a given version.
    cloud          Communicates with the ambient cloud build to set the
                   build number and/or other cloud build variables.

Additional help is available for each individual command.

Todo:

  • Add documentation
  • Don't execute commands when --help trails them
  • get-version should accept an optional git ref for which to return version info

Closes #181

@AArnott AArnott self-assigned this Jun 25, 2018
@AArnott
Copy link
Collaborator Author

AArnott commented Jun 25, 2018

CC: @onovotny

PackageId,
new Dictionary<string, string>
{
{ "Version", "2.1.23" }, // TODO: use the latest version... somehow...
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to use the NuGet.Client v4 package to do this, but the only docs are for v3 and v4 seems to have made it... difficult.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the link. Interestingly enough it seems this is the line I was looking for.

https://github.com/NuGetPackageExplorer/NuGetPackageExplorer/blob/f0809a1fcd4fb582acd535470c30bffc69221f9e/PackageViewModel/PackageViewModel.csproj#L12

I was pulling down Nuget.Client instead of NuGet.PackageManagement.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm.. no, that doesn't work either. And v4.7.0 doesn't even exist (on nuget.org) for that package.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does seem to be on Nuget.org, but they're publishing it with build-metadata, which seems confusing:

https://www.nuget.org/packages/NuGet.PackageManagement/4.7.0

</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.CommandLine" Version="0.1.0-preview2-180503-2" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I used to use this but switched to
Microsoft.Extensions.CommandLineUtils https://github.com/onovotny/SignService/blob/master/src/SignClient/SignClient.csproj#L11
Since it doesn't look like the other one will ever see any updates.

Works similarly as you can see here: https://github.com/onovotny/SignService/tree/master/src/SignClient

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I'd given Nate McMaster's fork of that library I try but was disappointed by its apparent lack of support for sub-commands. Your sample demonstrates at least that it recognizes such a thing.
I'm pretty comfortable with the System.CommandLine pattern though, and since I'm publishing the package instead of shipping it with dependenceis to nuget.org, the fact that it will never ship doesn't bother me. I've used this package several times already.
But I'll check out the MS.Ex.CLU one at some point for my next project. Thanks for the tip.

This produces a warning on restore because the official NuGet package doesn't target .NET Core. :(
doc/nbgv-cli.md Outdated
Perform a one-time install of the `nbgv` tool using the following dotnet CLI command:

```cmd
dotnet tool install -g nbgv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a common use is likely to be on CI servers/build scripts to get a version, is it worth mentioning local tools?

dotnet tool install nbgv --tool-path .
.\nbgv ...

That way it won't cause issues with anything else on the machine already and doesn't mess with global state.

@AArnott AArnott merged commit 63e0ff3 into master Jun 25, 2018
@AArnott AArnott deleted the fix181 branch June 25, 2018 22:06
AArnott added a commit that referenced this pull request Apr 16, 2023
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.

None yet

2 participants