Exemplo n.º 1
0
def cli(log_level):
    try:
        has_required_tmux_version()
    except exc.TmuxpException as e:
        click.echo(e, err=True)
        sys.exit()
    setup_logger(level=log_level.upper())
Exemplo n.º 2
0
def cli(log_level):
    try:
        has_required_tmux_version()
    except exc.TmuxpException as e:
        click.echo(e, err=True)
        sys.exit()
    setup_logger(
        level=log_level.upper()
    )
Exemplo n.º 3
0
def cli(log_level):
    """Manage tmux sessions.

    Pass the "--help" argument to any command to see detailed help.
    See detailed documentation and examples at:
    http://tmuxp.readthedocs.io/en/latest/"""
    try:
        has_required_tmux_version()
    except exc.TmuxpException as e:
        click.echo(e, err=True)
        sys.exit()
    setup_logger(level=log_level.upper())
Exemplo n.º 4
0
def main():
    """Main CLI application."""

    parser = get_parser()

    argcomplete.autocomplete(parser, always_complete_options=False)

    args = parser.parse_args()

    log_level = 'INFO'
    if 'log_level' in args and isinstance(args.log_level, string_types):
        log_level = args.log_level.upper()

    setup_logger(
        level=log_level
    )

    try:
        has_required_tmux_version()
    except exc.TmuxpException as e:
        logger.error(e)
        sys.exit()

    util.oh_my_zsh_auto_title()

    t = Server(  # noqa
        socket_name=args.socket_name,
        socket_path=args.socket_path,
        colors=args.colors
    )

    try:
        if not hasattr(args, 'callback'):
            parser.print_help()
        elif args.callback is command_load:
            command_load(args)
        elif args.callback is command_convert:
            command_convert(args)
        elif args.callback is command_import_teamocil:
            command_import_teamocil(args)
        elif args.callback is command_import_tmuxinator:
            command_import_tmuxinator(args)
        elif args.callback is command_freeze:
            command_freeze(args)
        elif args.callback is command_attach_session:
            command_attach_session(args)
        elif args.callback is command_kill_session:
            command_kill_session(args)
    except KeyboardInterrupt:
        pass
Exemplo n.º 5
0
def test_ignores_letter_versions():
    """Ignore letters such as 1.8b.

    See ticket https://github.com/tony/tmuxp/issues/55.

    In version 0.1.7 this is adjusted to use LooseVersion, in order to
    allow letters.

    """
    result = has_required_tmux_version('1.9a')
    assert version_regex.match(result) is not None

    result = has_required_tmux_version('1.8a')
    assert result == r'1.8'
Exemplo n.º 6
0
Arquivo: cli.py Projeto: fpietka/tmuxp
def cli(log_level):
    """Manage tmux sessions.

    Pass the "--help" argument to any command to see detailed help.
    See detailed documentation and examples at:
    http://tmuxp.readthedocs.io/en/latest/"""
    try:
        has_required_tmux_version()
    except exc.TmuxpException as e:
        click.echo(e, err=True)
        sys.exit()
    setup_logger(
        level=log_level.upper()
    )
Exemplo n.º 7
0
def test_ignores_letter_versions():
    """Ignore letters such as 1.8b.

    See ticket https://github.com/tony/tmuxp/issues/55.

    In version 0.1.7 this is adjusted to use LooseVersion, in order to
    allow letters.

    """
    result = has_required_tmux_version('1.9a')
    assert version_regex.match(result) is not None

    result = has_required_tmux_version('1.8a')
    assert result == r'1.8'
Exemplo n.º 8
0
def main():
    """Main CLI application."""

    parser = get_parser()

    argcomplete.autocomplete(parser, always_complete_options=False)

    args = parser.parse_args()

    log_level = 'INFO'
    if 'log_level' in args and isinstance(args.log_level, string_types):
        log_level = args.log_level.upper()

    setup_logger(level=log_level)

    try:
        has_required_tmux_version()
    except exc.TmuxpException as e:
        logger.error(e)
        sys.exit()

    util.oh_my_zsh_auto_title()

    t = Server(  # noqa
        socket_name=args.socket_name,
        socket_path=args.socket_path,
        colors=args.colors)

    try:
        if not hasattr(args, 'callback'):
            parser.print_help()
        elif args.callback is command_load:
            command_load(args)
        elif args.callback is command_convert:
            command_convert(args)
        elif args.callback is command_import_teamocil:
            command_import_teamocil(args)
        elif args.callback is command_import_tmuxinator:
            command_import_tmuxinator(args)
        elif args.callback is command_freeze:
            command_freeze(args)
        elif args.callback is command_attach_session:
            command_attach_session(args)
        elif args.callback is command_kill_session:
            command_kill_session(args)
    except KeyboardInterrupt:
        pass
Exemplo n.º 9
0
def test_error_version_less_1_7():
    with pytest.raises(LibTmuxException) as excinfo:
        has_required_tmux_version('1.7')
        excinfo.match(r'tmuxp only supports')

    with pytest.raises(LibTmuxException) as excinfo:
        has_required_tmux_version('1.6a')

        excinfo.match(r'tmuxp only supports')

    has_required_tmux_version('1.9a')
Exemplo n.º 10
0
def test_error_version_less_1_7():
    with pytest.raises(LibTmuxException) as excinfo:
        has_required_tmux_version('1.7')
        excinfo.match(r'tmuxp only supports')

    with pytest.raises(LibTmuxException) as excinfo:
        has_required_tmux_version('1.6a')

        excinfo.match(r'tmuxp only supports')

    has_required_tmux_version('1.9a')
Exemplo n.º 11
0
def test_allows_master_version():
    result = has_required_tmux_version('master')
    assert version_regex.match(result) is not None
Exemplo n.º 12
0
def test_no_arg_uses_tmux_version():
    """Test the :meth:`has_required_tmux_version`."""
    result = has_required_tmux_version()
    assert version_regex.match(result) is not None
Exemplo n.º 13
0
def test_no_arg_uses_tmux_version():
    """Test the :meth:`has_required_tmux_version`."""
    result = has_required_tmux_version()
    assert version_regex.match(result) is not None