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

(#2829) Adds Basic choco license Command (WIP) #2847

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

JPRuskin
Copy link
Member

@JPRuskin JPRuskin commented Oct 4, 2022

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

  1. We have tested it locally

Change Types Made

  • Bug fix (non-breaking change)
  • Feature / Enhancement (non-breaking change)
  • Breaking change (fix or feature that could cause existing functionality to change)
  • PowerShell code changes.

Related Issue

Fixes #2829

Change Checklist

  • Requires a change to the documentation
  • Documentation has been updated
  • Tests to cover my changes, have been added
  • All new and existing tests passed.
  • PowerShell v2 compatibility checked.

@coveralls
Copy link

coveralls commented Oct 4, 2022

Coverage Status

Coverage remained the same at 27.501% when pulling f842a18 on JPRuskin:license-command into e35fe2b on chocolatey:develop.

Copy link
Member

@AdmiringWorm AdmiringWorm left a 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.

This commit introduces a new command to Chocolatey, `license`.

Currently, the functionality is limited, and it will only
display details on the current license.
var nodeCount = parse_node_count(ourLicense.Name);
var logger = config.RegularOutput ? ChocolateyLoggers.Normal : ChocolateyLoggers.LogFileOnly;

if (ourLicense.LicenseType == ChocolateyLicenseType.Foss)
Copy link
Member

Choose a reason for hiding this comment

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

}

return null;

Copy link
Member Author

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.

Suggested change

Copy link
Member Author

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+).*?\]");

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.

Create a choco license command
4 participants