chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.05k stars 890 forks source link

(#3381) Add new rule command #3382

Closed AdmiringWorm closed 1 month ago

AdmiringWorm commented 5 months ago

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

Change Types Made

Change Checklist

Related Issue

Fixes #3381

gep13 commented 1 month ago

@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.

gep13 commented 1 month ago

@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.