eww.command¶
This is our custom command module. It is a subclass of cmd.Cmd. The most significant change is using classes rather than functions for the commands.
Due to this change, we don’t use CamelCase for command class names here. Strictly that’s ok via PEP8 since we are kinda treating these like callables. Just a heads up.
- class eww.command.Command(completekey='tab', stdin=None, stdout=None)[source]¶
Bases: cmd.Cmd
Our cmd subclass where we implement all console functionality.
- class BaseCmd[source]¶
Bases: object
The base class for all commands.
- __weakref__¶
list of weak references to the object (if defined)
- class Command.EOF_command[source]¶
Bases: eww.command.BaseCmd
Implements support for EOF being interpreted as an exit request.
- class Command.exit_command[source]¶
Bases: eww.command.BaseCmd
Implements support for the ‘exit’ command to leave the console.
- class Command.help_command[source]¶
Bases: eww.command.BaseCmd
When called with no arguments, this presents a friendly help page. When called with an argument, it presents command specific help.
- display_command_detail(command_name)[source]¶
Displays detailed command help.
Parameters: command_name (str) – A command name to print detailed help for. Returns: None
- Command.onecmd(line)[source]¶
We override cmd.Cmd.onecmd in order to support our class-based commands. Changes are noted via comments.
Parameters: line (str) – A command (with arguments) to be executed. Returns: True if a command is designed to exit, otherwise None. Return type: bool
- class Command.quit_command[source]¶
Bases: eww.command.BaseCmd
Implements support for the ‘quit’ command to leave the console.
- class Command.repl_command[source]¶
Bases: eww.command.BaseCmd
Drops the user into a python REPL.
- register_quit()[source]¶
Registers our custom quit function to prevent stdin from being closed.
Returns: None
- class Command.stats_command[source]¶
Bases: eww.command.BaseCmd
A command for inspecting stats and generating graphs.
- display_single_stat(stat_name)[source]¶
Prints a specific stat.
Parameters: stat_name (str) – The stat name to display details of. Returns: None