Commit f520c4c
Yi Zhou
·
2026-03-12 23:05:11 -0400 EDT
parent fd29a10
Refactor fish completions for zmx command (#90)
1 files changed,
+18,
-15
+18,
-15
| ... | ... | @@ -118,22 +118,25 @@ const zsh_completions = | |
| 118 | 118 | const fish_completions = | |
| 119 | 119 | \\complete -c zmx -f | |
| 120 | 120 | \\ | |
| 121 | - | \\set -l subcommands attach run detach list completions kill history version help | |
| 122 | - | \\set -l no_subcmd "not __fish_seen_subcommand_from $subcommands" | |
| 121 | + | \\complete -c zmx -n "__fish_is_nth_token 1" -a 'a attach' -d 'Attach to session, creating if needed' | |
| 122 | + | \\complete -c zmx -n "__fish_is_nth_token 1" -a 'r run' -d 'Send command without attaching' | |
| 123 | + | \\complete -c zmx -n "__fish_is_nth_token 1" -a 'd detach' -d 'Detach all clients from current session' | |
| 124 | + | \\complete -c zmx -n "__fish_is_nth_token 1" -a 'l list' -d 'List active sessions' | |
| 125 | + | \\complete -c zmx -n "__fish_is_nth_token 1" -a 'c completions' -d 'Shell completion scripts' | |
| 126 | + | \\complete -c zmx -n "__fish_is_nth_token 1" -a 'k kill' -d 'Kill a session' | |
| 127 | + | \\complete -c zmx -n "__fish_is_nth_token 1" -a 'hi history' -d 'Output session scrollback' | |
| 128 | + | \\complete -c zmx -n "__fish_is_nth_token 1" -a 'v version' -d 'Show version' | |
| 129 | + | \\complete -c zmx -s v -l version -d 'Show version' | |
| 130 | + | \\complete -c zmx -n "__fish_is_nth_token 1" -a 'w wait' -d 'Wait for session tasks to complete' | |
| 131 | + | \\complete -c zmx -n "__fish_is_nth_token 1" -a 'h help' -d 'Show help message' | |
| 132 | + | \\complete -c zmx -s h -d 'Show help message' | |
| 123 | 133 | \\ | |
| 124 | - | \\complete -c zmx -n $no_subcmd -a attach -d 'Attach to session, creating if needed' | |
| 125 | - | \\complete -c zmx -n $no_subcmd -a run -d 'Send command without attaching' | |
| 126 | - | \\complete -c zmx -n $no_subcmd -a detach -d 'Detach all clients from current session' | |
| 127 | - | \\complete -c zmx -n $no_subcmd -a list -d 'List active sessions' | |
| 128 | - | \\complete -c zmx -n $no_subcmd -a completions -d 'Shell completion scripts' | |
| 129 | - | \\complete -c zmx -n $no_subcmd -a kill -d 'Kill a session' | |
| 130 | - | \\complete -c zmx -n $no_subcmd -a history -d 'Output session scrollback' | |
| 131 | - | \\complete -c zmx -n $no_subcmd -a version -d 'Show version' | |
| 132 | - | \\complete -c zmx -n $no_subcmd -a help -d 'Show help message' | |
| 134 | + | \\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' | |
| 133 | 135 | \\ | |
| 134 | - | \\complete -c zmx -n "__fish_seen_subcommand_from attach run kill history" -a '(zmx list --short 2>/dev/null)' -d 'Session name' | |
| 136 | + | \\complete -c zmx -n "__fish_is_nth_token 2; and __fish_seen_subcommand_from c completions" -a 'bash zsh fish' -d Shell | |
| 135 | 137 | \\ | |
| 136 | - | \\complete -c zmx -n "__fish_seen_subcommand_from completions" -a 'bash zsh fish' -d 'Shell' | |
| 137 | - | \\ | |
| 138 | - | \\complete -c zmx -n "__fish_seen_subcommand_from list" -l short -d 'Short output' | |
| 138 | + | \\complete -c zmx -n "__fish_seen_subcommand_from l list" -l short -d 'Short output' | |
| 139 | + | \\complete -c zmx -n "__fish_seen_subcommand_from hi history" -l vt -d 'History format for escape sequences' | |
| 140 | + | \\complete -c zmx -n "__fish_seen_subcommand_from hi history" -l html -d 'History format for escape sequences' | |
| 141 | + | ||
| 139 | 142 | ; |