예제 #1
0
def call_command_handler(command, pymux, cli, arguments):
    """
    Execute command.

    :param arguments: List of options.
    """
    assert isinstance(arguments, list)

    # Resolve aliases.
    command = ALIASES.get(command, command)

    try:
        handler = COMMANDS_TO_HANDLERS[command]
    except KeyError:
        pymux.show_message(cli, 'Invalid command: %s' % (command, ))
    else:
        try:
            handler(pymux, cli, arguments)
        except CommandException as e:
            pymux.show_message(cli, e.message)
예제 #2
0
파일: commands.py 프로젝트: dzosz/pymux
def call_command_handler(command, pymux, cli, arguments):
    """
    Execute command.

    :param arguments: List of options.
    """
    assert isinstance(arguments, list)

    # Resolve aliases.
    command = ALIASES.get(command, command)

    try:
        handler = COMMANDS_TO_HANDLERS[command]
    except KeyError:
        pymux.show_message(cli, 'Invalid command: %s' % (command,))
    else:
        try:
            handler(pymux, cli, arguments)
        except CommandException as e:
            pymux.show_message(cli, e.message)
예제 #3
0
    pane = pymux.arrangement.get_active_pane(cli)
    pane.display_text(result, title='list-keys')


@cmd('list-panes')
def list_panes(pymux, cli, variables):
    """
    Display a list of all the panes.
    """
    w = pymux.arrangement.get_active_window(cli)
    active_pane = w.active_pane

    result = []

    for i, p in enumerate(w.panes):
        process = p.process

        result.append('%i: [%sx%s] [history %s/%s] %s\n' %
                      (i, process.sx, process.sy,
                       min(pymux.history_limit, process.screen.line_offset +
                           process.sy), pymux.history_limit,
                       ('(active)' if p == active_pane else '')))

    # Display help in pane.
    active_pane.display_text(''.join(result), title='list-panes')


# Check whether all aliases point to real commands.
for k in ALIASES.values():
    assert k in COMMANDS_TO_HANDLERS
예제 #4
0
파일: commands.py 프로젝트: dzosz/pymux
    pane = pymux.arrangement.get_active_pane(cli)
    pane.display_text(result, title='list-keys')


@cmd('list-panes')
def list_panes(pymux, cli, variables):
    """
    Display a list of all the panes.
    """
    w = pymux.arrangement.get_active_window(cli)
    active_pane = w.active_pane

    result = []

    for i, p in enumerate(w.panes):
        process = p.process

        result.append('%i: [%sx%s] [history %s/%s] %s\n' % (
            i, process.sx, process.sy,
            min(pymux.history_limit, process.screen.line_offset + process.sy),
            pymux.history_limit,
            ('(active)' if p == active_pane else '')))

    # Display help in pane.
    active_pane.display_text(''.join(result), title='list-panes')


# Check whether all aliases point to real commands.
for k in ALIASES.values():
    assert k in COMMANDS_TO_HANDLERS