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