tmux脚本库/orm

libtmux的Python项目详细描述


libtmux-tmux脚本库

Python PackageDocumentation StatusBuild StatusCode CoverageLicense

libtmux是python中tmux工作区管理器tmuxp背后的工具。

它基于tmux的targetformats来创建一个对象 映射以遍历、检查和与实时tmux会话交互。

查看documentation主页、API信息和architectural details

安装

$ [sudo] pip install libtmux

打开TMUX会话

会话名foo,窗口名bar

$ tmux new-session -s foo -n bar

通过python引导tmux会话

$ python

# or for nice autocomplete and syntax highlighting
$ pip install ptpython
$ ptpython

连接到实时tmux会话:

>>>importlibtmux>>>server=libtmux.Server()>>>server<libtmux.server.Serverobjectat0x7fbd622c1dd0>

列出会话:

>>>server.list_sessions()[Session($3foo),Session($1libtmux)]

查找会话:

>>>server.get_by_id('$3')Session($3foo)

通过dict查找查找会话:

>>>server.find_where({"session_name":"foo"})Session($3foo)

将会话分配给session

>>>session=server.find_where({"session_name":"foo"})

播放会话:

>>>session.new_window(attach=False,window_name="ha in the bg")Window(@82:hainthebg,Session($3foo))>>>session.kill_window("ha in")

在后台创建新窗口(不要切换到该窗口):

>>>w=session.new_window(attach=False,window_name="ha in the bg")Window(@113:hainthebg,Session($3foo))

直接杀死窗口对象:

>>>w.kill_window()

抓取剩余的tmux窗口:

>>>window=session.attached_window>>>window.split_window(attach=False)Pane(%23Window(@101:bar,Session($3foo)))

重命名窗口:

>>>window.rename_window('libtmuxower')Window(@101:libtmuxower,Session($3foo))

通过拆分窗口创建窗格:

>>>pane=window.split_window()>>>pane=window.split_window(attach=False)>>>pane.select_pane()>>>window=session.new_window(attach=False,window_name="test")>>>pane=window.split_window(attach=False)

将关键笔划发送到窗格:

>>>pane.send_keys('echo hey send now')>>>pane.send_keys('echo hey',enter=False)>>>pane.enter()

获取窗格的输出:

>>>pane.clear()# clear the pane>>>pane.send_keys('cowsay hello')>>>print('\n'.join(pane.cmd('capture-pane','-p').stdout))
sh-3.2$ cowsay 'hello'
 _______
< hello >
 -------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

强大的遍历功能:

>>> pane.window
Window(@10 1:libtmuxower, Session($3 foo))
>>> pane.window.session
Session($3 foo)

捐款

你的捐赠基金开发新功能,测试和支持。 你的钱将直接用于项目的维护和开发。 如果你是一个个体,你可以自由地付出一切 从项目中获得的价值。

请参阅https://git-pull.com/support.html上的捐赠选项。

项目详细信息

tmux support1.8, 1.9a, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
python support2.7, >= 3.3, pypy, pypy3
Sourcehttps://github.com/tmux-python/libtmux
Docshttps://libtmux.git-pull.com
APIhttps://libtmux.git-pull.com/en/latest/api.html
Changeloghttps://libtmux.git-pull.com/en/latest/history.html
Issueshttps://github.com/tmux-python/libtmux/issues
Travishttp://travis-ci.org/tmux-python/libtmux
Test Coveragehttps://codecov.io/gh/tmux-python/libtmux
pypihttps://pypi.python.org/pypi/libtmux
Open Hubhttps://www.openhub.net/p/libtmux-python
LicenseMIT.
git repo^{pr 19}$
install stable^{pr 20}$
install dev^{pr 21}$

See the developing and testing page in the docs for more.

tests^{pr 22}$

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在Salesforce中查询自定义对象?   RichFaces 4中的java ExtendedDataTable:数据模型处理   java Android类层次结构和带有片段的接口   java如何在文件中保存JLabel的颜色/大小?   java编辑类中的返回值而不修改类本身?   安卓如何替换字符串java中的ï»   1.3.7.发布>1.4.1。发布| java。lang.NoSuchMethodError:org。springframework。靴子建设者SpringApplicationBuilder。展示横幅   java列表保存在模型中,而不在setter中进行设置   java如何打开一个窗口。windows中的ks文件?   Java HashMap获取值(其中大部分值)   vps的javascript Websocketurl?   使用byte buddy或某些库进行java评测   java Dom4j获取单节点文本值