コード例 #1
0
ファイル: debug_info.py プロジェクト: jamosta/tmuxp
def command_debug_info():
    """
    Print debug info to submit with Issues.
    """
    def prepend_tab(strings):
        """
        Prepend tab to strings in list.
        """
        return list(map(lambda x: "\t%s" % x, strings))

    def output_break():
        """
        Generate output break.
        """
        return "-" * 25

    def format_tmux_resp(std_resp):
        """
        Format tmux command response for tmuxp stdout.
        """
        return "\n".join([
            "\n".join(prepend_tab(std_resp.stdout)),
            click.style("\n".join(prepend_tab(std_resp.stderr)), fg="red"),
        ])

    output = [
        output_break(),
        "environment:\n%s" % "\n".join(
            prepend_tab([
                "dist: %s" % platform.platform(),
                "arch: %s" % platform.machine(),
                "uname: %s" % "; ".join(platform.uname()[:3]),
                "version: %s" % platform.version(),
            ])),
        output_break(),
        "python version: %s" % " ".join(sys.version.split("\n")),
        "system PATH: %s" % os.environ["PATH"],
        "tmux version: %s" % get_version(),
        "libtmux version: %s" % libtmux_version,
        "tmuxp version: %s" % __version__,
        "tmux path: %s" % which("tmux"),
        "tmuxp path: %s" % tmuxp_path,
        "shell: %s" % os.environ["SHELL"],
        output_break(),
        "tmux sessions:\n%s" % format_tmux_resp(tmux_cmd("list-sessions")),
        "tmux windows:\n%s" % format_tmux_resp(tmux_cmd("list-windows")),
        "tmux panes:\n%s" % format_tmux_resp(tmux_cmd("list-panes")),
        "tmux global options:\n%s" %
        format_tmux_resp(tmux_cmd("show-options", "-g")),
        "tmux window options:\n%s" %
        format_tmux_resp(tmux_cmd("show-window-options", "-g")),
    ]

    tmuxp_echo("\n".join(output))
コード例 #2
0
def command_debug_info():
    """
    Print debug info to submit with Issues.
    """
    def prepend_tab(strings):
        """
        Prepend tab to strings in list.
        """
        return list(map(lambda x: '\t%s' % x, strings))

    def output_break():
        """
        Generate output break.
        """
        return '-' * 25

    def format_tmux_resp(std_resp):
        """
        Format tmux command response for tmuxp stdout.
        """
        return '\n'.join([
            '\n'.join(prepend_tab(std_resp.stdout)),
            click.style('\n'.join(prepend_tab(std_resp.stderr)), fg='red'),
        ])

    output = [
        output_break(),
        'environment:\n%s' % '\n'.join(
            prepend_tab([
                'dist: %s' % platform.platform(),
                'arch: %s' % platform.machine(),
                'uname: %s' % '; '.join(platform.uname()[:3]),
                'version: %s' % platform.version(),
            ])),
        output_break(),
        'python version: %s' % ' '.join(sys.version.split('\n')),
        'system PATH: %s' % os.environ['PATH'],
        'tmux version: %s' % get_version(),
        'libtmux version: %s' % libtmux_version,
        'tmuxp version: %s' % __version__,
        'tmux path: %s' % which('tmux'),
        'tmuxp path: %s' % tmuxp_path,
        'shell: %s' % os.environ['SHELL'],
        output_break(),
        'tmux sessions:\n%s' % format_tmux_resp(tmux_cmd('list-sessions')),
        'tmux windows:\n%s' % format_tmux_resp(tmux_cmd('list-windows')),
        'tmux panes:\n%s' % format_tmux_resp(tmux_cmd('list-panes')),
        'tmux global options:\n%s' %
        format_tmux_resp(tmux_cmd('show-options', '-g')),
        'tmux window options:\n%s' %
        format_tmux_resp(tmux_cmd('show-window-options', '-g')),
    ]

    tmuxp_echo('\n'.join(output))
コード例 #3
0
def test_tmux_cmd_raises_on_not_found():
    with pytest.raises(TmuxCommandNotFound):
        tmux_cmd('-V', tmux_search_paths=[], append_env_path=False)

    tmux_cmd('-V')
コード例 #4
0
ファイル: test_common.py プロジェクト: tony/libtmux
def test_tmux_cmd_raises_on_not_found():
    with pytest.raises(TmuxCommandNotFound):
        tmux_cmd('-V', tmux_search_paths=[], append_env_path=False)

    tmux_cmd('-V')