Exemplo n.º 1
0
Arquivo: cm.py Projeto: atavism/client
 def register_topics(self):
     topics = {}
     for command in PluginCommand.__subclasses__():
         tmp = command.topics.copy()
         topics.update(tmp)
     for name in topics:
         self.register_command_topic(topics[name], name)
     for name in ["q", "EOF", "man"]:
         self.register_command_topic("shell", name)
Exemplo n.º 2
0
 def register_topics(self):
     topics = {}
     for command in PluginCommand.__subclasses__():
         tmp = command.topics.copy()
         topics.update(tmp)
     for name in topics:
         self.register_command_topic(topics[name], name)
     for name in ["q", "EOF", "man", "version", "help", "history",
                  "pause", "quit", "var"]:
         self.register_command_topic("shell", name)
Exemplo n.º 3
0
 def register_topics(self):
     topics = {}
     for command in PluginCommand.__subclasses__():
         tmp = command.topics.copy()
         topics.update(tmp)
     for name in topics:
         self.register_command_topic(topics[name], name)
     for name in ["q", "EOF", "man", "version", "help", "history",
                  "pause", "quit", "var"]:
         self.register_command_topic("shell", name)
Exemplo n.º 4
0
from cloudmesh_client.common.StopWatch import StopWatch

from cloudmesh_client.db import CloudmeshDatabase
from cloudmesh_client import setup_yaml

cm = CloudmeshDatabase()


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


PluginCommandClasses = type(
    'CommandProxyClass',
    tuple(PluginCommand.__subclasses__()),
    {})

# print (type(PluginCommand.__subclasses__()))
# print (PluginCommand.__subclasses__())

"""
# not yet implemented
class ConsoleClasses(object):

    def __init__(self, *command_classes):

        classes = []
        for c in command_classes:
            classes.append(PluginCommand.__subclasses__())
        print (classes)
Exemplo n.º 5
0
        # print_list(commands)

        COMMANDS = [cls.class_name(c) for c in commands]
        commands = [
            getattr(importlib.import_module(mod), cls)
            for (mod, cls) in (commands.rsplit(".", 1)
                               for commands in COMMANDS)
        ]
        return commands


plugin.load()

PluginCommandClasses = type('CommandProxyClass',
                            tuple(PluginCommand.__subclasses__()), {})


class CMShell(Cmd, PluginCommandClasses):

    prompt = 'cms> '
    banner = textwrap.dedent("""
              +=======================================================+
              .   ____ _                 _                     _      .
              .  / ___| | ___  _   _  __| |_ __ ___   ___  ___| |__   .
              . | |   | |/ _ \| | | |/ _` | '_ ` _ \ / _ \/ __| '_ \  .
              . | |___| | (_) | |_| | (_| | | | | | |  __/\__ \ | | | .
              .  \____|_|\___/ \__,_|\__,_|_| |_| |_|\___||___/_| |_| .
              +=======================================================+
                                Cloudmesh Rest Shell
              """)