Skip to content

Commit 2fcc708

Browse files
authored
Update README.md
1 parent 05376a6 commit 2fcc708

File tree

1 file changed

+98
-2
lines changed

1 file changed

+98
-2
lines changed

README.md

Lines changed: 98 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,107 @@
11
# tmux-compose
2-
Define and run tmux sessions.
2+
Orchestrate the creation of tmux sessions with dependencies between commands in windows and panes.
33

44
This project is like a mash-up of docker-compose and teamocil/tmuxinator for tmux, hence the name "tmux-compose".
55

66
You create YAML config files that detail what windows and panes should be created and any commands that should be run in them. Then, you can setup dependencies between panes and windows to orchestrate the order in which the commands are run.
77

8-
=== Directly Inspired By:
8+
### example.yml
9+
```yaml
10+
name: example
11+
dir: ~/project
12+
windows:
13+
14+
# Start a database
15+
- name: database
16+
panes:
17+
- cmd: service postgresql start
18+
readycheck:
19+
test: pg_isready -h localhost -p 5432 -U postgres
20+
interval: 3s
21+
retries: 3
22+
23+
# Run a program that must start after the database is ready
24+
- panes:
25+
- cmd: ./myprogram
26+
depends_on: ["database"]
27+
```
28+
29+
Bring up a tmux session:
30+
```bash
31+
tmux-compose -f example.yml up
32+
```
33+
34+
Teardown a tmux session:
35+
```bash
36+
tmux-compose -f example.yml down
37+
```
38+
39+
### Installation
40+
41+
tmux-compose was built with Go.
42+
43+
```bash
44+
go get github.com/kevinms/tmux-compose.git
45+
```
46+
47+
#### Build from source
48+
49+
```bash
50+
git clone https://github.com/kevinms/tmux-compose.git
51+
cd tmux-compose
52+
go install
53+
```
54+
55+
Go code can easily compile for other OSes, but I have only tested running it in Linux.
56+
57+
### Project
58+
Example showing all options for the root node of the config file
59+
```yaml
60+
name: example
61+
dir: /path/to/project
62+
pre_cmd: touch example.tmp
63+
post_cmd: rm example.tmp
64+
windows:
65+
- name: code
66+
panes:
67+
- cmd: vim
68+
- panes:
69+
- cmd: top
70+
```
71+
72+
### Windows
73+
Example showing all options being used for a window:
74+
```yaml
75+
name: example
76+
windows:
77+
- name: My Window
78+
dir: ~/project
79+
focus: true
80+
layout: main-vertical
81+
depends_on: ["thing1", "thing2"]
82+
panes:
83+
- cmd: vim
84+
- cmd: sleep 5
85+
```
86+
87+
### Panes
88+
Example showing all options being used for a pane:
89+
```yaml
90+
name: example
91+
windows:
92+
- panes:
93+
- name: My Pane
94+
dir: ~/project
95+
cmd: python -m SimpleHTTPServer 8000
96+
focus: true
97+
readycheck:
98+
test: ping -c1 domain.net
99+
interval: 3s
100+
retries: 10
101+
depends_on: ["thing1", "thing2"]
102+
```
103+
104+
#### Directly Inspired By:
9105
10106
* docker-compose
11107
* teamocil

0 commit comments

Comments
 (0)