- commit
- f520c4c
- parent
- fd29a10
- author
- Yi Zhou
- date
- 2026-03-12 23:05:11 -0400 EDT
Refactor fish completions for zmx command (#90)
1 files changed,
+18,
-15
+18,
-15
1@@ -118,22 +118,25 @@ const zsh_completions =
2 const fish_completions =
3 \\complete -c zmx -f
4 \\
5- \\set -l subcommands attach run detach list completions kill history version help
6- \\set -l no_subcmd "not __fish_seen_subcommand_from $subcommands"
7+ \\complete -c zmx -n "__fish_is_nth_token 1" -a 'a attach' -d 'Attach to session, creating if needed'
8+ \\complete -c zmx -n "__fish_is_nth_token 1" -a 'r run' -d 'Send command without attaching'
9+ \\complete -c zmx -n "__fish_is_nth_token 1" -a 'd detach' -d 'Detach all clients from current session'
10+ \\complete -c zmx -n "__fish_is_nth_token 1" -a 'l list' -d 'List active sessions'
11+ \\complete -c zmx -n "__fish_is_nth_token 1" -a 'c completions' -d 'Shell completion scripts'
12+ \\complete -c zmx -n "__fish_is_nth_token 1" -a 'k kill' -d 'Kill a session'
13+ \\complete -c zmx -n "__fish_is_nth_token 1" -a 'hi history' -d 'Output session scrollback'
14+ \\complete -c zmx -n "__fish_is_nth_token 1" -a 'v version' -d 'Show version'
15+ \\complete -c zmx -s v -l version -d 'Show version'
16+ \\complete -c zmx -n "__fish_is_nth_token 1" -a 'w wait' -d 'Wait for session tasks to complete'
17+ \\complete -c zmx -n "__fish_is_nth_token 1" -a 'h help' -d 'Show help message'
18+ \\complete -c zmx -s h -d 'Show help message'
19 \\
20- \\complete -c zmx -n $no_subcmd -a attach -d 'Attach to session, creating if needed'
21- \\complete -c zmx -n $no_subcmd -a run -d 'Send command without attaching'
22- \\complete -c zmx -n $no_subcmd -a detach -d 'Detach all clients from current session'
23- \\complete -c zmx -n $no_subcmd -a list -d 'List active sessions'
24- \\complete -c zmx -n $no_subcmd -a completions -d 'Shell completion scripts'
25- \\complete -c zmx -n $no_subcmd -a kill -d 'Kill a session'
26- \\complete -c zmx -n $no_subcmd -a history -d 'Output session scrollback'
27- \\complete -c zmx -n $no_subcmd -a version -d 'Show version'
28- \\complete -c zmx -n $no_subcmd -a help -d 'Show help message'
29+ \\complete -c zmx -n "__fish_is_nth_token 2; and __fish_seen_subcommand_from a attach r run k kill hi history w wait" -a '(zmx list --short 2>/dev/null)' -d 'Session name'
30 \\
31- \\complete -c zmx -n "__fish_seen_subcommand_from attach run kill history" -a '(zmx list --short 2>/dev/null)' -d 'Session name'
32+ \\complete -c zmx -n "__fish_is_nth_token 2; and __fish_seen_subcommand_from c completions" -a 'bash zsh fish' -d Shell
33 \\
34- \\complete -c zmx -n "__fish_seen_subcommand_from completions" -a 'bash zsh fish' -d 'Shell'
35- \\
36- \\complete -c zmx -n "__fish_seen_subcommand_from list" -l short -d 'Short output'
37+ \\complete -c zmx -n "__fish_seen_subcommand_from l list" -l short -d 'Short output'
38+ \\complete -c zmx -n "__fish_seen_subcommand_from hi history" -l vt -d 'History format for escape sequences'
39+ \\complete -c zmx -n "__fish_seen_subcommand_from hi history" -l html -d 'History format for escape sequences'
40+
41 ;