powercli.common

Common commands and flags.

Module Contents

Classes

HelpCommand

A help command.

HelpFlag

A help flag which on presence prints a help message and exits.

VersionCommand

A version command.

VersionFlag

A version flag which on presence prints the version and exits..

ListCommand

A list command.

ListFlag

A list flag which on presence prints all available subcommands.

API

class powercli.common.HelpCommand(status: int = 0, name: str = 'help', description: str = 'Prints a help message for the given command', hidden_aliases: set[str] = {'?'}, **kwargs: Any)

Bases: powercli.command.Command[typing.Any, typing.Any]

A help command.

Initialization

Initializes the help command.

Parameters

  • status - The status the program exits with when the help command is invoked.

All other arguments are passed to powercli.command.Command with some defaults.

parse_args(args: list[str] | None = None) Never

Parses arguments like powercli.command.Command.parse_args().

This function will print a help message and exit.

class powercli.common.HelpFlag(status: int = 0, short: str | None = 'h', long: str | None = 'help', short_hidden_aliases: set[str] = {'?'}, description: str | None = 'Prints a help message and exits', **kwargs: Any)

Bases: powercli.args.Flag[typing.Any, typing.Any, None]

A help flag which on presence prints a help message and exits.

Initialization

Initializes the help flag.

Parameters

  • status - The status the program exits with when the help command is invoked.

All other arguments are passed to powercli.args.Flag with some defaults.

class powercli.common.VersionCommand(version: str, name: str = 'version', description: str | None = 'Prints the version and exits', **kwargs: Any)

Bases: powercli.command.Command[typing.Any, typing.Any]

A version command.

Initialization

Initializes the version command.

Parameters

  • version - The version to display.

All other arguments are passed to powercli.command.Command with some defaults.

parse_args(args: list[str] | None = None) Never

Parses arguments like powercli.command.Command.parse_args().

This function will print the version and exit.

class powercli.common.VersionFlag(version: str, long: str | None = 'version', description: str | None = 'Prints the version and exits', **kwargs: Any)

Bases: powercli.args.Flag[typing.Any, typing.Any, None]

A version flag which on presence prints the version and exits..

Initialization

Initializes the version flag.

Parameters

  • version - The version to display.

All other arguments are passed to powercli.args.Flag with some defaults.

class powercli.common.ListCommand(name: str = 'list', description: str | None = 'Lists all subcommands', **kwargs: Any)

Bases: powercli.command.Command[typing.Any, typing.Any]

A list command.

Initialization

Initializes the list command.

parse_args(args: list[str] | None = None) Never

Parses arguments like powercli.command.Command.parse_args().

This function will print a list of subcommands and exit.

class powercli.common.ListFlag(short: str | None = 'l', long: str | None = 'list', description: str | None = 'Lists all subcommands and exits', **kwargs: Any)

Bases: powercli.args.Flag[typing.Any, typing.Any, None]

A list flag which on presence prints all available subcommands.

Initialization

Initializes the list flag.