cli
OptConfig

OptConfig

Mojo struct 🡭

OptConfig

@memory_only
struct OptConfig

Create an option to be added to the OptParser.

Fields

  • long_name (String): Required long name of, this will be used as the cli value as --long_name.
  • default_value (Optional[String]): If there is one, the Stringified deafult value. This will be parsed via OptKind.
  • value_kind (OptKind): The type of the value for this option.
  • is_flag (Bool): If it’s a flag, then it’s value_kind needs to be Bool.
  • description (String): Long for description, for best results, don’t add a newline.

Implemented traits

AnyType, Copyable, ExplicitlyCopyable, Movable, UnknownDestructibility

Methods

 

__init__

fn __init__(out self, var long_name: String, value_kind: OptKind, *, is_flag: Bool = False, var description: String = "", var default_value: Optional[String] = Optional(None))

Details Args:

  • long_name (String)
  • value_kind (OptKind)
  • is_flag (Bool)
  • description (String)
  • default_value (Optional)
  • self (Self)

Returns:

Self

Raises: