Skip to content

Commit a18143d

Browse files
committed
docs(cli): Copy-paste improvements
1 parent 633b9ad commit a18143d

File tree

1 file changed

+49
-17
lines changed

1 file changed

+49
-17
lines changed

docs/cli.md

+49-17
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,17 @@ eval "$(_TMUXP_COMPLETE=zsh_source tmuxp)"
3434

3535
```console
3636
$ tmuxp shell
37+
```
3738

39+
```console
3840
$ tmuxp shell [session_name]
41+
```
3942

43+
```console
4044
$ tmuxp shell [session_name] [window_name]
45+
```
4146

47+
```console
4248
$ tmuxp shell -c 'python code'
4349
```
4450

@@ -76,36 +82,45 @@ Python 3.7 supports [PEP 553][pep 553]'s `PYTHONBREAKPOINT` and supports
7682
compatible debuggers, for instance [ipdb][ipdb]:
7783

7884
```console
79-
8085
$ pip install --user ipdb
86+
```
87+
88+
```console
8189
$ env PYTHONBREAKPOINT=ipdb.set_trace tmuxp shell
8290
```
8391

8492
You can also pass in python code directly, similar to `python -c`, do
8593
this via `tmuxp -c`:
8694

8795
```console
88-
8996
$ tmuxp shell -c 'print(session.name); print(window.name)'
9097
my_server
9198
my_window
99+
```
92100

101+
```console
93102
$ tmuxp shell my_server -c 'print(session.name); print(window.name)'
94103
my_server
95104
my_window
105+
```
96106

107+
```console
97108
$ tmuxp shell my_server my_window -c 'print(session.name); print(window.name)'
98109
my_server
99110
my_window
111+
```
100112

113+
```console
101114
$ tmuxp shell my_server my_window -c 'print(window.name.upper())'
102115
MY_WINDOW
116+
```
117+
118+
Assuming inside a tmux pane or one is attached on default server:
103119

104-
# Assuming inside a tmux pane or one is attached on default server
120+
```console
105121
$ tmuxp shell -c 'print(pane.id); print(pane.window.name)'
106122
%2
107123
my_window
108-
109124
```
110125

111126
[pep 553]: https://www.python.org/dev/peps/pep-0553/
@@ -154,37 +169,54 @@ shorthands:
154169
2. The name of the project file in your {}`$HOME/.tmuxp` folder
155170
3. The direct path of the tmuxp file you want to load
156171

172+
Path to folder with `.tmuxp.yaml`, `.tmuxp.yml`, `.tmuxp.json`:
173+
157174
```console
158-
# path to folder with .tmuxp.{yaml,yml,json}
159175
$ tmuxp load .
176+
```
177+
178+
```console
160179
$ tmuxp load ../
180+
```
181+
182+
```console
161183
$ tmuxp load path/to/folder/
184+
```
185+
186+
```console
162187
$ tmuxp load /path/to/folder/
188+
```
163189

164-
# name of the config, assume $HOME/.tmuxp/myconfig.yaml
190+
Name of the config, assume `$HOME/.tmuxp/myconfig.yaml`:
191+
```console
165192
$ tmuxp load myconfig
193+
```
194+
195+
Direct path to json/yaml file:
166196

167-
# direct path to json/yaml file
197+
```console
168198
$ tmuxp load ./myfile.yaml
199+
```
200+
201+
```console
169202
$ tmuxp load /abs/path/to/myfile.yaml
203+
```
204+
205+
```console
170206
$ tmuxp load ~/myfile.yaml
171207
```
172208

173209
Absolute and relative directory paths are supported.
174210

175211
```console
176-
177212
$ tmuxp load [filename]
178-
179213
```
180214

181215
Files named `.tmuxp.yaml` or `.tmuxp.json` in the current working
182216
directory may be loaded with:
183217

184218
```console
185-
186219
$ tmuxp load .
187-
188220
```
189221

190222
If you try to load a config file from within a tmux session, it will ask you
@@ -201,7 +233,13 @@ All of these options can be preselected to skip the prompt:
201233

202234
```console
203235
$ tmuxp load -y config # load attached
236+
```
237+
238+
```console
204239
$ tmuxp load -d config # load detached
240+
```
241+
242+
```console
205243
$ tmuxp load -a config # append windows
206244
```
207245

@@ -210,29 +248,23 @@ without being attached. The last one will be attached if there is no
210248
`-d` flag on the command line.
211249

212250
```console
213-
214251
$ tmuxp load [filename1] [filename2] ...
215-
216252
```
217253

218254
A session name can be provided at the terminal. If multiple sessions
219255
are created, the last session is named from the terminal.
220256

221257
```console
222-
223258
$ tmuxp load -s [new_session_name] [filename1] ...
224-
225259
```
226260

227261
The output of the `load` command can be logged to a file for
228262
debugging purposes. the log level can be controlled with the global
229263
`--log-level` option (defaults to INFO).
230264

231265
```console
232-
233266
$ tmuxp load [filename] --log-file [log_filename]
234267
$ tmuxp --log-level [LEVEL] load [filename] --log-file [log_filename]
235-
236268
```
237269

238270
(cli-debug-info)=

0 commit comments

Comments
 (0)