def do_banner(self, args, arguments):
        """
        ::

          Usage:
            banner [-c CHAR] [-n WIDTH] [-i INDENT] [-r COLOR] TEXT...

          Arguments:
            TEXT...   The text message from which to create the banner
            CHAR      The character for the frame.
            WIDTH     Width of the banner
            INDENT    indentation of the banner
            COLOR     the color

            Options:
                -c CHAR   The character for the frame. [default: #]
                -n WIDTH  The width of the banner. [default: 70]
                -i INDENT  The width of the banner. [default: 0]
                -r COLOR  The color of the banner. [default: NORMAL]

            Prints a banner form a one line text message.
        """
        Console.ok("banner")
        n = int(arguments['-n'])
        c = arguments['-c']
        i = int(arguments['-i'])
        color = arguments['-r'].upper()

        line = ' '.join(arguments['TEXT'])

        Console.init()
        hline = i * " " + str((n - i) * c)
        Console.cprint(color=color, prefix="", message=hline)
        Console.cprint(color=color,
                       prefix="",
                       message=i * " " + c + " " + line)
        Console.cprint(color=color, prefix="", message=hline)

        return ""
Esempio n. 2
0
        ]:
            name = Plugin.class_name("terminal")
            Plugin.load([name])
        else:
            name = Plugin.class_name(name)
            Plugin.load([name])
    except Exception as e:  # noqa: F841
        Plugin.load()
else:
    Plugin.load()
StopWatch.stop("load")

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

Console.init()


class CMShell(Cmd, PluginCommandClasses):
    """
    The command shell that inherits all commands from PluginCommand
    """
    prompt = 'cms> '
    banner = textwrap.dedent("""
    +-------------------------------------------------------+
    |   ____ _                 _                     _      |
    |  / ___| | ___  _   _  __| |_ __ ___   ___  ___| |__   |
    | | |   | |/ _ \| | | |/ _` | '_ ` _ \ / _ \/ __| '_ \  |
    | | |___| | (_) | |_| | (_| | | | | | |  __/\__ \ | | | |
    |  \____|_|\___/ \__,_|\__,_|_| |_| |_|\___||___/_| |_| |
    +-------------------------------------------------------+