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

(#3381) Add new rule command #3382

Merged
merged 3 commits into from May 21, 2024
Merged

Conversation

AdmiringWorm
Copy link
Member

@AdmiringWorm AdmiringWorm commented Jan 15, 2024

Description Of Changes

This adds a new command called ´rulewith an alias ofrules` to be able to view any Validation Rules that have been implemented by Chocolatey CLI, or the details of a specific view.

Motivation and Context

To give visibility to users an what will happen/validated when they package their Chocolatey CLI package, as well intended enhanced functionality that will be implemented outside Chocolatey CLI that can reuse this same command.

Testing

  1. Run choco rules (also try choco rule list). You should then see something similar to
    image
  2. Run choco rule get --name CHCR0002. You should then see something similar to
    image (_repeat with choco rule CHCR0002)
  3. Run choco rules -r. You should then see something similar to
    image
  4. Run choco rule --name missing. You should see something similar to
    image
  5. Run choco rule get --name missing. You should see something similar to
    image
  6. Run choco rule get --name CHCR0001 -r. You should see something similar as point 3, with just the specified rule outputted.
  7. Run choco rule get --name missing -r. No rules should be outputted, and no error occurring.

Operating Systems Testing

  • Windows 10

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).
  • Documentation changes.
  • PowerShell code changes.

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 code changes: PowerShell v2 compatibility checked?

Related Issue

Fixes #3381

@gep13
Copy link
Member

gep13 commented May 20, 2024

@AdmiringWorm overall, this looks really good, and would be happy to get this merged in.

While reviewing, I did make some changes, which I have added as a standalone commit. Let's have a chat about the changes tomorrow, and decide whether to move forward with them.

AdmiringWorm and others added 3 commits May 21, 2024 05:38
This adds a new command called ´rule` with an alias of `rules` to be
able to view any Validation Rules that have been implemented by
Chocolatey CLI, or the details of a specific view.

This allows a user to see what is implemented when they are packaging
their Chocolatey CLI package. This is intended to be used in the future
to enhance other functionality.
The Rule Service interface was missing the ability to get
all available rules that have been implemented.

This commit updates the interface to include this method.
There was an unused `ex` in a catch block, which goes against out
coding conventions.
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

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

LGTM!

@gep13
Copy link
Member

gep13 commented May 21, 2024

@AdmiringWorm and I met today, and during a pairing session decided that the suggested changes make sense. These have now been rebased into the existing commits, and will continue with the merge, once the CI builds pass.

@gep13 gep13 enabled auto-merge May 21, 2024 12:41
@gep13 gep13 merged commit 3727152 into chocolatey:develop May 21, 2024
5 checks passed
@AdmiringWorm AdmiringWorm deleted the rule-command branch May 21, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add command to allow viewing any rules implemented by Chocolatey CLI or an extension
2 participants