Skip to content

Commit 843b4cb

Browse files
committed
docs(CLI): Update to argparse
1 parent 25c83f9 commit 843b4cb

File tree

10 files changed

+143
-62
lines changed

10 files changed

+143
-62
lines changed

docs/cli/completion.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,58 @@
11
(completion)=
22

3-
# Completion
3+
(completions)=
4+
5+
(cli-completions)=
6+
7+
# Completions
8+
9+
## tmuxp 1.17+ (experimental)
10+
11+
```{note}
12+
See the [shtab library's documentation on shell completion](https://docs.iterative.ai/shtab/use/#cli-usage) for the most up to date way of connecting completion for tmuxp.
13+
```
14+
15+
Provisional support for completions in tmuxp 1.17+ are powered by [shtab](https://docs.iterative.ai/shtab/). This must be **installed separately**, as it's **not currently bundled with tmuxp**.
16+
17+
```console
18+
$ pip install shtab --user
19+
```
20+
21+
:::{tab} bash
22+
23+
```bash
24+
shtab --shell=bash -u tmuxp.cli.create_parser \
25+
| sudo tee "$BASH_COMPLETION_COMPAT_DIR"/TMUXP
26+
```
27+
28+
:::
29+
30+
:::{tab} zsh
31+
32+
```zsh
33+
shtab --shell=zsh -u tmuxp.cli.create_parser \
34+
| sudo tee /usr/local/share/zsh/site-functions/_TMUXP
35+
```
36+
37+
:::
38+
39+
:::{tab} tcsh
40+
41+
```zsh
42+
shtab --shell=tcsh -u tmuxp.cli.create_parser \
43+
| sudo tee /etc/profile.d/TMUXP.completion.csh
44+
```
45+
46+
:::
47+
48+
## tmuxp 1.1 to 1.16
449

550
```{note}
651
See the [click library's documentation on shell completion](https://click.palletsprojects.com/en/8.0.x/shell-completion/) for the most up to date way of connecting completion for tmuxp.
752
```
853

54+
tmuxp 1.1 to 1.16 use [click](https://click.palletsprojects.com)'s completion:
55+
956
:::{tab} Bash
1057

1158
_~/.bashrc_:

docs/cli/convert.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44

55
Convert between YAML and JSON
66

7+
```{eval-rst}
8+
.. argparse::
9+
:module: tmuxp.cli
10+
:func: create_parser
11+
:prog: tmuxp
12+
:path: convert
13+
```
14+
15+
## Usage
16+
717
````{tab} YAML -> JSON
818
919
```console
@@ -22,12 +32,3 @@ $ tmuxp convert /path/to/file.json
2232

2333
tmuxp automatically will prompt to convert `.yaml` to `.json` and
2434
`.json` to `.yaml`.
25-
26-
## Reference
27-
28-
```{eval-rst}
29-
.. click:: tmuxp.cli.convert:command_convert
30-
:prog: tmuxp convert
31-
:commands: convert
32-
:nested: full
33-
```

docs/cli/debug-info.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
Use to collect all relevant information for submitting an issue to
88
the project.
99

10+
```{eval-rst}
11+
.. argparse::
12+
:module: tmuxp.cli
13+
:func: create_parser
14+
:prog: tmuxp
15+
:path: debug-info
16+
```
17+
18+
## Usage
19+
1020
```console
1121

1222
$ tmuxp debug-info
@@ -17,12 +27,3 @@ environment:
1727
...
1828

1929
```
20-
21-
## Reference
22-
23-
```{eval-rst}
24-
.. click:: tmuxp.cli.debug_info:command_debug_info
25-
:prog: tmuxp debug-info
26-
:commands: debug-info
27-
:nested: full
28-
```

docs/cli/edit.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
(edit-config)=
22

3+
(cli-edit)=
4+
35
# tmuxp edit
46

57
```{eval-rst}
6-
.. click:: tmuxp.cli.edit:command_edit
7-
:prog: tmuxp edit
8-
:commands: edit
9-
:nested: full
8+
.. argparse::
9+
:module: tmuxp.cli
10+
:func: create_parser
11+
:prog: tmuxp
12+
:path: edit
1013
```

docs/cli/freeze.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
(cli-freeze)=
22

3+
(cli-freeze-reference)=
4+
35
# tmuxp freeze
46

7+
```{eval-rst}
8+
.. argparse::
9+
:module: tmuxp.cli
10+
:func: create_parser
11+
:prog: tmuxp
12+
:path: freeze
13+
```
14+
15+
## Usage
16+
517
Freeze sessions
618

719
```console
@@ -23,12 +35,3 @@ Tmuxp will offer to save your session state to `.json` or `.yaml`.
2335
If no session is specified, it will default to the attached session.
2436

2537
If the `--force` argument is passed, it will overwrite any existing config file with the same name.
26-
27-
(cli-freeze-reference)=
28-
29-
```{eval-rst}
30-
.. click:: tmuxp.cli.freeze:command_freeze
31-
:prog: tmuxp freeze
32-
:commands: freeze
33-
:nested: full
34-
```

docs/cli/import.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
## From teamocil
88

99
```{eval-rst}
10-
.. click:: tmuxp.cli.import_config:command_import_teamocil
11-
:prog: tmuxp import teamocil
12-
:nested: full
10+
.. argparse::
11+
:module: tmuxp.cli
12+
:func: create_parser
13+
:prog: tmuxp
14+
:path: import teamocil
1315
```
1416

1517
````{tab} YAML
@@ -33,9 +35,11 @@ $ tmuxp import teamocil /path/to/file.json
3335
## From tmuxinator
3436

3537
```{eval-rst}
36-
.. click:: tmuxp.cli.import_config:command_import_tmuxinator
37-
:prog: tmuxp import tmuxinator
38-
:nested: short
38+
.. argparse::
39+
:module: tmuxp.cli
40+
:func: create_parser
41+
:prog: tmuxp
42+
:path: import tmuxinator
3943
```
4044

4145
````{tab} YAML

docs/cli/index.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,35 @@ edit
2121
import
2222
convert
2323
freeze
24-
2524
```
2625

2726
```{toctree}
2827
:caption: Diagnostic
2928
:maxdepth: 1
3029
3130
debug-info
32-
3331
```
3432

3533
```{toctree}
36-
:caption: More
34+
:caption: Completion
3735
:maxdepth: 1
3836
3937
completion
4038
```
39+
40+
(cli-main)=
41+
42+
(tmuxp-main)=
43+
44+
## Command: `tmuxp`
45+
46+
```{eval-rst}
47+
.. argparse::
48+
:module: tmuxp.cli
49+
:func: create_parser
50+
:prog: tmuxp
51+
:nosubcommands:
52+
53+
subparser_name : @replace
54+
See :ref:`cli-ls`
55+
```

docs/cli/load.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,20 @@
22

33
(tmuxp-load)=
44

5+
(tmuxp-load-reference)=
6+
57
# tmuxp load
68

9+
```{eval-rst}
10+
.. argparse::
11+
:module: tmuxp.cli
12+
:func: create_parser
13+
:prog: tmuxp
14+
:path: load
15+
```
16+
17+
## Usage
18+
719
You can load your tmuxp file and attach the vim session via a few
820
shorthands:
921

@@ -136,14 +148,3 @@ $ tmuxp load [filename] --log-file [log_filename]
136148
```console
137149
$ tmuxp --log-level [LEVEL] load [filename] --log-file [log_filename]
138150
```
139-
140-
## Reference
141-
142-
(tmuxp-load-reference)=
143-
144-
```{eval-rst}
145-
.. click:: tmuxp.cli.load:command_load
146-
:prog: tmuxp load
147-
:commands: load
148-
:nested: full
149-
```

docs/cli/ls.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
(cli-ls)=
2+
13
(ls-config)=
24

35
# tmuxp ls
46

7+
List sesssions.
8+
59
```{eval-rst}
6-
.. click:: tmuxp.cli.ls:command_ls
7-
:prog: tmuxp ls
8-
:commands: ls
9-
:nested: full
10+
.. argparse::
11+
:module: tmuxp.cli
12+
:func: create_parser
13+
:prog: tmuxp
14+
:path: ls
1015
```

docs/cli/shell.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
(cli-shell)=
22

3+
(tmuxp-shell)=
4+
35
# tmuxp shell
46

57
```{eval-rst}
6-
.. click:: tmuxp.cli.shell:command_shell
7-
:prog: tmuxp shell
8-
:commands: shell
9-
:nested: none
8+
.. argparse::
9+
:module: tmuxp.cli
10+
:func: create_parser
11+
:prog: tmuxp
12+
:path: shell
1013
```
1114

1215
## Directly enter commands
@@ -15,8 +18,6 @@
1518
$ tmuxp shell -c 'python code'
1619
```
1720

18-
## Example
19-
2021
```{image} ../_static/tmuxp-shell.gif
2122
:width: 100%
2223
```

0 commit comments

Comments
 (0)