-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathkitty.ts
615 lines (611 loc) · 14.9 KB
/
kitty.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
const icatCommand: Fig.Subcommand = {
name: "icat",
description: "A cat like utility to display images in the terminal",
options: [
{
name: "--align",
description: "Horizontal alignment for the displayed image",
args: {
name: "ALIGN",
default: "center",
suggestions: ["center", "left", "right"],
},
},
{
name: "--place",
description: "Choose where on the screen to display the image",
args: {
name: "PLACE",
description: "<width>x<height>@<left>x<top>",
},
},
{
name: "--scale-up",
description:
"Images that are smaller than the specified area to be scaled up to use as much of the specified area as possible",
dependsOn: ["--place"],
},
{
name: "--background",
description:
"Specify a background color, this will cause transparent images to be composited on top of the specified color",
args: {
name: "COLOR",
default: "none",
suggestions: [
["none", "000000"],
["black", "000000"],
["white", "ffffff"],
["gray", "808080"],
["red", "ff0000"],
["green", "00ff00"],
["blue", "0000ff"],
["yellow", "ffff00"],
["magenta", "ff00ff"],
["cyan", "00ffff"],
].map(([name, hex]) => ({
name,
icon: `fig://template?color=${hex}`,
})),
},
},
{
name: "--mirror",
description:
"Mirror the image about a horizontal or vertical axis or both",
args: {
name: "AXIS",
default: "none",
suggestions: ["horizontal", "both", "none", "vertical"],
},
},
{
name: "--clear",
description: "Remove all images currently displayed on the screen",
},
{
name: "--transfer-mode",
description: "Which mechanism to use to transfer images to the terminal",
args: {
name: "TRANSFER_MODE",
default: "detect",
suggestions: ["file", "detect", "stream"],
},
},
{
name: "--detect-support",
description: "Detect support for image display in the terminal",
},
{
name: "--detection-timeout",
description: "How long to wait for detection to complete before aborting",
dependsOn: ["--detect-support"],
args: {
name: "TIMEOUT",
default: "10",
},
},
{
name: "--print-window-size",
description: "Print the current terminal window size in pixels",
},
{
name: "--stdin",
description: "Read an image from stdin",
},
],
args: {
name: "image-file-or-url-or-directory",
template: "filepaths",
},
};
const kittenCommands: Fig.Subcommand[] = [
icatCommand,
{
name: "diff",
args: [
{ name: "file1", template: "filepaths" },
{ name: "file2", template: "filepaths" },
],
},
{ name: "show_key" },
{ name: "clipboard" },
{ name: "unicode_input" },
{ name: "panel" },
{ name: "transfer" },
{ name: "query_terminal" },
{ name: "broadcast" },
{
name: "hyperlinked_grep",
loadSpec: "rg",
},
{
name: "ssh",
loadSpec: "ssh",
},
{ name: "choose" },
{ name: "ask" },
{
name: "themes",
description: "Change the kitty theme",
},
{ name: "hints" },
{ name: "remote_file" },
{ name: "show_error" },
{ name: "resize_window" },
{ name: "mouse_demo" },
];
const plusCommands: Fig.Subcommand[] = [
icatCommand,
{
name: "list-fonts",
},
{
name: "hold",
},
{
name: "complete",
},
{
name: "runpy",
},
{
name: "launch",
},
{
name: "open",
},
{
name: "kitten",
subcommands: kittenCommands,
},
{
name: "edit-config",
},
{
name: "shebang",
},
];
const completionSpec: Fig.Spec = {
name: "kitty",
options: [
{
name: ["-T", "--title"],
description: "Set the OS window title",
args: {
name: "TITLE",
},
},
{
name: ["-C", "--config"],
description: "Specify a path to the configuration file(s) to use",
args: {
name: "CONFIG",
template: "filepaths",
},
},
{
name: ["-o", "--override"],
description: "Override individual configuration options",
isRepeatable: true,
},
{
name: ["-d", "--directory", "--working-directory"],
description: "Change to the specified directory when launching",
args: {
name: "DIRECTORY",
template: "folders",
},
},
{
name: "--session",
description: "Path to a file containing the startup session",
args: {
name: "SESSION",
template: "filepaths",
suggestions: [
{
name: "-",
description: "Read from stdin",
},
],
},
},
{
name: "--hold",
description: "Remain open after child process exits",
},
{
name: ["-1", "--single-instance"],
description: "Only a single instance of kitty will run",
},
{
name: "--instance-group",
description:
"Kitty will open a new window in an existing instance and quit immediately",
dependsOn: ["-1", "--single-instance"],
args: {
name: "INSTANCE_GROUP",
},
},
{
name: "--wait-for-single-instance-window-close",
description:
"The new window will not quit till the newly opened window is closed",
dependsOn: ["-1", "--single-instance"],
},
{
name: "--listen-on",
description:
"Tell kitty to listen on the specified address for control messages",
args: {
name: "LISTEN_ON",
},
},
{
name: "--start-as",
description: "Control how the initial kitty window is created",
args: {
name: "START_AS",
suggestions: ["normal", "fullscreen", "maximized", "minimized"],
},
},
{
name: ["-v", "--version"],
description: "The current kitty version",
},
{
name: ["-h", "--help"],
description: "Display this help message",
},
],
subcommands: [
{
name: "@",
options: [
{
name: "--to",
description: "An address for the kitty instance to control",
args: {
name: "TO",
},
},
],
subcommands: [
{
name: "close-tab",
description: "Close the specified tab(s)",
options: [
{
name: ["-m", "--match"],
description: "The tab to match",
args: {
name: "MATCH",
},
},
{
name: "--self",
description:
"Close the tab of the window this command is run in, rather than the active tab",
},
{
name: "--target-group",
description: "Close the specified group of tabs",
args: {
name: "TARGET_GROUP",
},
},
],
},
{
name: "close-window",
description: "Close the specified window(s)",
options: [
{
name: ["-m", "--match"],
description: "The window to match",
args: {
name: "MATCH",
},
},
{
name: "--self",
description:
"Close the window this command is run in, rather than the active window",
},
],
},
{
name: "create-marker",
options: [
{
name: ["-m", "--match"],
description: "The window to match",
args: {
name: "MATCH",
},
},
{
name: "--self",
description:
"Close the window this command is run in, rather than the active window",
},
],
args: [
{
name: "MARKER",
},
{
name: "SPECIFICATION",
},
],
},
{
name: "detach-tab",
description: "Detach the specified tab",
options: [
{
name: ["-m", "--match"],
description: "The tab to match",
args: {
name: "MATCH",
},
},
{
name: ["-t", "--target-tab"],
description: "The tab to match",
args: {
name: "TARGET_TAB",
},
},
{
name: "--self",
description:
"Detach the tab this command is run in, rather than the active tab",
},
],
},
{
name: "detach-window",
description: "Detach the specified window",
options: [
{
name: ["-m", "--match"],
description: "The window to match",
args: {
name: "MATCH",
},
},
{
name: ["-t", "--target-tab"],
description: "The tab to match",
args: {
name: "TARGET_TAB",
},
},
{
name: "--self",
description:
"Detach the window this command is run in, rather than the active window",
},
],
},
{
name: "disable-ligatures",
description:
"Control ligature rendering for the specified windows/tabs",
options: [
{
name: ["-a", "--all"],
description: "Disable in all windows",
},
{
name: ["-m", "--match"],
description: "The window to match",
args: {
name: "MATCH",
},
},
{
name: ["-t", "--match-tab"],
description: "The tab to match",
},
],
args: {
name: "STRATEGY",
suggestions: ["never", "always", "cursor"],
},
},
{
name: "env",
description:
"Change the environment variables seen by processing in newly launched windows",
args: {
name: "ENV",
isVariadic: true,
},
},
{
name: "focus-tab",
description: "The active window in the specified tab will be focused",
options: [
{
name: ["-m", "--match"],
description: "The tab to match",
args: {
name: "MATCH",
},
},
{
name: "--no-response",
description:
"Don't wait for a response indicating the success of the action",
},
],
},
{
name: "focus-window",
description:
"Focus the specified window, if no window is specified, focus the window this command is run inside",
options: [
{
name: ["-m", "--match"],
description: "The window to match",
args: {
name: "MATCH",
},
},
{
name: "--no-response",
description:
"Don't wait for a response indicating the success of the action",
},
],
},
{
name: "get-colors",
description: "Get the terminal colors for the specified window",
options: [
{
name: ["-c", "--configured"],
description:
"Instead of outputting the colors for the specified window, output the currently configured colors",
},
{
name: ["-m", "--match"],
description: "The window to match",
},
],
},
{
name: "get-text",
},
{
name: "goto-layout",
},
{
name: "kitten",
icon: "🐱",
},
{
name: "last-used-layout",
},
{
name: "launch",
},
{
name: "ls",
},
{
name: "new-window",
},
{
name: "remove-marker",
},
{
name: "resize-os-window",
},
{
name: "resize-window",
},
{
name: "scroll-window",
},
{
name: "select-window",
},
{
name: "send-text",
},
{
name: "set-background-image",
},
{
name: "set-background-opacity",
},
{
name: "set-colors",
},
{
name: "set-enabled-layouts",
},
{
name: "set-font-size",
},
{
name: "set-spacing",
},
{
name: "set-tab-color",
description:
"The foreground and background colors when active and inactive can be overridden using this command",
options: [
{
name: ["-m", "--match"],
description: "The tab to match",
args: {
name: "MATCH",
},
},
{
name: "--self",
description:
"Close the window this command is run in, rather than the active window",
},
],
},
{
name: "set-tab-title",
description: "Set the title for the specified tab(s)",
options: [
{
name: ["-m", "--match"],
description: "The tab to match",
},
],
},
{
name: "set-window-logo",
},
{
name: "set-window-title",
description: "Set the title of the specified window(s)",
options: [
{
name: ["-m", "--match"],
description: "The window to match",
},
{
name: "--temporary",
description: "The title can be overwritten by escape sequences",
},
],
},
{
name: "signal-child",
description:
"Send one or more signals to the foreground process in the specified window(s)",
options: [
{
name: ["-m", "--match"],
description: "The window to match",
},
],
args: {
name: "SIGNAL",
isVariadic: true,
},
},
],
},
icatCommand,
...plusCommands.map((kitten) => ({
...kitten,
name: `+${kitten.name}`,
})),
],
args: {
isCommand: true,
},
};
export default completionSpec;