def version(cls, options):
        """
        Show version informations

        Usage: version [--short]

        Options:
            --short     Shows only Compose's version number.
        """
        if options['--short']:
            print(__version__)
        else:
            print(get_version_info('full'))
    def version(cls, options):
        """
        Show version informations

        Usage: version [--short]

        Options:
            --short     Shows only Compose's version number.
        """
        if options['--short']:
            print(__version__)
        else:
            print(get_version_info('full'))
def dispatch(param, base_dir):
    setup_logging()
    dispatcher = DocoptDispatcher(
        TopLevelCommand,
        {'options_first': True, 'version': get_version_info('compose')})
    try:
        options, handler, command_options = dispatcher.parse(param)
    except NoSuchCommand as e:
        commands = "\n".join(parse_doc_section("commands:", getdoc(e.supercommand)))
        log.error("No such command: %s\n\n%s", e.command, commands)
        sys.exit(1)
    log.debug(options)
    setup_console_handler(console_handler, options.get('--verbose'))
    return functools.partial(perform_command, options, handler, command_options, base_dir)
def dispatch(param, base_dir):
    setup_logging()
    dispatcher = DocoptDispatcher(TopLevelCommand, {
        'options_first': True,
        'version': get_version_info('compose')
    })
    try:
        options, handler, command_options = dispatcher.parse(param)
    except NoSuchCommand as e:
        commands = "\n".join(
            parse_doc_section("commands:", getdoc(e.supercommand)))
        log.error("No such command: %s\n\n%s", e.command, commands)
        sys.exit(1)
    log.debug(options)
    setup_console_handler(console_handler, options.get('--verbose'))
    return functools.partial(perform_command, options, handler,
                             command_options, base_dir)
Example #5
0
def apiDispatch(args):
    """
    Does the same thing as the dispatch function in compose.cli.main.py but instead
    of using os.argv it uses a the passed args array. Also does not catch any
    exceptions so they can be caught programatically.
    params:
        args: Array of argument strings.
    """
    setup_logging()
    dispatcher = dp.DocoptDispatcher(TopLevelCommand, {
        'options_first': True,
        'version': get_version_info('compose')
    })
    # Don't handle argument exceptions here, let them be caught outside of the apiDispatch.
    options, handler, command_options = dispatcher.parse(args)
    setup_console_handler(console_handler, options.get('--verbose'))
    return functools.partial(perform_command, options, handler,
                             command_options)
Example #6
0
"""

import logging
from os.path import normpath
from compose import __version__ as compose_version
from compose.container import Container
from compose.cli.utils import get_version_info
from compose.cli.command import get_project as compose_get_project, get_config_path_from_options, get_config_from_options
from compose.config.config import get_default_config_files
from compose.config.environment import Environment

from compose.cli.docker_client import docker_client
from compose.const import API_VERSIONS, COMPOSEFILE_V3_0


logging.info(get_version_info('full'))


def ps_(project):
    """
    containers status
    """
    logging.info('ps ' + project.name)
    running_containers = project.containers(stopped=True)

    items = [{
        'name': container.name,
        'name_without_project': container.name_without_project,
        'command': container.human_readable_command,
        'state': container.human_readable_state,
        'labels': container.labels,
Example #7
0
"""

import logging
from os.path import normpath
from compose import __version__ as compose_version
from compose.container import Container
from compose.cli.utils import get_version_info
from compose.cli.command import get_project as compose_get_project, get_config_path_from_options, get_config_from_options
from compose.config.config import get_default_config_files
from compose.config.environment import Environment

from compose.cli.docker_client import docker_client
from compose.const import API_VERSIONS, COMPOSEFILE_V3_0


logging.info(get_version_info('full'))

def ps_(project):
    """
    containers status
    """
    logging.info('ps ' + project.name)
    running_containers = project.containers(stopped=True)

    items = [{
        'name': container.name,
        'name_without_project': container.name_without_project,
        'command': container.human_readable_command,
        'state': container.human_readable_state,
        'labels': container.labels,
        'ports': container.ports,