How to use the cleo.Application function in cleo

To help you get started, we’ve selected a few cleo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sdispater / cleo / tests / commands / completion / test_completions_command.py View on Github external
# -*- coding: utf-8 -*-

import os
import pytest

from cleo import Application
from cleo import CommandTester

from .fixtures.hello_command import HelloCommand
from .fixtures.command_with_colons import CommandWithColons

app = Application()
app.add(HelloCommand())
app.add(CommandWithColons())


def test_invalid_shell():
    command = app.find("completions")
    tester = CommandTester(command)

    with pytest.raises(ValueError):
        tester.execute("pomodoro")


def test_bash(mocker):
    mocker.patch(
        "clikit.api.args.args.Args.script_name",
        new_callable=mocker.PropertyMock,
github sdispater / orator / tests / commands / __init__.py View on Github external
def run_command(self, command, options=None, input_stream=None):
        """
        Run the command.

        :type command: cleo.commands.command.Command
        :type options: list or None
        """
        if options is None:
            options = []

        options = [('command', command.get_name())] + options

        application = Application()
        application.add(command)

        if input_stream:
            dialog = command.get_helper('question')
            dialog.__class__.input_stream = input_stream

        command_tester = CommandTester(command)
        command_tester.execute(options)

        return command_tester
github alan-turing-institute / CleverCSV / clevercsv / console / application.py View on Github external
def build_application():
    config = Config("clevercsv", __version__)
    app = Application(config=config, complete=False)
    app.add(ViewCommand())
    app.add(DetectCommand())
    app.add(StandardizeCommand())
    app.add(CodeCommand())
    app.add(ExploreCommand())
    return app
github sdispater / orator / orator / commands / application.py View on Github external
# -*- coding: utf-8 -*-

from cleo import Application
from ..version import VERSION

application = Application('Orator', VERSION, complete=True)

# Migrations
from .migrations import (
    InstallCommand, MigrateCommand,
    MigrateMakeCommand, RollbackCommand,
    StatusCommand, ResetCommand, RefreshCommand
)

application.add(InstallCommand())
application.add(MigrateCommand())
application.add(MigrateMakeCommand())
application.add(RollbackCommand())
application.add(StatusCommand())
application.add(ResetCommand())
application.add(RefreshCommand())
github python-poetry / poetry / poetry / console / application.py View on Github external
from .commands import ScriptCommand
from .commands import SearchCommand
from .commands import ShellCommand
from .commands import ShowCommand
from .commands import UpdateCommand
from .commands import VersionCommand

from .commands.cache import CacheClearCommand

from .commands.debug import DebugInfoCommand
from .commands.debug import DebugResolveCommand

from .commands.self import SelfUpdateCommand


class Application(BaseApplication):
    def __init__(self):
        super(Application, self).__init__("Poetry", __version__)

        self._poetry = None
        self._skip_io_configuration = False
        self._formatter = Formatter(True)
        self._formatter.add_style("error", "red", options=["bold"])

    @property
    def poetry(self):
        from poetry.poetry import Poetry

        if self._poetry is not None:
            return self._poetry

        self._poetry = Poetry.create(os.getcwd())
github sdispater / poet / poet / console / application.py View on Github external
from .commands import (
    AboutCommand,
    CheckCommand,
    InitCommand,
    InstallCommand,
    LockCommand,
    PackageCommand,
    PublishCommand,
    RequireCommand,
    SearchCommand,
    UpdateCommand
)
from .commands.make import MakeSetupCommand, MakeRequirementsCommand


class Application(BaseApplication):
    """
    The console application that handles the commands.
    """

    def get_default_commands(self):
        default_commands = super(Application, self).get_default_commands()

        return default_commands + [
            AboutCommand(),
            CheckCommand(),
            InitCommand(),
            InstallCommand(),
            LockCommand(),
            MakeRequirementsCommand(),
            MakeSetupCommand(),
            PackageCommand(),
github sdispater / melomaniac / melomaniac / app.py View on Github external
# -*- coding: utf-8 -*-

from cleo import Application

from .version import VERSION
from .commands.listen import ListenCommand
from .commands.cache_clear import CacheClearCommand


app = Application('Melomaniac', VERSION, True)

app.add(ListenCommand())
app.add(CacheClearCommand())
github SetBased / py-stratum / pystratum / application / PyStratumApplication.py View on Github external
"""
PyStratum
"""
from typing import List

from cleo import Application, Command

from pystratum.command.ConstantsCommand import ConstantsCommand
from pystratum.command.LoaderCommand import LoaderCommand
from pystratum.command.PyStratumCommand import PyStratumCommand
from pystratum.command.WrapperCommand import WrapperCommand


class PyStratumApplication(Application):
    """
    The PyStratum application.
    """

    # ------------------------------------------------------------------------------------------------------------------
    def __init__(self):
        """
        Object constructor
        """
        Application.__init__(self, 'pystratum', '0.10.22')

    # ------------------------------------------------------------------------------------------------------------------
    def get_default_commands(self) -> List[Command]:
        """
        Returns the default commands of this application.
github sdispater / flask-orator / flask_orator / __init__.py View on Github external
def init_commands(self):
        self.cli = Application(orator_application.get_name(),
                               orator_application.get_version())
        
        self.cli.add(InstallCommand(self))
        self.cli.add(MigrateCommand(self))
        self.cli.add(MigrateMakeCommand(self))
        self.cli.add(RollbackCommand(self))
        self.cli.add(StatusCommand(self))
        self.cli.add(ResetCommand(self))
github ahal / jetty / jetty / cli / application.py View on Github external
def __init__(self, path=None):
        BaseApplication.__init__(self, "Jetty", __version__)
        self._path = path
        self._poetry = None
        self._skip_io_configuration = False
        self._formatter = Formatter(True)
        self._formatter.add_style("error", "red", options=["bold"])