[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Pulp-list] flags vs. bool options

On 05/22/2012 09:02 AM, Jay Dobies wrote:
On 05/22/2012 09:55 AM, Jeff Ortel wrote:
I've noticed that in some of our extensions, we are defining parameters
as boolean options instead of using flags. It seems more intuitive to
have a CLI users and much more in line with most other Linux commands to
specify (for example):


instead of:


and requires far less handling/conversion/validation in our code.

The problem comes in setting that option to false in an update call.
You'd need a separate argument for --disable-ssl-verify on the update,
which is cumbersome.

There's also a difference between False and "default". Using the flag
model, there's no way to later use an update call to indicate it's been
removed entirely from the configuration. That'd require a third flag,

Using this approach, we have three possibilities in a single option:

--ssl-verify=true # set the config value to true
--ssl-verify=false # set the config value to false
--ssl-verify="" # remove entirely from the config and use default

Using this across the board is more consistent when you get to things
like files. Setting a CA certificate with --ca-cert=<filename> and then
later removing it with --ca-cert="" is the same concept for removing as
it is for the booleans.

Ah, didn't realize these options were managing properties and not just flags used by the CLI. This makes sense.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]