Skip to content

Enhancement: Add consistency to boolean options and allow all truthy and falsy values  #3853

@martinlingstuyl

Description

@martinlingstuyl

This issue is based on the following discussion.

💔 There are a few issues with the CLI way of handling boolean options.

  • In PowerShell: Some options allow for using $true and $false while others do not. This is unfortunate for PoSH users who often use boolean variables in scripting. In Bash there's no such thing as a boolean, but 1 and 0 are often interpreted as truthy and falsy as well. The CLI does not support that.
  • Some options have autocomplete while others do not.
  • Some options are typed as string in the code base, while others are typed as boolean.

🎯 We should be consistent in the handling and use of booleans!

🎯 We should be more accepting of various ways of writing truthy and falsy values.

As an example: the Azure CLI has a good definition on booleans, they state:

Booleans are case-insensitive, and are represented by the following values.
True: 1, yes, true, on
False: 0, no, false, off

Requirements

Functionally speaking, this issue is fixed when the following statements are true:

  • All boolean options have autocomplete values true|false
  • All boolean options allow for the following truthy values: 1, yes, true, True, on and the following falsy values: 0, no, false, False, off. (Note PoSH $true and $false translate to True and False)

Implementation

  • All boolean options need to be typed as boolean in the codebase.
  • All boolean options need to be added to the this.types.booleans array
  • To ensure correct parsing of args by minimist, all boolean options (options that are in the this.types.booleans array) will need to be checked and fixed right before minimist will parse them.

Tasks

We'll take this slow, converting this issue to an epic and fixing this command by command.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions