Generic Console Handlers
Overview¶
| Path | PyPoE/cli/handler.py |
| Version | 1.0.0a0 |
| Revision | $Id: eb7d33857121b9535fbaeeca3e5aeb94f4c585a2 $ |
| Author | Omega_K2 |
Description¶
Generic console handlers for common tasks.
Agreement¶
See PyPoE/LICENSE
Documentation¶
-
class
PyPoE.cli.handler.BaseHandler(sub_parser, *args, **kwargs)[source]¶ Bases:
objectOther handlers should inherit this one.
-
class
PyPoE.cli.handler.ConfigHandler(sub_parser, config)[source]¶ Bases:
PyPoE.cli.handler.BaseHandlerHandler for config related tasks.
Sets up some basic config commands under the config sub menu.
Warning
Should be included in any application that uses the cli config
-
__init__(sub_parser, config)[source]¶ Parameters: - sub_parser (
argparse.ArgumentParser.add_subparsers()) – sub parsers object - config (ConfigHelper) – config instance
Raises: PyPoE.cli.config.ConfigError– if config validation failed- sub_parser (
-
get(args)[source]¶ Prints the config setting for the specified var.
Parameters: args (argparse.Namespace) – namespace object as passed from argument parser Returns: success code Return type: int
-
print_all(args)[source]¶ Prints all currently registered config variables.
Parameters: args (argparse.Namespace) – namespace object as passed from argument parser Returns: success code Return type: int
-
print_debug(args)[source]¶ Prints out the entire config as string.
Parameters: args (argparse.Namespace) – namespace object as passed from argument parser Returns: success code Return type: int
-
set(args)[source]¶ Sets the specified config setting to the specified value.
Parameters: args (argparse.Namespace) – namespace object as passed from argument parser Returns: success code Return type: int
-
-
class
PyPoE.cli.handler.SetupHandler(sub_parser, config)[source]¶ Bases:
PyPoE.cli.handler.BaseHandlerHandler for config setup related tasks.
Setups up the commands under the “setup” sub menu.
Warning
Should be included in any application that uses the cli config
-
__init__(sub_parser, config)[source]¶ Parameters: - sub_parser (
argparse.ArgumentParser.add_subparsers()) – sub parsers object - config (ConfigHelper) – config instance
- sub_parser (
-
setup(args)[source]¶ Performs the setup (if needed)
Parameters: args (argparse.Namespace) – namespace object as passed from argument parser Returns: success code Return type: int
-