pyTooling.CLIAbstraction.BooleanFlag

Boolean flags are arguments with a name and different pattern for a positive (True) and negative (False) value.

See also

  • For simple flags.
    Flag

  • For flags with a value.
    ValuedFlag

  • For flags that have an optional value.
    NamedOptionalValuedFlag

Classes


Classes

class pyTooling.CLIAbstraction.BooleanFlag.BooleanFlag[source]

Class and base-class for all BooleanFlag classes, which represents a flag argument with different pattern for an enabled/positive (True) or disabled/negative (False) state.

When deriving a subclass from an abstract BooleanFlag class, the parameters pattern and falsePattern are expected.

Example:

  • True: with-checks

  • False: without-checks

Inheritance

Inheritance diagram of BooleanFlag

static __new__(cls, *args, **kwargs)[source]
Parameters:
__init__(value)[source]

Initializes a BooleanFlag instance.

Parameters:

value (bool) – Initial value set for this argument instance.

Return type:

None

AsArgument()[source]

Convert this argument instance to a string representation with proper escaping using the matching pattern based on the internal name and value.

Return type:

Union[str, Iterable[str]]

Returns:

Formatted argument.

Raises:

ValueError – If internal name is None.

property Name: str

Get the internal name.

Returns:

Internal name.

property Value: ValueT

Get the internal value.

Returns:

Internal value.

__repr__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

__str__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

class pyTooling.CLIAbstraction.BooleanFlag.ShortBooleanFlag[source]

Represents a BooleanFlag with a single dash.

Example:

  • True: -with-checks

  • False: -without-checks

Inheritance

Inheritance diagram of ShortBooleanFlag

static __new__(cls, *args, **kwargs)[source]
Parameters:
AsArgument()

Convert this argument instance to a string representation with proper escaping using the matching pattern based on the internal name and value.

Return type:

Union[str, Iterable[str]]

Returns:

Formatted argument.

Raises:

ValueError – If internal name is None.

property Name: str

Get the internal name.

Returns:

Internal name.

property Value: ValueT

Get the internal value.

Returns:

Internal value.

__init__(value)

Initializes a BooleanFlag instance.

Parameters:

value (bool) – Initial value set for this argument instance.

Return type:

None

__repr__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

__str__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

class pyTooling.CLIAbstraction.BooleanFlag.LongBooleanFlag[source]

Represents a BooleanFlag with a double dash.

Example:

  • True: --with-checks

  • False: --without-checks

Inheritance

Inheritance diagram of LongBooleanFlag

static __new__(cls, *args, **kwargs)[source]
Parameters:
AsArgument()

Convert this argument instance to a string representation with proper escaping using the matching pattern based on the internal name and value.

Return type:

Union[str, Iterable[str]]

Returns:

Formatted argument.

Raises:

ValueError – If internal name is None.

property Name: str

Get the internal name.

Returns:

Internal name.

property Value: ValueT

Get the internal value.

Returns:

Internal value.

__init__(value)

Initializes a BooleanFlag instance.

Parameters:

value (bool) – Initial value set for this argument instance.

Return type:

None

__repr__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

__str__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

class pyTooling.CLIAbstraction.BooleanFlag.WindowsBooleanFlag[source]

Represents a BooleanFlag with a slash.

Example:

  • True: /with-checks

  • False: /without-checks

Inheritance

Inheritance diagram of WindowsBooleanFlag

static __new__(cls, *args, **kwargs)[source]
Parameters:
AsArgument()

Convert this argument instance to a string representation with proper escaping using the matching pattern based on the internal name and value.

Return type:

Union[str, Iterable[str]]

Returns:

Formatted argument.

Raises:

ValueError – If internal name is None.

property Name: str

Get the internal name.

Returns:

Internal name.

property Value: ValueT

Get the internal value.

Returns:

Internal value.

__init__(value)

Initializes a BooleanFlag instance.

Parameters:

value (bool) – Initial value set for this argument instance.

Return type:

None

__repr__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.

__str__()

Return a string representation of this argument instance.

Return type:

str

Returns:

Argument formatted and enclosed in double quotes.