@shell-shock/plugin-completions 0.1.14 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/components/bash-command.cjs +101 -25
  2. package/dist/components/bash-command.d.cts +2 -2
  3. package/dist/components/bash-command.d.cts.map +1 -1
  4. package/dist/components/bash-command.d.mts +2 -2
  5. package/dist/components/bash-command.d.mts.map +1 -1
  6. package/dist/components/bash-command.mjs +101 -25
  7. package/dist/components/bash-command.mjs.map +1 -1
  8. package/dist/components/fish-command.cjs +402 -0
  9. package/dist/components/fish-command.d.cts +10 -0
  10. package/dist/components/fish-command.d.cts.map +1 -0
  11. package/dist/components/fish-command.d.mts +10 -0
  12. package/dist/components/fish-command.d.mts.map +1 -0
  13. package/dist/components/fish-command.mjs +403 -0
  14. package/dist/components/fish-command.mjs.map +1 -0
  15. package/dist/components/index.cjs +4 -0
  16. package/dist/components/index.d.cts +3 -1
  17. package/dist/components/index.d.mts +3 -1
  18. package/dist/components/index.mjs +3 -1
  19. package/dist/components/powershell-command.cjs +418 -0
  20. package/dist/components/powershell-command.d.cts +10 -0
  21. package/dist/components/powershell-command.d.cts.map +1 -0
  22. package/dist/components/powershell-command.d.mts +10 -0
  23. package/dist/components/powershell-command.d.mts.map +1 -0
  24. package/dist/components/powershell-command.mjs +419 -0
  25. package/dist/components/powershell-command.mjs.map +1 -0
  26. package/dist/components/zsh-command.cjs +213 -26
  27. package/dist/components/zsh-command.d.cts.map +1 -1
  28. package/dist/components/zsh-command.d.mts +2 -2
  29. package/dist/components/zsh-command.d.mts.map +1 -1
  30. package/dist/components/zsh-command.mjs +213 -26
  31. package/dist/components/zsh-command.mjs.map +1 -1
  32. package/dist/helpers/complete-command.cjs +14 -0
  33. package/dist/helpers/complete-command.d.cts +5 -0
  34. package/dist/helpers/complete-command.d.cts.map +1 -0
  35. package/dist/helpers/complete-command.d.mts +5 -0
  36. package/dist/helpers/complete-command.d.mts.map +1 -0
  37. package/dist/helpers/complete-command.mjs +14 -0
  38. package/dist/helpers/complete-command.mjs.map +1 -0
  39. package/dist/helpers/completion-directive-constants.cjs +15 -0
  40. package/dist/helpers/completion-directive-constants.d.cts +14 -0
  41. package/dist/helpers/completion-directive-constants.d.cts.map +1 -0
  42. package/dist/helpers/completion-directive-constants.d.mts +14 -0
  43. package/dist/helpers/completion-directive-constants.d.mts.map +1 -0
  44. package/dist/helpers/completion-directive-constants.mjs +15 -0
  45. package/dist/helpers/completion-directive-constants.mjs.map +1 -0
  46. package/dist/helpers/index.cjs +5 -0
  47. package/dist/helpers/index.d.cts +3 -0
  48. package/dist/helpers/index.d.mts +3 -0
  49. package/dist/helpers/index.mjs +4 -0
  50. package/dist/index.cjs +42 -5
  51. package/dist/index.d.cts.map +1 -1
  52. package/dist/index.d.mts.map +1 -1
  53. package/dist/index.mjs +42 -5
  54. package/dist/index.mjs.map +1 -1
  55. package/dist/types/index.d.cts +1 -1
  56. package/dist/types/index.d.mts +1 -1
  57. package/dist/types/plugin.d.cts +16 -3
  58. package/dist/types/plugin.d.cts.map +1 -1
  59. package/dist/types/plugin.d.mts +16 -3
  60. package/dist/types/plugin.d.mts.map +1 -1
  61. package/dist/types/shell-type.cjs +6 -1
  62. package/dist/types/shell-type.d.cts +1 -1
  63. package/dist/types/shell-type.d.mts +1 -1
  64. package/dist/types/shell-type.mjs +6 -1
  65. package/dist/types/shell-type.mjs.map +1 -1
  66. package/package.json +79 -8
