-
Notifications
You must be signed in to change notification settings - Fork 903
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
(#2829) Adds Basic choco license Command (WIP) #2847
base: develop
Are you sure you want to change the base?
Conversation
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 know this is a WIP. Just commenting on a few things I noticed.
src/chocolatey/infrastructure.app/commands/ChocolateyLicenseCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyLicenseCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyLicenseCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyLicenseCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyLicenseCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyLicenseCommand.cs
Outdated
Show resolved
Hide resolved
src/chocolatey/infrastructure.app/commands/ChocolateyLicenseCommand.cs
Outdated
Show resolved
Hide resolved
This commit introduces a new command to Chocolatey, `license`. Currently, the functionality is limited, and it will only display details on the current license.
0febeca
to
f842a18
Compare
var nodeCount = parse_node_count(ourLicense.Name); | ||
var logger = config.RegularOutput ? ChocolateyLoggers.Normal : ChocolateyLoggers.LogFileOnly; | ||
|
||
if (ourLicense.LicenseType == ChocolateyLicenseType.Foss) |
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.
It looks like we can use is_licensed_version()
: https://github.com/chocolatey/choco/blob/develop/src/chocolatey/infrastructure/licensing/ChocolateyLicense.cs#L36
} | ||
|
||
return null; | ||
|
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.
Gary wouldn't approve this.
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.
He also suggests using the regex used in other parsing parts, for consistency.
private static readonly Regex _licenseCountRegex = new(@"\[.*?(?<licensedMachineCount>\d+).*?\]");
Description Of Changes
This PR adds a delightful new command,
choco license
.It should offer read and write, but at the moment just offers a basic output of the current license.
It doesn't yet have tests, either.
Motivation and Context
This has been requested by awesome folk!
Testing
Change Types Made
Related Issue
Fixes #2829
Change Checklist