Commit 0a5a2a9
Benjamin Pollack
·
2026-05-12 20:37:23 -0400 EDT
parent 250c980
feat(completions): add nushell
1 files changed,
+44,
-0
+44,
-0
1@@ -4,11 +4,13 @@ pub const Shell = enum {
2 bash,
3 zsh,
4 fish,
5+ nu,
6
7 pub fn fromString(s: []const u8) ?Shell {
8 if (std.mem.eql(u8, s, "bash")) return .bash;
9 if (std.mem.eql(u8, s, "zsh")) return .zsh;
10 if (std.mem.eql(u8, s, "fish")) return .fish;
11+ if (std.mem.eql(u8, s, "nu")) return .nu;
12
13 return null;
14 }
15@@ -18,6 +20,7 @@ pub const Shell = enum {
16 .bash => bash_completions,
17 .zsh => zsh_completions,
18 .fish => fish_completions,
19+ .nu => nu_completions,
20 };
21 }
22 };
23@@ -153,3 +156,44 @@ const fish_completions =
24 \\complete -c zmx -n "__fish_seen_subcommand_from hi history" -l vt -d 'History format for escape sequences'
25 \\complete -c zmx -n "__fish_seen_subcommand_from hi history" -l html -d 'History format for escape sequences'
26 ;
27+
28+const nu_completions =
29+ \\def "nu-complete zmx sessions" [] {
30+ \\ zmx list --short | lines
31+ \\}
32+ \\
33+ \\def "nu-complete zmx complete" [] {
34+ \\ [bash fish nu zsh]
35+ \\}
36+ \\
37+ \\export extern "zmx attach" [
38+ \\ name: string@"nu-complete zmx sessions"
39+ \\ ...rest: string
40+ \\]
41+ \\
42+ \\export extern "zmx run" [
43+ \\ name: string@"nu-complete zmx sessions"
44+ \\ -d
45+ \\ --fish
46+ \\ ...rest: string
47+ \\]
48+ \\
49+ \\export extern "zmx write" [
50+ \\ name: string@"nu-complete zmx sessions"
51+ \\ path: path
52+ \\]
53+ \\
54+ \\export extern "zmx kill" [
55+ \\ --force
56+ \\ name: string@"nu-complete zmx sessions"
57+ \\]
58+ \\
59+ \\export extern "zmx detach" []
60+ \\export extern "zmx list" [--short]
61+ \\export extern "zmx history" [name: string@"nu-complete zmx sessions", --vt, --html]
62+ \\export extern "zmx wait" [...sessions: string@"nu-complete zmx sessions"]
63+ \\export extern "zmx tail" [...sessions: string@"nu-complete zmx sessions"]
64+ \\export extern "zmx version" []
65+ \\export extern "completions" [shell: string@"nu-complete zmx complete"]
66+ \\export extern "zmx help" []
67+;