Example #1
0
    def __init__(self, context, plugins=None):
        self.default_plugins = \
            [cls for cls in Cmd3Command.__subclasses__()]

        self.default_plugin_names = \
            [cls.__name__ for cls in Cmd3Command.__subclasses__()]

        cmd.Cmd.__init__(self)
        self.command_topics = {}
        self.register_topics()
        self.context = context

        if self.context.debug:
            print("init CloudmeshConsole")

        self.prompt = 'cm> '

        self.banner = textwrap.dedent("""
            +=======================================================+
            .   ____ _                 _                     _      .
            .  / ___| | ___  _   _  __| |_ __ ___   ___  ___| |__   .
            . | |   | |/ _ \| | | |/ _` | '_ ` _ \ / _ \/ __| '_ \  .
            . | |___| | (_) | |_| | (_| | | | | | |  __/\__ \ | | | .
            .  \____|_|\___/ \__,_|\__,_|_| |_| |_|\___||___/_| |_| .
            +=======================================================+
                                 Cloudmesh Shell
            """)
        # KeyCommands.__init__(self, context)
        for c in CloudmeshConsole.__bases__[1:]:
            c.__init__(self, context)
Example #2
0
    def do_commands(self, arg, arguments):
        """
        ::

            Usage:
                commands

            Prints all registered commands
        """
        print (arguments)
        print (vars())

        names  = [cls.__name__ for cls in Cmd3Command.__subclasses__()]

        classes  = [cls for cls in Cmd3Command.__subclasses__()]

        name_list = '\n'.join(names)

        Console.ok("Registered Commands")
        Console.ok("===================")
        for name in names:
            Console.ok(name)
        print()

        Console.ok("Registered Classes")
        Console.ok("===================")
        for c in classes:
            Console.ok(str(c))
Example #3
0
from cloudmesh_cmd3light.version import version
from cloudmesh_base.util import get_python
from cloudmesh_base.util import check_python
import cloudmesh_base
from cloudmesh_base.tables import dict_printer
from cloudmesh_cmd3light.command import command, Cmd3Command
import imp

class CloudmeshContext(object):
    def __init__(self, **kwargs):
        self.__dict__ = kwargs

import importlib

names  = [cls.__name__ for cls in Cmd3Command.__subclasses__()]
classes  = [cls for cls in Cmd3Command.__subclasses__()]


# type(cmd.Cmd)("MyCli", bases + (cmd.Cmd,), {})
# noinspection PyPep8Naming
class CloudmeshBaseConsole(cmd.Cmd,
                       cloudmesh_cmd3light.plugins.CommandsCommands,
                       cloudmesh_cmd3light.plugins.TerminalCommands,
                       cloudmesh_cmd3light.plugins.ManCommand,
                       cloudmesh_cmd3light.plugins.SecureShellCommand,
                       cloudmesh_cmd3light.plugins.OpenCommand):
    """
    Cloudmesh Console
    """