Skip to content

Allow filtering of rules in rules command #1270

Closed
@natanrolnik

Description

I started implementing a filtering feature in the rules command yesterday. For example, showing only enabled, disabled, the ones that only show warnings, and more.

When looking into the code, I initially thought of adding options to RulesOptions. But as RulesCommand accepts only one Argument at the moment, I think it would make sense one of the choices:

A - Keep using RulesCommand for both; if a rule identifier is passed, it always wins over the other options; otherwise, it will list all rules (and filter if filter-enabled is passed).
B - Create a new command, RuleCommand (Singular, not plural), that prints only the rule that relates to the passed identifier. And keep RulesCommand only for displaying multiple rules, according to the filtering options.

Both choices have their pros/cons, and I personally prefer A. Do you see any better way of doing this? I'll be happy to open a PR in the next few days according to the suggestions here.

Metadata

Assignees

No one assigned

    Labels

    enhancementIdeas for improvements of existing features and rules.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions