powercli.parser¶
Classes returned when parsing a command.
The actual parsing logic happens in powercli.command.Command.parse_args().
Module Contents¶
Classes¶
The result of a parsed command. |
|
A parsed argument. |
|
A parsed flag. |
|
A parsed positional. |
|
A parsed variadic positional. |
API¶
- class powercli.parser.ParsedCommand¶
The result of a parsed command.
- command: powercli.command.Command[powercli.parser.ParsedCommand.FV, powercli.parser.ParsedCommand.PV]¶
None
The command that got parsed.
- is_present(identifier: powercli.typedefs.Identifier, /) bool¶
Returns
Truewhen an argument with a certain identifier has been parsed.
- is_absent(identifier: powercli.typedefs.Identifier, /) bool¶
Returns
Truewhen an argument with a certain identifier has not been parsed.
- value_of_positional(identifier: powercli.typedefs.Identifier, /) PV | str¶
Returns the value the positional with a certain identifier holds.
- value_of_flag(identifier: powercli.typedefs.Identifier, /) collections.abc.Collection[FV | int] | None¶
Returns the value the flag with a certain identifier holds.
- values_of_variadic_positional(/) collections.abc.Collection[PV | str] | None¶
Returns the values of the variadic positional if present.
- subcommand(/) powercli.parser.ParsedCommand[FV, PV] | None¶
Returns the parsed subcommand if any.
- value_of(identifier: powercli.typedefs.Identifier, /) PV | str | collections.abc.Collection[FV | int] | None¶
Returns the value the argument with a certain identifier holds.
- class powercli.parser.ParsedArgument¶
A parsed argument.
- arg: powercli.args.Argument¶
None
The argument object that has been parsed.
- class powercli.parser.ParsedFlag¶
Bases:
powercli.parser.ParsedArgumentA parsed flag.
- arg: powercli.args.Flag[Any, Any, powercli.parser.ParsedFlag.T]¶
None
The flag that got parsed.
- raw_values: list[str] | None¶
None
The raw values that were supplied in the command-line or in the
powercli.command.Command.parse_args()method.This may be
Nonewhen the flag was not specified.
- values: collections.abc.Collection[powercli.parser.ParsedFlag.T | int] | None¶
None
The converted parsed values.
- class powercli.parser.ParsedPositional¶
Bases:
powercli.parser.ParsedArgumentA parsed positional.
- arg: powercli.args.Positional[Any, Any, powercli.parser.ParsedPositional.T]¶
None
The positional that got parsed.
- raw_value: str | None¶
None
The raw value that was supplied in the command-line or in the
powercli.command.Command.parse_args()method.This may be
Nonewhen the positional was not specified.
- class powercli.parser.ParsedVariadicPositional¶
Bases:
powercli.parser.ParsedArgumentA parsed variadic positional.
- arg: powercli.args.VariadicPositional[Any, Any, powercli.parser.ParsedVariadicPositional.T]¶
None
The variadic positional that got parsed.
- raw_values: list[str] | None¶
None
The raw values that were supplied in the command-line or in the
powercli.command.Command.parse_args()method.
- values: collections.abc.Collection[powercli.parser.ParsedVariadicPositional.T | str]¶
None
The converted parsed values.