@@ -0,0 +1,403 @@
1
+ import { exec } from "../helpers/complete-command.mjs";
2
+ import { CompletionDirective } from "../helpers/completion-directive-constants.mjs";
3
+ import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
4
+ import { getAppBin, getAppTitle } from "@shell-shock/core/plugin-utils";
5
+ import { joinPaths } from "@stryke/path";
6
+ import { code } from "@alloy-js/core";
7
+ import { FunctionDeclaration, IfStatement, InterfaceDeclaration, VarDeclaration } from "@alloy-js/typescript";
8
+ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
9
+ import { Spacing } from "@powerlines/plugin-alloy/core";
10
+ import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
11
+ import { InterfaceMember, TypescriptFile } from "@powerlines/plugin-alloy/typescript";
12
+ import { TSDoc, TSDocDefaultValue, TSDocRemarks } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
13
+ import { snakeCase } from "@stryke/string-format/snake-case";
14
+
15
+ //#region src/components/fish-command.tsx
16
+ /**
17
+ * The Fish Completions commands' handler wrapper for the Shell Shock project.
18
+ */
19
+ function FishCompletionsCommand() {
20
+ const context = usePowerlines();
21
+ return createComponent(TypescriptFile, {
22
+ get path() {
23
+ return joinPaths(context.entryPath, "completions", "fish", "command.ts");
24
+ },
25
+ imports: {
26
+ "node:os": ["os"],
27
+ "node:fs/promises": ["readFile", "writeFile"]
28
+ },
29
+ builtinImports: { "shell-shock:console": [
30
+ "colors",
31
+ "writeLine",
32
+ "success",
33
+ "warn",
34
+ "stripAnsi"
35
+ ] },
36
+ get children() {
37
+ return [
38
+ createComponent(TSDoc, { heading: "Options for the Fish completions command." }),
39
+ createComponent(InterfaceDeclaration, {
40
+ "export": true,
41
+ name: "FishCompletionsOptions",
42
+ get children() {
43
+ return [
44
+ createComponent(TSDoc, {
45
+ heading: "The path to write the completion script to.",
46
+ get children() {
47
+ return [createComponent(TSDocRemarks, { children: `If no extension is provided, the \`.fish\` extension will be used.` }), createComponent(TSDocDefaultValue, {
48
+ get type() {
49
+ return ReflectionKind.string;
50
+ },
51
+ get defaultValue() {
52
+ return `${getAppBin(context)}-completions.fish`;
53
+ }
54
+ })];
55
+ }
56
+ }),
57
+ createComponent(InterfaceMember, {
58
+ name: "script",
59
+ optional: true,
60
+ type: "string | true"
61
+ }),
62
+ createComponent(Spacing, {}),
63
+ createComponent(TSDoc, {
64
+ heading: "The Fish configuration file to append the completion script to.",
65
+ get children() {
66
+ return [createComponent(TSDocRemarks, { children: `The generated completion script will be appended to the specified configuration file. Possible values for the Fish configuration file include: \\n- \`~/.config/fish/config.fish\`` }), createComponent(TSDocDefaultValue, {
67
+ get type() {
68
+ return ReflectionKind.string;
69
+ },
70
+ defaultValue: "~/.config/fish/config.fish"
71
+ })];
72
+ }
73
+ }),
74
+ createComponent(InterfaceMember, {
75
+ name: "config",
76
+ optional: true,
77
+ type: "string | true"
78
+ })
79
+ ];
80
+ }
81
+ }),
82
+ createComponent(Spacing, {}),
83
+ createComponent(TSDoc, { heading: "Handler logic for the \\`completions fish\\` command." }),
84
+ createComponent(FunctionDeclaration, {
85
+ "export": true,
86
+ "default": true,
87
+ async: true,
88
+ name: "handler",
89
+ parameters: [{
90
+ name: "options",
91
+ type: "FishCompletionsOptions"
92
+ }],
93
+ get children() {
94
+ return [
95
+ createComponent(VarDeclaration, {
96
+ "const": true,
97
+ name: "completions",
98
+ type: "string",
99
+ get initializer() {
100
+ return code`# fish completion for ${getAppTitle(context)} -*- shell-script -*-
101
+
102
+ function __${snakeCase(getAppBin(context))}_debug
103
+ set -l file "$BASH_COMP_DEBUG_FILE"
104
+ if test -n "$file"
105
+ echo "$argv" >> $file
106
+ end
107
+ end
108
+
109
+ function __${snakeCase(getAppBin(context))}_perform_completion
110
+ __${snakeCase(getAppBin(context))}_debug "Starting __${snakeCase(getAppBin(context))}_perform_completion"
111
+
112
+ # Extract all args except the last one
113
+ set -l args (commandline -opc)
114
+ # Extract the last arg and escape it in case it is a space or wildcard
115
+ set -l lastArg (string escape -- (commandline -ct))
116
+
117
+ __${snakeCase(getAppBin(context))}_debug "args: $args"
118
+ __${snakeCase(getAppBin(context))}_debug "last arg: $lastArg"
119
+
120
+ # Build the completion request command
121
+ set -l requestComp "${exec} complete -- (string join ' ' -- (string escape -- $args[2..-1])) $lastArg"
122
+
123
+ __${snakeCase(getAppBin(context))}_debug "Calling $requestComp"
124
+ set -l results (eval $requestComp 2> /dev/null)
125
+
126
+ # Some programs may output extra empty lines after the directive.
127
+ # Let's ignore them or else it will break completion.
128
+ # Ref: https://github.com/spf13/cobra/issues/1279
129
+ for line in $results[-1..1]
130
+ if test (string trim -- $line) = ""
131
+ # Found an empty line, remove it
132
+ set results $results[1..-2]
133
+ else
134
+ # Found non-empty line, we have our proper output
135
+ break
136
+ end
137
+ end
138
+
139
+ set -l comps $results[1..-2]
140
+ set -l directiveLine $results[-1]
141
+
142
+ # For Fish, when completing a flag with an = (e.g., <program> -n=<TAB>)
143
+ # completions must be prefixed with the flag
144
+ set -l flagPrefix (string match -r -- '-.*=' "$lastArg")
145
+
146
+ __${snakeCase(getAppBin(context))}_debug "Comps: $comps"
147
+ __${snakeCase(getAppBin(context))}_debug "DirectiveLine: $directiveLine"
148
+ __${snakeCase(getAppBin(context))}_debug "flagPrefix: $flagPrefix"
149
+
150
+ for comp in $comps
151
+ printf "%s%s\\n" "$flagPrefix" "$comp"
152
+ end
153
+
154
+ printf "%s\\n" "$directiveLine"
155
+ end
156
+
157
+ # This function limits calls to __${snakeCase(getAppBin(context))}_perform_completion, by caching the result
158
+ function __${snakeCase(getAppBin(context))}_perform_completion_once
159
+ __${snakeCase(getAppBin(context))}_debug "Starting __${snakeCase(getAppBin(context))}_perform_completion_once"
160
+
161
+ if test -n "$__${snakeCase(getAppBin(context))}_perform_completion_once_result"
162
+ __${snakeCase(getAppBin(context))}_debug "Seems like a valid result already exists, skipping __${snakeCase(getAppBin(context))}_perform_completion"
163
+ return 0
164
+ end
165
+
166
+ set --global __${snakeCase(getAppBin(context))}_perform_completion_once_result (__${snakeCase(getAppBin(context))}_perform_completion)
167
+ if test -z "$__${snakeCase(getAppBin(context))}_perform_completion_once_result"
168
+ __${snakeCase(getAppBin(context))}_debug "No completions, probably due to a failure"
169
+ return 1
170
+ end
171
+
172
+ __${snakeCase(getAppBin(context))}_debug "Performed completions and set __${snakeCase(getAppBin(context))}_perform_completion_once_result"
173
+ return 0
174
+ end
175
+
176
+ # This function is used to clear the cached result after completions are run
177
+ function __${snakeCase(getAppBin(context))}_clear_perform_completion_once_result
178
+ __${snakeCase(getAppBin(context))}_debug ""
179
+ __${snakeCase(getAppBin(context))}_debug "========= clearing previously set __${snakeCase(getAppBin(context))}_perform_completion_once_result variable =========="
180
+ set --erase __${snakeCase(getAppBin(context))}_perform_completion_once_result
181
+ __${snakeCase(getAppBin(context))}_debug "Successfully erased the variable __${snakeCase(getAppBin(context))}_perform_completion_once_result"
182
+ end
183
+
184
+ function __${snakeCase(getAppBin(context))}_requires_order_preservation
185
+ __${snakeCase(getAppBin(context))}_debug ""
186
+ __${snakeCase(getAppBin(context))}_debug "========= checking if order preservation is required =========="
187
+
188
+ __${snakeCase(getAppBin(context))}_perform_completion_once
189
+ if test -z "$__${snakeCase(getAppBin(context))}_perform_completion_once_result"
190
+ __${snakeCase(getAppBin(context))}_debug "Error determining if order preservation is required"
191
+ return 1
192
+ end
193
+
194
+ set -l directive (string sub --start 2 $__${snakeCase(getAppBin(context))}_perform_completion_once_result[-1])
195
+ __${snakeCase(getAppBin(context))}_debug "Directive is: $directive"
196
+
197
+ set -l shellCompDirectiveKeepOrder ${CompletionDirective.CompletionDirectiveKeepOrder}
198
+ set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) % 2)
199
+ __${snakeCase(getAppBin(context))}_debug "Keeporder is: $keeporder"
200
+
201
+ if test $keeporder -ne 0
202
+ __${snakeCase(getAppBin(context))}_debug "This does require order preservation"
203
+ return 0
204
+ end
205
+
206
+ __${snakeCase(getAppBin(context))}_debug "This doesn't require order preservation"
207
+ return 1
208
+ end
209
+
210
+ # This function does two things:
211
+ # - Obtain the completions and store them in the global __${snakeCase(getAppBin(context))}_comp_results
212
+ # - Return false if file completion should be performed
213
+ function __${snakeCase(getAppBin(context))}_prepare_completions
214
+ __${snakeCase(getAppBin(context))}_debug ""
215
+ __${snakeCase(getAppBin(context))}_debug "========= starting completion logic =========="
216
+
217
+ # Start fresh
218
+ set --erase __${snakeCase(getAppBin(context))}_comp_results
219
+
220
+ __${snakeCase(getAppBin(context))}_perform_completion_once
221
+ __${snakeCase(getAppBin(context))}_debug "Completion results: $__${snakeCase(getAppBin(context))}_perform_completion_once_result"
222
+
223
+ if test -z "$__${snakeCase(getAppBin(context))}_perform_completion_once_result"
224
+ __${snakeCase(getAppBin(context))}_debug "No completion, probably due to a failure"
225
+ # Might as well do file completion, in case it helps
226
+ return 1
227
+ end
228
+
229
+ set -l directive (string sub --start 2 $__${snakeCase(getAppBin(context))}_perform_completion_once_result[-1])
230
+ set --global __${snakeCase(getAppBin(context))}_comp_results $__${snakeCase(getAppBin(context))}_perform_completion_once_result[1..-2]
231
+
232
+ __${snakeCase(getAppBin(context))}_debug "Completions are: $__${snakeCase(getAppBin(context))}_comp_results"
233
+ __${snakeCase(getAppBin(context))}_debug "Directive is: $directive"
234
+
235
+ set -l shellCompDirectiveError ${CompletionDirective.CompletionDirectiveError}
236
+ set -l shellCompDirectiveNoSpace ${CompletionDirective.CompletionDirectiveNoSpace}
237
+ set -l shellCompDirectiveNoFileComp ${CompletionDirective.CompletionDirectiveNoFileComp}
238
+ set -l shellCompDirectiveFilterFileExt ${CompletionDirective.CompletionDirectiveFilterFileExt}
239
+ set -l shellCompDirectiveFilterDirs ${CompletionDirective.CompletionDirectiveFilterDirs}
240
+ if test -z "$directive"
241
+ set directive 0
242
+ end
243
+
244
+ set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2)
245
+ if test $compErr -eq 1
246
+ __${snakeCase(getAppBin(context))}_debug "Received error directive: aborting."
247
+ # Might as well do file completion, in case it helps
248
+ return 1
249
+ end
250
+
251
+ set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2)
252
+ set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2)
253
+ if test $filefilter -eq 1; or test $dirfilter -eq 1
254
+ __${snakeCase(getAppBin(context))}_debug "File extension filtering or directory filtering not supported"
255
+ # Do full file completion instead
256
+ return 1
257
+ end
258
+
259
+ set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2)
260
+ set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2)
261
+
262
+ __${snakeCase(getAppBin(context))}_debug "nospace: $nospace, nofiles: $nofiles"
263
+
264
+ # If we want to prevent a space, or if file completion is NOT disabled,
265
+ # we need to count the number of valid completions.
266
+ # To do so, we will filter on prefix as the completions we have received
267
+ # may not already be filtered so as to allow fish to match on different
268
+ # criteria than the prefix.
269
+ if test $nospace -ne 0; or test $nofiles -eq 0
270
+ set -l prefix (commandline -t | string escape --style=regex)
271
+ __${snakeCase(getAppBin(context))}_debug "prefix: $prefix"
272
+
273
+ set -l completions (string match -r -- "^$prefix.*" $__${snakeCase(getAppBin(context))}_comp_results)
274
+ set --global __${snakeCase(getAppBin(context))}_comp_results $completions
275
+ __${snakeCase(getAppBin(context))}_debug "Filtered completions are: $__${snakeCase(getAppBin(context))}_comp_results"
276
+
277
+ # Important not to quote the variable for count to work
278
+ set -l numComps (count $__${snakeCase(getAppBin(context))}_comp_results)
279
+ __${snakeCase(getAppBin(context))}_debug "numComps: $numComps"
280
+
281
+ if test $numComps -eq 1; and test $nospace -ne 0
282
+ # We must first split on \\t to get rid of the descriptions to be
283
+ # able to check what the actual completion will be.
284
+ # We don't need descriptions anyway since there is only a single
285
+ # real completion which the shell will expand immediately.
286
+ set -l split (string split --max 1 "\\t" $__${snakeCase(getAppBin(context))}_comp_results[1])
287
+
288
+ # Fish won't add a space if the completion ends with any
289
+ # of the following characters: @=/:.,
290
+ set -l lastChar (string sub -s -1 -- $split)
291
+ if not string match -r -q "[@=/:.,]" -- "$lastChar"
292
+ # In other cases, to support the "nospace" directive we trick the shell
293
+ # by outputting an extra, longer completion.
294
+ __${snakeCase(getAppBin(context))}_debug "Adding second completion to perform nospace directive"
295
+ set --global __${snakeCase(getAppBin(context))}_comp_results $split[1] $split[1].
296
+ __${snakeCase(getAppBin(context))}_debug "Completions are now: $__${snakeCase(getAppBin(context))}_comp_results"
297
+ end
298
+ end
299
+
300
+ if test $numComps -eq 0; and test $nofiles -eq 0
301
+ # To be consistent with bash and zsh, we only trigger file
302
+ # completion when there are no other completions
303
+ __${snakeCase(getAppBin(context))}_debug "Requesting file completion"
304
+ return 1
305
+ end
306
+ end
307
+
308
+ return 0
309
+ end
310
+
311
+ # Since Fish completions are only loaded once the user triggers them, we trigger them ourselves
312
+ # so we can properly delete any completions provided by another script.
313
+ # Only do this if the program can be found, or else fish may print some errors; besides,
314
+ # the existing completions will only be loaded if the program can be found.
315
+ if type -q "${getAppBin(context)}"
316
+ # The space after the program name is essential to trigger completion for the program
317
+ # and not completion of the program name itself.
318
+ # Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish.
319
+ complete --do-complete "${getAppBin(context)} " > /dev/null 2>&1
320
+ end
321
+
322
+ # Remove any pre-existing completions for the program since we will be handling all of them.
323
+ complete -c ${getAppBin(context)} -e
324
+ # This will get called after the two calls below and clear the cached result
325
+ complete -c ${getAppBin(context)} -n '__${snakeCase(getAppBin(context))}_clear_perform_completion_once_result'
326
+ # The call to __${snakeCase(getAppBin(context))}_prepare_completions will setup __${snakeCase(getAppBin(context))}_comp_results
327
+ # which provides the program's completion choices.
328
+ # If this doesn't require order preservation, we don't use the -k flag
329
+ complete -c ${getAppBin(context)} -n 'not __${snakeCase(getAppBin(context))}_requires_order_preservation && __${snakeCase(getAppBin(context))}_prepare_completions' -f -a '$__${snakeCase(getAppBin(context))}_comp_results'
330
+ # Otherwise we use the -k flag
331
+ complete -k -c ${getAppBin(context)} -n '__${snakeCase(getAppBin(context))}_requires_order_preservation && __${snakeCase(getAppBin(context))}_prepare_completions' -f -a '$__${snakeCase(getAppBin(context))}_comp_results'
332
+ \`);`;
333
+ }
334
+ }),
335
+ createComponent(Spacing, {}),
336
+ createComponent(IfStatement, {
337
+ condition: code`options.config`,
338
+ get children() {
339
+ return [
340
+ createComponent(VarDeclaration, {
341
+ "let": true,
342
+ name: "configFilePath",
343
+ type: "string",
344
+ initializer: code`options.config === true ? "~/.config/fish/config.fish" : options.config`
345
+ }),
346
+ createComponent(Spacing, {}),
347
+ createComponent(IfStatement, {
348
+ condition: code`configFilePath.startsWith("~")`,
349
+ children: code`configFilePath = join(os.homedir(), configFilePath.replace("~", "")); `
350
+ }),
351
+ createComponent(Spacing, {}),
352
+ createComponent(VarDeclaration, {
353
+ "let": true,
354
+ name: "configFileContent",
355
+ type: "string",
356
+ initializer: code`"";`
357
+ }),
358
+ createComponent(Spacing, {}),
359
+ memo(() => code`try {
360
+ configFileContent = await readFile(configFilePath, "utf8");
361
+ } catch (error) {
362
+ if (error.code === "ENOENT") {
363
+ // If the file doesn't exist, we can create it later when writing the completion script.
364
+ warn(\`Configuration file \${colors.bold(configFilePath)} does not exist. It will be created when the completion script is written.\`);
365
+ } else {
366
+ return { error };
367
+ }
368
+ }
369
+
370
+ await writeFile(configFilePath, \`\${configFileContent}\\n\\n\${stripAnsi(completions)}\`);
371
+
372
+ success(\`${getAppTitle(context)} Fish completion script has been generated and appended to \${colors.bold(configFilePath)}. Please restart your terminal or run \`source \${configFilePath}\` to apply the changes.\`); `)
373
+ ];
374
+ }
375
+ }),
376
+ createComponent(Spacing, {}),
377
+ createComponent(IfStatement, {
378
+ condition: code`options.script`,
379
+ get children() {
380
+ return code`const outputPath = options.script === true ? "${getAppBin(context)}-completions.fish" : options.script;
381
+ await writeFile(outputPath, stripAnsi(completions));
382
+
383
+ success(\`${getAppTitle(context)} Fish completion script has been generated at \${colors.bold(outputPath)}.\`);`;
384
+ }
385
+ }),
386
+ createComponent(Spacing, {}),
387
+ createComponent(IfStatement, {
388
+ condition: code`!options.config && !options.script`,
389
+ children: code`writeLine(" ------------------------------------------------- ");
390
+ writeLine(completions);
391
+ writeLine(" ------------------------------------------------- ");`
392
+ })
393
+ ];
394
+ }
395
+ })
396
+ ];
397
+ }
398
+ });
399
+ }
400
+
401
+ //#endregion
402
+ export { FishCompletionsCommand };
403
+ //# sourceMappingURL=fish-command.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fish-command.mjs","names":["code","FunctionDeclaration","IfStatement","InterfaceDeclaration","VarDeclaration","ReflectionKind","Spacing","usePowerlines","InterfaceMember","TypescriptFile","TSDoc","TSDocDefaultValue","TSDocRemarks","getAppBin","getAppTitle","joinPaths","snakeCase","exec","CompletionDirective","FishCompletionsCommand","context","_$createComponent","path","entryPath","imports","builtinImports","children","heading","name","type","string","defaultValue","optional","async","parameters","initializer","CompletionDirectiveKeepOrder","CompletionDirectiveError","CompletionDirectiveNoSpace","CompletionDirectiveNoFileComp","CompletionDirectiveFilterFileExt","CompletionDirectiveFilterDirs","condition","_$memo"],"sources":["../../src/components/fish-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InterfaceMember,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TSDocRemarks\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { exec } from \"../helpers/complete-command\";\nimport { CompletionDirective } from \"../helpers/completion-directive-constants\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Fish Completions commands' handler wrapper for the Shell Shock project.\n */\nexport function FishCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(context.entryPath, \"completions\", \"fish\", \"command.ts\")}\n imports={{\n \"node:os\": [\"os\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"colors\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"stripAnsi\"\n ]\n }}>\n <TSDoc heading=\"Options for the Fish completions command.\" />\n <InterfaceDeclaration export name=\"FishCompletionsOptions\">\n <TSDoc heading=\"The path to write the completion script to.\">\n <TSDocRemarks>{`If no extension is provided, the \\`.fish\\` extension will be used.`}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue={`${getAppBin(context)}-completions.fish`}\n />\n </TSDoc>\n <InterfaceMember name=\"script\" optional type=\"string | true\" />\n <Spacing />\n <TSDoc heading=\"The Fish configuration file to append the completion script to.\">\n <TSDocRemarks>{`The generated completion script will be appended to the specified configuration file. Possible values for the Fish configuration file include: \\\\n- \\`~/.config/fish/config.fish\\``}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue=\"~/.config/fish/config.fish\"\n />\n </TSDoc>\n <InterfaceMember name=\"config\" optional type=\"string | true\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions fish\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[{ name: \"options\", type: \"FishCompletionsOptions\" }]}>\n <VarDeclaration\n const\n name=\"completions\"\n type=\"string\"\n initializer={code`# fish completion for ${getAppTitle(\n context\n )} -*- shell-script -*-\n\nfunction __${snakeCase(getAppBin(context))}_debug\n set -l file \"$BASH_COMP_DEBUG_FILE\"\n if test -n \"$file\"\n echo \"$argv\" >> $file\n end\nend\n\nfunction __${snakeCase(getAppBin(context))}_perform_completion\n __${snakeCase(getAppBin(context))}_debug \"Starting __${snakeCase(getAppBin(context))}_perform_completion\"\n\n # Extract all args except the last one\n set -l args (commandline -opc)\n # Extract the last arg and escape it in case it is a space or wildcard\n set -l lastArg (string escape -- (commandline -ct))\n\n __${snakeCase(getAppBin(context))}_debug \"args: $args\"\n __${snakeCase(getAppBin(context))}_debug \"last arg: $lastArg\"\n\n # Build the completion request command\n set -l requestComp \"${exec} complete -- (string join ' ' -- (string escape -- $args[2..-1])) $lastArg\"\n\n __${snakeCase(getAppBin(context))}_debug \"Calling $requestComp\"\n set -l results (eval $requestComp 2> /dev/null)\n\n # Some programs may output extra empty lines after the directive.\n # Let's ignore them or else it will break completion.\n # Ref: https://github.com/spf13/cobra/issues/1279\n for line in $results[-1..1]\n if test (string trim -- $line) = \"\"\n # Found an empty line, remove it\n set results $results[1..-2]\n else\n # Found non-empty line, we have our proper output\n break\n end\n end\n\n set -l comps $results[1..-2]\n set -l directiveLine $results[-1]\n\n # For Fish, when completing a flag with an = (e.g., <program> -n=<TAB>)\n # completions must be prefixed with the flag\n set -l flagPrefix (string match -r -- '-.*=' \"$lastArg\")\n\n __${snakeCase(getAppBin(context))}_debug \"Comps: $comps\"\n __${snakeCase(getAppBin(context))}_debug \"DirectiveLine: $directiveLine\"\n __${snakeCase(getAppBin(context))}_debug \"flagPrefix: $flagPrefix\"\n\n for comp in $comps\n printf \"%s%s\\\\n\" \"$flagPrefix\" \"$comp\"\n end\n\n printf \"%s\\\\n\" \"$directiveLine\"\nend\n\n# This function limits calls to __${snakeCase(getAppBin(context))}_perform_completion, by caching the result\nfunction __${snakeCase(getAppBin(context))}_perform_completion_once\n __${snakeCase(getAppBin(context))}_debug \"Starting __${snakeCase(\n getAppBin(context)\n )}_perform_completion_once\"\n\n if test -n \"$__${snakeCase(getAppBin(context))}_perform_completion_once_result\"\n __${snakeCase(getAppBin(context))}_debug \"Seems like a valid result already exists, skipping __${snakeCase(getAppBin(context))}_perform_completion\"\n return 0\n end\n\n set --global __${snakeCase(getAppBin(context))}_perform_completion_once_result (__${snakeCase(getAppBin(context))}_perform_completion)\n if test -z \"$__${snakeCase(getAppBin(context))}_perform_completion_once_result\"\n __${snakeCase(getAppBin(context))}_debug \"No completions, probably due to a failure\"\n return 1\n end\n\n __${snakeCase(getAppBin(context))}_debug \"Performed completions and set __${snakeCase(getAppBin(context))}_perform_completion_once_result\"\n return 0\nend\n\n# This function is used to clear the cached result after completions are run\nfunction __${snakeCase(getAppBin(context))}_clear_perform_completion_once_result\n __${snakeCase(getAppBin(context))}_debug \"\"\n __${snakeCase(getAppBin(context))}_debug \"========= clearing previously set __${snakeCase(getAppBin(context))}_perform_completion_once_result variable ==========\"\n set --erase __${snakeCase(getAppBin(context))}_perform_completion_once_result\n __${snakeCase(getAppBin(context))}_debug \"Successfully erased the variable __${snakeCase(getAppBin(context))}_perform_completion_once_result\"\nend\n\nfunction __${snakeCase(getAppBin(context))}_requires_order_preservation\n __${snakeCase(getAppBin(context))}_debug \"\"\n __${snakeCase(getAppBin(context))}_debug \"========= checking if order preservation is required ==========\"\n\n __${snakeCase(getAppBin(context))}_perform_completion_once\n if test -z \"$__${snakeCase(getAppBin(context))}_perform_completion_once_result\"\n __${snakeCase(getAppBin(context))}_debug \"Error determining if order preservation is required\"\n return 1\n end\n\n set -l directive (string sub --start 2 $__${snakeCase(\n getAppBin(context)\n )}_perform_completion_once_result[-1])\n __${snakeCase(getAppBin(context))}_debug \"Directive is: $directive\"\n\n set -l shellCompDirectiveKeepOrder ${\n CompletionDirective.CompletionDirectiveKeepOrder\n }\n set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) % 2)\n __${snakeCase(getAppBin(context))}_debug \"Keeporder is: $keeporder\"\n\n if test $keeporder -ne 0\n __${snakeCase(getAppBin(context))}_debug \"This does require order preservation\"\n return 0\n end\n\n __${snakeCase(getAppBin(context))}_debug \"This doesn't require order preservation\"\n return 1\nend\n\n# This function does two things:\n# - Obtain the completions and store them in the global __${snakeCase(getAppBin(context))}_comp_results\n# - Return false if file completion should be performed\nfunction __${snakeCase(getAppBin(context))}_prepare_completions\n __${snakeCase(getAppBin(context))}_debug \"\"\n __${snakeCase(getAppBin(context))}_debug \"========= starting completion logic ==========\"\n\n # Start fresh\n set --erase __${snakeCase(getAppBin(context))}_comp_results\n\n __${snakeCase(getAppBin(context))}_perform_completion_once\n __${snakeCase(getAppBin(context))}_debug \"Completion results: $__${snakeCase(getAppBin(context))}_perform_completion_once_result\"\n\n if test -z \"$__${snakeCase(getAppBin(context))}_perform_completion_once_result\"\n __${snakeCase(getAppBin(context))}_debug \"No completion, probably due to a failure\"\n # Might as well do file completion, in case it helps\n return 1\n end\n\n set -l directive (string sub --start 2 $__${snakeCase(getAppBin(context))}_perform_completion_once_result[-1])\n set --global __${snakeCase(getAppBin(context))}_comp_results $__${snakeCase(getAppBin(context))}_perform_completion_once_result[1..-2]\n\n __${snakeCase(getAppBin(context))}_debug \"Completions are: $__${snakeCase(getAppBin(context))}_comp_results\"\n __${snakeCase(getAppBin(context))}_debug \"Directive is: $directive\"\n\n set -l shellCompDirectiveError ${\n CompletionDirective.CompletionDirectiveError\n }\n set -l shellCompDirectiveNoSpace ${\n CompletionDirective.CompletionDirectiveNoSpace\n }\n set -l shellCompDirectiveNoFileComp ${\n CompletionDirective.CompletionDirectiveNoFileComp\n }\n set -l shellCompDirectiveFilterFileExt ${\n CompletionDirective.CompletionDirectiveFilterFileExt\n }\n set -l shellCompDirectiveFilterDirs ${\n CompletionDirective.CompletionDirectiveFilterDirs\n }\n if test -z \"$directive\"\n set directive 0\n end\n\n set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2)\n if test $compErr -eq 1\n __${snakeCase(getAppBin(context))}_debug \"Received error directive: aborting.\"\n # Might as well do file completion, in case it helps\n return 1\n end\n\n set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2)\n set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2)\n if test $filefilter -eq 1; or test $dirfilter -eq 1\n __${snakeCase(getAppBin(context))}_debug \"File extension filtering or directory filtering not supported\"\n # Do full file completion instead\n return 1\n end\n\n set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2)\n set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2)\n\n __${snakeCase(getAppBin(context))}_debug \"nospace: $nospace, nofiles: $nofiles\"\n\n # If we want to prevent a space, or if file completion is NOT disabled,\n # we need to count the number of valid completions.\n # To do so, we will filter on prefix as the completions we have received\n # may not already be filtered so as to allow fish to match on different\n # criteria than the prefix.\n if test $nospace -ne 0; or test $nofiles -eq 0\n set -l prefix (commandline -t | string escape --style=regex)\n __${snakeCase(getAppBin(context))}_debug \"prefix: $prefix\"\n\n set -l completions (string match -r -- \"^$prefix.*\" $__${snakeCase(getAppBin(context))}_comp_results)\n set --global __${snakeCase(getAppBin(context))}_comp_results $completions\n __${snakeCase(getAppBin(context))}_debug \"Filtered completions are: $__${snakeCase(getAppBin(context))}_comp_results\"\n\n # Important not to quote the variable for count to work\n set -l numComps (count $__${snakeCase(getAppBin(context))}_comp_results)\n __${snakeCase(getAppBin(context))}_debug \"numComps: $numComps\"\n\n if test $numComps -eq 1; and test $nospace -ne 0\n # We must first split on \\\\t to get rid of the descriptions to be\n # able to check what the actual completion will be.\n # We don't need descriptions anyway since there is only a single\n # real completion which the shell will expand immediately.\n set -l split (string split --max 1 \"\\\\t\" $__${snakeCase(getAppBin(context))}_comp_results[1])\n\n # Fish won't add a space if the completion ends with any\n # of the following characters: @=/:.,\n set -l lastChar (string sub -s -1 -- $split)\n if not string match -r -q \"[@=/:.,]\" -- \"$lastChar\"\n # In other cases, to support the \"nospace\" directive we trick the shell\n # by outputting an extra, longer completion.\n __${snakeCase(getAppBin(context))}_debug \"Adding second completion to perform nospace directive\"\n set --global __${snakeCase(getAppBin(context))}_comp_results $split[1] $split[1].\n __${snakeCase(getAppBin(context))}_debug \"Completions are now: $__${snakeCase(getAppBin(context))}_comp_results\"\n end\n end\n\n if test $numComps -eq 0; and test $nofiles -eq 0\n # To be consistent with bash and zsh, we only trigger file\n # completion when there are no other completions\n __${snakeCase(getAppBin(context))}_debug \"Requesting file completion\"\n return 1\n end\n end\n\n return 0\nend\n\n# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves\n# so we can properly delete any completions provided by another script.\n# Only do this if the program can be found, or else fish may print some errors; besides,\n# the existing completions will only be loaded if the program can be found.\nif type -q \"${getAppBin(context)}\"\n # The space after the program name is essential to trigger completion for the program\n # and not completion of the program name itself.\n # Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish.\n complete --do-complete \"${getAppBin(context)} \" > /dev/null 2>&1\nend\n\n# Remove any pre-existing completions for the program since we will be handling all of them.\ncomplete -c ${getAppBin(context)} -e\n# This will get called after the two calls below and clear the cached result\ncomplete -c ${getAppBin(context)} -n '__${snakeCase(getAppBin(context))}_clear_perform_completion_once_result'\n# The call to __${snakeCase(getAppBin(context))}_prepare_completions will setup __${snakeCase(getAppBin(context))}_comp_results\n# which provides the program's completion choices.\n# If this doesn't require order preservation, we don't use the -k flag\ncomplete -c ${getAppBin(\n context\n )} -n 'not __${snakeCase(getAppBin(context))}_requires_order_preservation && __${snakeCase(getAppBin(context))}_prepare_completions' -f -a '$__${snakeCase(getAppBin(context))}_comp_results'\n# Otherwise we use the -k flag\ncomplete -k -c ${getAppBin(context)} -n '__${snakeCase(\n getAppBin(context)\n )}_requires_order_preservation && __${snakeCase(\n getAppBin(context)\n )}_prepare_completions' -f -a '$__${snakeCase(\n getAppBin(context)\n )}_comp_results'\n\\`);`}\n />\n <Spacing />\n <IfStatement condition={code`options.config`}>\n <VarDeclaration\n let\n name=\"configFilePath\"\n type=\"string\"\n initializer={code`options.config === true ? \"~/.config/fish/config.fish\" : options.config`}\n />\n <Spacing />\n <IfStatement condition={code`configFilePath.startsWith(\"~\")`}>\n {code`configFilePath = join(os.homedir(), configFilePath.replace(\"~\", \"\")); `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"configFileContent\"\n type=\"string\"\n initializer={code`\"\";`}\n />\n <Spacing />\n {code`try {\n configFileContent = await readFile(configFilePath, \"utf8\");\n } catch (error) {\n if (error.code === \"ENOENT\") {\n // If the file doesn't exist, we can create it later when writing the completion script.\n warn(\\`Configuration file \\${colors.bold(configFilePath)} does not exist. It will be created when the completion script is written.\\`);\n } else {\n return { error };\n }\n }\n\n await writeFile(configFilePath, \\`\\${configFileContent}\\\\n\\\\n\\${stripAnsi(completions)}\\`);\n\n success(\\`${getAppTitle(context)} Fish completion script has been generated and appended to \\${colors.bold(configFilePath)}. Please restart your terminal or run \\`source \\${configFilePath}\\` to apply the changes.\\`); `}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`options.script`}>\n {code`const outputPath = options.script === true ? \"${getAppBin(context)}-completions.fish\" : options.script;\n await writeFile(outputPath, stripAnsi(completions));\n\n success(\\`${getAppTitle(context)} Fish completion script has been generated at \\${colors.bold(outputPath)}.\\`);`}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`!options.config && !options.script`}>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(completions);\n writeLine(\" ------------------------------------------------- \");`}\n </IfStatement>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA+CA,SAAgBmB,yBAAyB;CACvC,MAAMC,UAAUb,eAAyC;AAEzD,QAAAc,gBACGZ,gBAAc;EAAA,IACba,OAAI;AAAA,UAAEP,UAAUK,QAAQG,WAAW,eAAe,QAAQ,aAAa;;EACvEC,SAAS;GACP,WAAW,CAAC,KAAK;GACjB,oBAAoB,CAAC,YAAY,YAAW;GAC7C;EACDC,gBAAgB,EACd,uBAAuB;GACrB;GACA;GACA;GACA;GACA;GAAW,EAE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AAAC,gBAEjHf,SAAO,EAAA,CAAA;OAAAe,gBACPnB,aAAW;QAACwC,WAAW1C,IAAI;QAAoC0B,UAC7D1B,IAAI;;;QAE6D,CAAA;OAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA"}
@@ -1,5 +1,9 @@
1
1
  const require_components_bash_command = require('./bash-command.cjs');
