-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathmount.ts
219 lines (218 loc) · 5.24 KB
/
mount.ts
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
const completionSpec: Fig.Spec = {
name: "mount",
description: "Mount disks and manage subtrees",
args: [
{
name: "Disk/loopfile",
template: "filepaths",
generators: [
{
script: ["cat", "/proc/partitions"], // this way we don't depend on lsblk
postProcess: (out) => {
return out
.trim()
.split("\n")
.splice(2, out.length)
.map((line) => "/dev/" + line.split(" ").pop())
.filter((x) => x != "/dev/")
.map((blk) => {
return { name: blk, description: "Block device" };
});
},
},
{
script: ["ls", "-1", "/dev/mapper"], // usually LUKS encrypted partitions are here
postProcess: (out) => {
return out
.trim()
.split("\n")
.filter((x) => x.length != 0)
.map((blk) => {
return {
name: "/dev/mapper/" + blk,
description: "Mapped block device",
};
});
},
},
],
},
{
name: "mountpoint",
template: "folders",
suggestions: ["/mnt", "/run/media/"],
},
],
options: [
{
name: ["-h", "--help"],
description: "Help for abc",
},
{
name: ["-a", "--all"],
description: "Mount all filesystems in fstab",
},
{
name: ["-c", "--no-canonicalize"],
description: "Don't canonicalize paths",
},
{
name: ["-f", "--fake"],
description: "Dry run; skip the mount(2) syscall",
},
{
name: ["-F", "--fork"],
description: "Fork off for each device (use with -a)",
},
{
name: ["-T", "--fstab"],
description: "Alternative file to /etc/fstab",
args: {
name: "fstab",
template: "filepaths",
default: "/etc/fstab",
},
},
{
name: ["-i", "--internal-only"],
description: "Don't call the mount.<type> helpers",
},
{
name: ["-l", "--show-labels"],
description: "Show also filesystem labels",
},
{
name: ["-m", "--mkdir"],
description: "Alias to '-o X-mount.mkdir",
},
{
name: ["-n", "--no-mtab"],
description: "Don't write to /etc/mtab",
},
{
name: "--options-mode",
description: "What to do with options loaded from fstab",
args: {
name: "mode",
},
},
{
name: "--options-source",
description: "Mount options source",
args: {
name: "source",
template: "filepaths",
},
},
{
name: "--options-source-force",
description: "Force use of options from fstab/mtab",
},
{
name: ["-o", "--options"],
description: "Comma-separated list of mount options",
args: {
name: "list",
},
},
{
name: ["-O", "--test-opts"],
description: "Limit the set of filesystems (use with -a)",
args: {
name: "list",
},
},
{
name: ["-r", "--read-only"],
description: "Mount the filesystem read-only (same as -o ro)",
},
{
name: ["-t", "--types"],
description: "Limit the set of filesystem types",
args: {
name: "list",
},
},
{
name: "--source",
description: "Explicitly specifies source",
args: {
name: "source",
suggestions: ["path", "label", "uuid"],
},
},
{
name: "--target",
description: "Explicitly specifies mountpoint",
args: {
name: "mountpoint",
template: "folders",
},
},
{
name: "--target-prefix",
description: "Specifies path used for all mountpoints",
args: {
name: "path",
template: "folders",
},
},
{
name: ["-v", "--verbose"],
description: "Say what is being done",
},
{
name: ["-w", "--rw", "--read-write"],
description: "Mount the filesystem read-write (default)",
},
{
name: ["-V", "--version"],
description: "Display version",
},
{
name: ["-B", "--bind"],
description: "Mount a subtree somewhere else (same as -o bind)",
},
{
name: ["-M", "--move"],
description: "Move a subtree to some other place",
},
{
name: ["-R", "-rbind"],
description: "Mount a subtree and all submounts somewhere else",
},
{
name: "--make-shared",
description: "Mark a subtree as shared",
},
{
name: "--make-slave",
description: "Mark a subtree as slave",
},
{
name: "--make-private",
description: "Mark a subtree as private",
},
{
name: "--make-unbindable",
description: "Mark a subtree as unbindable",
},
{
name: "--make-rshared",
description: "Recursively mark a whole subtree as shared",
},
{
name: "--make-rslave",
description: "Recursively mark a whole subtree as slave",
},
{
name: "--make-rprivate",
description: "Recursively mark a whole subtree as private",
},
{
name: "--make-runbindable",
description: "Recursively mark a whole subtree as unbindable",
},
],
};
export default completionSpec;