window.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:libtmux 作者: tony 项目源码 文件源码
def show_window_option(self, option, g=False):
        """Return a list of options for the window.

        todo: test and return True/False for on/off string

        :param option: option to return.
        :type option: str
        :param g: Pass ``-g`` flag, global.
        :type g: bool
        :rtype: str, int
        :raises: :exc:`exc.OptionError`, :exc:`exc.UnknownOption`,
            :exc:`exc.InvalidOption`, :exc:`exc.AmbiguousOption`

        """

        tmux_args = tuple()

        if g:
            tmux_args += ('-g',)

        tmux_args += (option,)

        cmd = self.cmd(
            'show-window-options', *tmux_args
        )

        if len(cmd.stderr):
            handle_option_error(cmd.stderr[0])

        if not len(cmd.stdout):
            return None

        option = [shlex.split(item) for item in cmd.stdout][0]

        if option[1].isdigit():
            option = (option[0], int(option[1]))

        return option[1]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号