2
+ const require_components_fish_command = require('./fish-command.cjs');
3
+ const require_components_powershell_command = require('./powershell-command.cjs');
2
4
  const require_components_zsh_command = require('./zsh-command.cjs');
3
5
 
4
6
  exports.BashCompletionsCommand = require_components_bash_command.BashCompletionsCommand;
7
+ exports.FishCompletionsCommand = require_components_fish_command.FishCompletionsCommand;
8
+ exports.PowerShellCompletionsCommand = require_components_powershell_command.PowerShellCompletionsCommand;
5
9
  exports.ZshCompletionsCommand = require_components_zsh_command.ZshCompletionsCommand;
@@ -1,3 +1,5 @@
1
1
  import { BashCompletionsCommand } from "./bash-command.cjs";
2
+ import { FishCompletionsCommand } from "./fish-command.cjs";
3
+ import { PowerShellCompletionsCommand } from "./powershell-command.cjs";
2
4
  import { ZshCompletionsCommand } from "./zsh-command.cjs";
3
- export { BashCompletionsCommand, ZshCompletionsCommand };
5
+ export { BashCompletionsCommand, FishCompletionsCommand, PowerShellCompletionsCommand, ZshCompletionsCommand };
@@ -1,3 +1,5 @@
1
1
  import { BashCompletionsCommand } from "./bash-command.mjs";
2
+ import { FishCompletionsCommand } from "./fish-command.mjs";
3
+ import { PowerShellCompletionsCommand } from "./powershell-command.mjs";
2
4
  import { ZshCompletionsCommand } from "./zsh-command.mjs";
3
- export { BashCompletionsCommand, ZshCompletionsCommand };
5
+ export { BashCompletionsCommand, FishCompletionsCommand, PowerShellCompletionsCommand, ZshCompletionsCommand };
@@ -1,4 +1,6 @@
1
1
  import { BashCompletionsCommand } from "./bash-command.mjs";
2
+ import { FishCompletionsCommand } from "./fish-command.mjs";
3
+ import { PowerShellCompletionsCommand } from "./powershell-command.mjs";
2
4
  import { ZshCompletionsCommand } from "./zsh-command.mjs";
3
5
 
4
- export { BashCompletionsCommand, ZshCompletionsCommand };
6
+ export { BashCompletionsCommand, FishCompletionsCommand, PowerShellCompletionsCommand, ZshCompletionsCommand };