chaakoo

简介
Chaakoo是TMUX的一个封装器,可以从基于网格的布局中创建会话、窗口和窗格。这里的想法是受CSS网格模板区域的启发。
例如,这个网格。
vim vim vim term
vim vim vim term
play play play play
将创建以下布局。
基于进一步的窗格划分,这个布局也可以有点复杂,比如。
arandr arandr bzip cat
vim vim err cat
vim vim file file
grafana grafana grafana grafana
grafana grafana grafana grafana
配置
一个有3个窗格的窗口的配置yaml,像第一个例子,在这里。
name: code-environment
windows:
- grid: |
vim vim vim term
vim vim vim term
play play play play
name: window1
commands:
- pane: vim
command: |
vim
- pane: term
command: |
cd ~
systemctl status
workdir: /home/waterbottle/code
- pane: play
command: |
tail -f /var/log/messages
name是TMUX会话名称windows是一个窗口的数组- 每个窗口都包含
name- 窗口的名称grid- 二维布局或网格,布局中每个不同的名字代表一个窗格。commands是将在窗格中执行的命令的数组- 每个命令对象都包含。
pane- 窗格的名称command- 可以包含命令的多行文本workdir- 窗格的第一个目录。它可以进一步通过cd中的改变。command
注意:commands 部分或窗格的命令不是一个必须的字段。Chaakoo可以只用来创建窗格
布局,然后用户可以接管并执行他们的命令。
使用Chaakoo
- 开始一个会话
# Start a TMUX server
$ tmux start-server
# and then pass the config to Chaakoo
$ chaakoo -c examples/1/chaakoo.yaml
4:43PM ERR github.com/pallavJha/chaakoo/tmux_wrapper.go:349 > unable to get the list of the present sessions error="exit status 1" sessionName=code-environment stderr="no server running on /tmp/tmux-1000/default\n" stdout=
4:43PM INF github.com/pallavJha/chaakoo/cmd/chaakoo.go:66 > session created successfully, it can be attached by executing:
4:43PM INF github.com/pallavJha/chaakoo/cmd/chaakoo.go:67 > tmux a -t code-environment
# Attach the TMUX session
$ tmux a -t code-environment
- 使用
--verbose或-v标志开始,将把日志级别设为DEBUG,时间格式设为RFC3339
$ chaakoo -c examples/1/chaakoo.yaml -v
2021-09-26T16:47:50+05:30 DBG github.com/pallavJha/chaakoo/cmd/chaakoo.go:128 > setting global log level to DEBUG as verbose log is enabled
2021-09-26T16:47:50+05:30 DBG github.com/pallavJha/chaakoo/cmd/chaakoo.go:98 > using examples/1/chaakoo.yaml
2021-09-26T16:47:50+05:30 DBG github.com/pallavJha/chaakoo/cmd/chaakoo.go:114 > using config file: examples/1/chaakoo.yaml
2021-09-26T16:47:50+05:30 DBG github.com/pallavJha/chaakoo/cmd/chaakoo.go:50 > finding the dimensions
2021-09-26T16:47:50+05:30 DBG github.com/pallavJha/chaakoo/cmd/chaakoo.go:56 > found dimensions height=81 width=274
-- more logs --
- 了解更多信息。
$ chaakoo --help
chaakoo converts the 2D grids or matrix into TMUX windows and panes
Usage:
chaakoo [flags]
Flags:
-c, --config string config file (default is ./chaakoo.yaml)
-d, --dry-run if true then commands will only be shown and not executed
-e, --exit-on-error if true then chaakoo will exit after it encounters the first error during command execution
-r, --height int terminal dimension for rows or height, if 0 then rows and cols will be found internally
-h, --help help for chaakoo
-v, --verbose enable verbose logging
-V, --version print the version
-w, --width int terminal dimension for cols or width
示例
例子目录下有更多的配置和快照的例子。
下载
最新的二进制文件可以从最新的GitHub版本中下载。
这些二进制文件是静态链接的。
许可
Copyright 2021 Pallav Jha
根据Apache许可证2.0版("许可证")授权;
除非符合许可证规定,否则不得使用该文件。
您可以在以下地址获得许可证的副本
http://www.apache.org/licenses/LICENSE-2.0

