From 244ee5da6d9c8aecd3f14780cfc5aa7716835fbe Mon Sep 17 00:00:00 2001 From: Shawn Davis Date: Wed, 22 Jul 2020 16:04:17 -0400 Subject: [PATCH] Updated docs. --- scripttease/cli/subcommands.py | 77 ++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/scripttease/cli/subcommands.py b/scripttease/cli/subcommands.py index 3e5180c..774f24c 100644 --- a/scripttease/cli/subcommands.py +++ b/scripttease/cli/subcommands.py @@ -4,10 +4,42 @@ from superpython.shell import EXIT from superpython.utils import highlight_code from ..parsers import load_commands, load_config +# Exports + +__all__ = ( + "output_commands", + "output_docs", + "output_script", +) + # Functions def output_commands(path, color_enabled=False, context=None, filters=None, locations=None, options=None): + """Output commands found in a given configuration file. + + :param path: The path to the configuration file. + :type path: str + + :param color_enabled: Indicates the output should be colorized. + :type color_enabled: bool + + :param context: The context to be applied to the file before parsing it as configuration. + :type context: dict + + :param filters: Output only those commands which match the given filters. + :type filters: dict + + :param locations: The locations (paths) of additional resources. + :type locations: list[str] + + :param options: Options to be applied to all commands. + :type options: dict + + :rtype: int + :returns: An exit code. + + """ commands = load_commands( path, context=context, @@ -36,6 +68,27 @@ def output_commands(path, color_enabled=False, context=None, filters=None, locat def output_docs(path, context=None, filters=None, locations=None, options=None): + """Output documentation for commands found in a given configuration file. + + :param path: The path to the configuration file. + :type path: str + + :param context: The context to be applied to the file before parsing it as configuration. + :type context: dict + + :param filters: Output only those commands which match the given filters. + :type filters: dict + + :param locations: The locations (paths) of additional resources. + :type locations: list[str] + + :param options: Options to be applied to all commands. + :type options: dict + + :rtype: int + :returns: An exit code. + + """ commands = load_commands( path, context=context, @@ -58,6 +111,30 @@ def output_docs(path, context=None, filters=None, locations=None, options=None): def output_script(path, color_enabled=False, context=None, filters=None, locations=None, options=None): + """Output a script of commands found in a given configuration file. + + :param path: The path to the configuration file. + :type path: str + + :param color_enabled: Indicates the output should be colorized. + :type color_enabled: bool + + :param context: The context to be applied to the file before parsing it as configuration. + :type context: dict + + :param filters: Output only those commands which match the given filters. NOT IMPLEMENTED. + :type filters: dict + + :param locations: The locations (paths) of additional resources. + :type locations: list[str] + + :param options: Options to be applied to all commands. + :type options: dict + + :rtype: int + :returns: An exit code. + + """ config = load_config( path, context=context,