[pmg-devel] [PATCH pmg-api 3/3] pmgdb: add active parameter to dump

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Feb 27 14:21:33 CET 2024


Am 27/02/2024 um 13:53 schrieb Stoiko Ivanov:
> On Mon, 26 Feb 2024 20:11:28 +0100
> Thomas Lamprecht <t.lamprecht at proxmox.com> wrote:
>> If I call this with active set to disabled, i.e. as `pmgdb dump --active 0`, then
>> I still get the active rules, which feels rather a bit wrong.
>>
>> IMO this could be interpreted as ternary:
>>
>> 1. undef (not passed) -> both
>> 2. true (--active[=1]) -> active only
>> 3. false (--active=0) -> incative only
> 
> this does break how booleans behave across most of our CLI tools (afaict).

I did not check, but I think we hardly have a very strong coherent behavior
here, but yeah, a tri-state behavior for a boolean flag isn't fully ideal
either.

> can be fine, especially with this particular call, which is mostly for
> debugging.
> Alternatively - why not make this a regular enum (--rules
> <all|active|inactive>, defaulting to all)?

That would be more explicit and avoid all misinterpretation potential, i.e.,
more than fine with me.




More information about the pmg-devel mailing list