@shell-shock/plugin-completions 0.2.23 → 0.3.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.
- package/README.md +1 -1
- package/dist/components/bash-config-command.cjs +132 -0
- package/dist/components/bash-config-command.d.cts +10 -0
- package/dist/components/bash-config-command.d.cts.map +1 -0
- package/dist/components/bash-config-command.d.mts +10 -0
- package/dist/components/bash-config-command.d.mts.map +1 -0
- package/dist/components/bash-config-command.mjs +132 -0
- package/dist/components/bash-config-command.mjs.map +1 -0
- package/dist/components/bash-script-command.cjs +106 -0
- package/dist/components/bash-script-command.d.cts +10 -0
- package/dist/components/bash-script-command.d.cts.map +1 -0
- package/dist/components/bash-script-command.d.mts +10 -0
- package/dist/components/bash-script-command.d.mts.map +1 -0
- package/dist/components/bash-script-command.mjs +106 -0
- package/dist/components/bash-script-command.mjs.map +1 -0
- package/dist/components/bash-shared.cjs +172 -0
- package/dist/components/bash-shared.d.cts +10 -0
- package/dist/components/bash-shared.d.cts.map +1 -0
- package/dist/components/bash-shared.d.mts +10 -0
- package/dist/components/bash-shared.d.mts.map +1 -0
- package/dist/components/bash-shared.mjs +172 -0
- package/dist/components/bash-shared.mjs.map +1 -0
- package/dist/components/fish-config-command.cjs +132 -0
- package/dist/components/fish-config-command.d.cts +10 -0
- package/dist/components/fish-config-command.d.cts.map +1 -0
- package/dist/components/fish-config-command.d.mts +10 -0
- package/dist/components/fish-config-command.d.mts.map +1 -0
- package/dist/components/fish-config-command.mjs +132 -0
- package/dist/components/fish-config-command.mjs.map +1 -0
- package/dist/components/fish-script-command.cjs +106 -0
- package/dist/components/fish-script-command.d.cts +10 -0
- package/dist/components/fish-script-command.d.cts.map +1 -0
- package/dist/components/fish-script-command.d.mts +10 -0
- package/dist/components/fish-script-command.d.mts.map +1 -0
- package/dist/components/fish-script-command.mjs +106 -0
- package/dist/components/fish-script-command.mjs.map +1 -0
- package/dist/components/fish-shared.cjs +303 -0
- package/dist/components/fish-shared.d.cts +10 -0
- package/dist/components/fish-shared.d.cts.map +1 -0
- package/dist/components/fish-shared.d.mts +10 -0
- package/dist/components/fish-shared.d.mts.map +1 -0
- package/dist/components/fish-shared.mjs +303 -0
- package/dist/components/fish-shared.mjs.map +1 -0
- package/dist/components/index.cjs +24 -8
- package/dist/components/index.d.cts +13 -5
- package/dist/components/index.d.mts +13 -5
- package/dist/components/index.mjs +13 -5
- package/dist/components/powershell-config-command.cjs +128 -0
- package/dist/components/powershell-config-command.d.cts +7 -0
- package/dist/components/powershell-config-command.d.cts.map +1 -0
- package/dist/components/powershell-config-command.d.mts +7 -0
- package/dist/components/powershell-config-command.d.mts.map +1 -0
- package/dist/components/powershell-config-command.mjs +128 -0
- package/dist/components/powershell-config-command.mjs.map +1 -0
- package/dist/components/powershell-script-command.cjs +106 -0
- package/dist/components/powershell-script-command.d.cts +10 -0
- package/dist/components/powershell-script-command.d.cts.map +1 -0
- package/dist/components/powershell-script-command.d.mts +10 -0
- package/dist/components/powershell-script-command.d.mts.map +1 -0
- package/dist/components/powershell-script-command.mjs +106 -0
- package/dist/components/powershell-script-command.mjs.map +1 -0
- package/dist/components/powershell-shared.cjs +319 -0
- package/dist/components/powershell-shared.d.cts +10 -0
- package/dist/components/powershell-shared.d.cts.map +1 -0
- package/dist/components/powershell-shared.d.mts +10 -0
- package/dist/components/powershell-shared.d.mts.map +1 -0
- package/dist/components/{powershell-command.mjs → powershell-shared.mjs} +81 -181
- package/dist/components/powershell-shared.mjs.map +1 -0
- package/dist/components/zsh-config-command.cjs +132 -0
- package/dist/components/zsh-config-command.d.cts +10 -0
- package/dist/components/zsh-config-command.d.cts.map +1 -0
- package/dist/components/zsh-config-command.d.mts +10 -0
- package/dist/components/zsh-config-command.d.mts.map +1 -0
- package/dist/components/zsh-config-command.mjs +132 -0
- package/dist/components/zsh-config-command.mjs.map +1 -0
- package/dist/components/zsh-script-command.cjs +111 -0
- package/dist/components/zsh-script-command.d.cts +10 -0
- package/dist/components/zsh-script-command.d.cts.map +1 -0
- package/dist/components/zsh-script-command.d.mts +10 -0
- package/dist/components/zsh-script-command.d.mts.map +1 -0
- package/dist/components/zsh-script-command.mjs +111 -0
- package/dist/components/zsh-script-command.mjs.map +1 -0
- package/dist/components/zsh-shared.cjs +281 -0
- package/dist/components/zsh-shared.d.cts +10 -0
- package/dist/components/zsh-shared.d.cts.map +1 -0
- package/dist/components/zsh-shared.d.mts +10 -0
- package/dist/components/zsh-shared.d.mts.map +1 -0
- package/dist/components/zsh-shared.mjs +281 -0
- package/dist/components/zsh-shared.mjs.map +1 -0
- package/dist/helpers/complete-command.cjs +2 -7
- package/dist/helpers/complete-command.d.cts +2 -2
- package/dist/helpers/complete-command.d.cts.map +1 -1
- package/dist/helpers/complete-command.d.mts +2 -2
- package/dist/helpers/complete-command.d.mts.map +1 -1
- package/dist/helpers/complete-command.mjs +2 -7
- package/dist/helpers/complete-command.mjs.map +1 -1
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.d.cts +2 -2
- package/dist/helpers/index.d.mts +2 -2
- package/dist/helpers/index.mjs +2 -2
- package/dist/index.cjs +245 -59
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +246 -60
- package/dist/index.mjs.map +1 -1
- package/package.json +148 -37
- package/dist/components/bash-command.cjs +0 -273
- package/dist/components/bash-command.d.cts +0 -10
- package/dist/components/bash-command.d.cts.map +0 -1
- package/dist/components/bash-command.d.mts +0 -10
- package/dist/components/bash-command.d.mts.map +0 -1
- package/dist/components/bash-command.mjs +0 -273
- package/dist/components/bash-command.mjs.map +0 -1
- package/dist/components/fish-command.cjs +0 -403
- package/dist/components/fish-command.d.cts +0 -10
- package/dist/components/fish-command.d.cts.map +0 -1
- package/dist/components/fish-command.d.mts +0 -10
- package/dist/components/fish-command.d.mts.map +0 -1
- package/dist/components/fish-command.mjs +0 -403
- package/dist/components/fish-command.mjs.map +0 -1
- package/dist/components/powershell-command.cjs +0 -419
- package/dist/components/powershell-command.d.cts +0 -10
- package/dist/components/powershell-command.d.cts.map +0 -1
- package/dist/components/powershell-command.d.mts +0 -10
- package/dist/components/powershell-command.d.mts.map +0 -1
- package/dist/components/powershell-command.mjs.map +0 -1
- package/dist/components/zsh-command.cjs +0 -384
- package/dist/components/zsh-command.d.cts +0 -10
- package/dist/components/zsh-command.d.cts.map +0 -1
- package/dist/components/zsh-command.d.mts +0 -10
- package/dist/components/zsh-command.d.mts.map +0 -1
- package/dist/components/zsh-command.mjs +0 -384
- package/dist/components/zsh-command.mjs.map +0 -1
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_helpers_complete_command = require('../helpers/complete-command.cjs');
|
|
3
|
+
const require_helpers_completion_directive_constants = require('../helpers/completion-directive-constants.cjs');
|
|
4
|
+
require('../helpers/index.cjs');
|
|
5
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
7
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
8
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
9
|
+
let _powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
|
|
10
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
11
|
+
let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
|
|
12
|
+
let _stryke_path = require("@stryke/path");
|
|
13
|
+
let _stryke_string_format_snake_case = require("@stryke/string-format/snake-case");
|
|
14
|
+
|
|
15
|
+
//#region src/components/fish-shared.tsx
|
|
16
|
+
/**
|
|
17
|
+
* The Fish Completions generation for the Shell Shock project.
|
|
18
|
+
*/
|
|
19
|
+
function FishCompletionsShared() {
|
|
20
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
21
|
+
const bin = (0, _alloy_js_core.computed)(() => (0, _shell_shock_core_plugin_utils.getAppBin)(context));
|
|
22
|
+
const name = (0, _alloy_js_core.computed)(() => (0, _stryke_string_format_snake_case.snakeCase)(bin.value));
|
|
23
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
|
|
24
|
+
get path() {
|
|
25
|
+
return (0, _stryke_path.joinPaths)(context.entryPath, "completions", "fish", "shared.ts");
|
|
26
|
+
},
|
|
27
|
+
builtinImports: { console: ["colors"] },
|
|
28
|
+
get children() {
|
|
29
|
+
return [
|
|
30
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
31
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
32
|
+
"const": true,
|
|
33
|
+
"export": true,
|
|
34
|
+
name: "SHELL_COMPLETIONS",
|
|
35
|
+
get initializer() {
|
|
36
|
+
return _alloy_js_core.code` \`function __${name.value}_debug
|
|
37
|
+
set -l file "$BASH_COMP_DEBUG_FILE"
|
|
38
|
+
if test -n "$file"
|
|
39
|
+
echo "$argv" >> $file
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
function __${name.value}_perform_completion
|
|
44
|
+
__${name.value}_debug "Starting __${name.value}_perform_completion"
|
|
45
|
+
|
|
46
|
+
# Extract all args except the last one
|
|
47
|
+
set -l args (commandline -opc)
|
|
48
|
+
# Extract the last arg and escape it in case it is a space or wildcard
|
|
49
|
+
set -l lastArg (string escape -- (commandline -ct))
|
|
50
|
+
|
|
51
|
+
__${name.value}_debug "args: $args"
|
|
52
|
+
__${name.value}_debug "last arg: $lastArg"
|
|
53
|
+
|
|
54
|
+
# Build the completion request command
|
|
55
|
+
set -l requestComp "${require_helpers_complete_command.EXEC_COMMAND} complete -- (string join ' ' -- (string escape -- $args[2..-1])) $lastArg"
|
|
56
|
+
|
|
57
|
+
__${name.value}_debug "Calling $requestComp"
|
|
58
|
+
set -l results (eval $requestComp 2> /dev/null)
|
|
59
|
+
|
|
60
|
+
# Some programs may output extra empty lines after the directive.
|
|
61
|
+
# Let's ignore them or else it will break completion.
|
|
62
|
+
# Ref: https://github.com/spf13/cobra/issues/1279
|
|
63
|
+
for line in $results[-1..1]
|
|
64
|
+
if test (string trim -- $line) = ""
|
|
65
|
+
# Found an empty line, remove it
|
|
66
|
+
set results $results[1..-2]
|
|
67
|
+
else
|
|
68
|
+
# Found non-empty line, we have our proper output
|
|
69
|
+
break
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
set -l comps $results[1..-2]
|
|
74
|
+
set -l directiveLine $results[-1]
|
|
75
|
+
|
|
76
|
+
# For Fish, when completing a flag with an = (e.g., <program> -n=<TAB>)
|
|
77
|
+
# completions must be prefixed with the flag
|
|
78
|
+
set -l flagPrefix (string match -r -- '-.*=' "$lastArg")
|
|
79
|
+
|
|
80
|
+
__${name.value}_debug "Comps: $comps"
|
|
81
|
+
__${name.value}_debug "DirectiveLine: $directiveLine"
|
|
82
|
+
__${name.value}_debug "flagPrefix: $flagPrefix"
|
|
83
|
+
|
|
84
|
+
for comp in $comps
|
|
85
|
+
printf "%s%s\\n" "$flagPrefix" "$comp"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
printf "%s\\n" "$directiveLine"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# This function limits calls to __${name.value}_perform_completion, by caching the result
|
|
92
|
+
function __${name.value}_perform_completion_once
|
|
93
|
+
__${name.value}_debug "Starting __${name.value}_perform_completion_once"
|
|
94
|
+
|
|
95
|
+
if test -n "$__${name.value}_perform_completion_once_result"
|
|
96
|
+
__${name.value}_debug "Seems like a valid result already exists, skipping __${name.value}_perform_completion"
|
|
97
|
+
return 0
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
set --global __${name.value}_perform_completion_once_result (__${name.value}_perform_completion)
|
|
101
|
+
if test -z "$__${name.value}_perform_completion_once_result"
|
|
102
|
+
__${name.value}_debug "No completions, probably due to a failure"
|
|
103
|
+
return 1
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
__${name.value}_debug "Performed completions and set __${name.value}_perform_completion_once_result"
|
|
107
|
+
return 0
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# This function is used to clear the cached result after completions are run
|
|
111
|
+
function __${name.value}_clear_perform_completion_once_result
|
|
112
|
+
__${name.value}_debug ""
|
|
113
|
+
__${name.value}_debug "========= clearing previously set __${name.value}_perform_completion_once_result variable =========="
|
|
114
|
+
set --erase __${name.value}_perform_completion_once_result
|
|
115
|
+
__${name.value}_debug "Successfully erased the variable __${name.value}_perform_completion_once_result"
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
function __${name.value}_requires_order_preservation
|
|
119
|
+
__${name.value}_debug ""
|
|
120
|
+
__${name.value}_debug "========= checking if order preservation is required =========="
|
|
121
|
+
|
|
122
|
+
__${name.value}_perform_completion_once
|
|
123
|
+
if test -z "$__${name.value}_perform_completion_once_result"
|
|
124
|
+
__${name.value}_debug "Error determining if order preservation is required"
|
|
125
|
+
return 1
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
set -l directive (string sub --start 2 $__${name.value}_perform_completion_once_result[-1])
|
|
129
|
+
__${name.value}_debug "Directive is: $directive"
|
|
130
|
+
|
|
131
|
+
set -l shellCompDirectiveKeepOrder ${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveKeepOrder}
|
|
132
|
+
set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) % 2)
|
|
133
|
+
__${name.value}_debug "Keeporder is: $keeporder"
|
|
134
|
+
|
|
135
|
+
if test $keeporder -ne 0
|
|
136
|
+
__${name.value}_debug "This does require order preservation"
|
|
137
|
+
return 0
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
__${name.value}_debug "This doesn't require order preservation"
|
|
141
|
+
return 1
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# This function does two things:
|
|
145
|
+
# - Obtain the completions and store them in the global __${name.value}_comp_results
|
|
146
|
+
# - Return false if file completion should be performed
|
|
147
|
+
function __${name.value}_prepare_completions
|
|
148
|
+
__${name.value}_debug ""
|
|
149
|
+
__${name.value}_debug "========= starting completion logic =========="
|
|
150
|
+
|
|
151
|
+
# Start fresh
|
|
152
|
+
set --erase __${name.value}_comp_results
|
|
153
|
+
|
|
154
|
+
__${name.value}_perform_completion_once
|
|
155
|
+
__${name.value}_debug "Completion results: $__${name.value}_perform_completion_once_result"
|
|
156
|
+
|
|
157
|
+
if test -z "$__${name.value}_perform_completion_once_result"
|
|
158
|
+
__${name.value}_debug "No completion, probably due to a failure"
|
|
159
|
+
# Might as well do file completion, in case it helps
|
|
160
|
+
return 1
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
set -l directive (string sub --start 2 $__${name.value}_perform_completion_once_result[-1])
|
|
164
|
+
set --global __${name.value}_comp_results $__${name.value}_perform_completion_once_result[1..-2]
|
|
165
|
+
|
|
166
|
+
__${name.value}_debug "Completions are: $__${name.value}_comp_results"
|
|
167
|
+
__${name.value}_debug "Directive is: $directive"
|
|
168
|
+
|
|
169
|
+
set -l shellCompDirectiveError ${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveError}
|
|
170
|
+
set -l shellCompDirectiveNoSpace ${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveNoSpace}
|
|
171
|
+
set -l shellCompDirectiveNoFileComp ${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveNoFileComp}
|
|
172
|
+
set -l shellCompDirectiveFilterFileExt ${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveFilterFileExt}
|
|
173
|
+
set -l shellCompDirectiveFilterDirs ${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveFilterDirs}
|
|
174
|
+
if test -z "$directive"
|
|
175
|
+
set directive 0
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2)
|
|
179
|
+
if test $compErr -eq 1
|
|
180
|
+
__${name.value}_debug "Received error directive: aborting."
|
|
181
|
+
# Might as well do file completion, in case it helps
|
|
182
|
+
return 1
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2)
|
|
186
|
+
set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2)
|
|
187
|
+
if test $filefilter -eq 1; or test $dirfilter -eq 1
|
|
188
|
+
__${name.value}_debug "File extension filtering or directory filtering not supported"
|
|
189
|
+
# Do full file completion instead
|
|
190
|
+
return 1
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2)
|
|
194
|
+
set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2)
|
|
195
|
+
|
|
196
|
+
__${name.value}_debug "nospace: $nospace, nofiles: $nofiles"
|
|
197
|
+
|
|
198
|
+
# If we want to prevent a space, or if file completion is NOT disabled,
|
|
199
|
+
# we need to count the number of valid completions.
|
|
200
|
+
# To do so, we will filter on prefix as the completions we have received
|
|
201
|
+
# may not already be filtered so as to allow fish to match on different
|
|
202
|
+
# criteria than the prefix.
|
|
203
|
+
if test $nospace -ne 0; or test $nofiles -eq 0
|
|
204
|
+
set -l prefix (commandline -t | string escape --style=regex)
|
|
205
|
+
__${name.value}_debug "prefix: $prefix"
|
|
206
|
+
|
|
207
|
+
set -l completions (string match -r -- "^$prefix.*" $__${name.value}_comp_results)
|
|
208
|
+
set --global __${name.value}_comp_results $completions
|
|
209
|
+
__${name.value}_debug "Filtered completions are: $__${name.value}_comp_results"
|
|
210
|
+
|
|
211
|
+
# Important not to quote the variable for count to work
|
|
212
|
+
set -l numComps (count $__${name.value}_comp_results)
|
|
213
|
+
__${name.value}_debug "numComps: $numComps"
|
|
214
|
+
|
|
215
|
+
if test $numComps -eq 1; and test $nospace -ne 0
|
|
216
|
+
# We must first split on \\t to get rid of the descriptions to be
|
|
217
|
+
# able to check what the actual completion will be.
|
|
218
|
+
# We don't need descriptions anyway since there is only a single
|
|
219
|
+
# real completion which the shell will expand immediately.
|
|
220
|
+
set -l split (string split --max 1 "\\t" $__${name.value}_comp_results[1])
|
|
221
|
+
|
|
222
|
+
# Fish won't add a space if the completion ends with any
|
|
223
|
+
# of the following characters: @=/:.,
|
|
224
|
+
set -l lastChar (string sub -s -1 -- $split)
|
|
225
|
+
if not string match -r -q "[@=/:.,]" -- "$lastChar"
|
|
226
|
+
# In other cases, to support the "nospace" directive we trick the shell
|
|
227
|
+
# by outputting an extra, longer completion.
|
|
228
|
+
__${name.value}_debug "Adding second completion to perform nospace directive"
|
|
229
|
+
set --global __${name.value}_comp_results $split[1] $split[1].
|
|
230
|
+
__${name.value}_debug "Completions are now: $__${name.value}_comp_results"
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
if test $numComps -eq 0; and test $nofiles -eq 0
|
|
235
|
+
# To be consistent with bash and zsh, we only trigger file
|
|
236
|
+
# completion when there are no other completions
|
|
237
|
+
__${name.value}_debug "Requesting file completion"
|
|
238
|
+
return 1
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
return 0
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves
|
|
246
|
+
# so we can properly delete any completions provided by another script.
|
|
247
|
+
# Only do this if the program can be found, or else fish may print some errors; besides,
|
|
248
|
+
# the existing completions will only be loaded if the program can be found.
|
|
249
|
+
if type -q "${bin.value}"
|
|
250
|
+
# The space after the program name is essential to trigger completion for the program
|
|
251
|
+
# and not completion of the program name itself.
|
|
252
|
+
# Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish.
|
|
253
|
+
complete --do-complete "${bin.value} " > /dev/null 2>&1
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Remove any pre-existing completions for the program since we will be handling all of them.
|
|
257
|
+
complete -c ${bin.value} -e
|
|
258
|
+
# This will get called after the two calls below and clear the cached result
|
|
259
|
+
complete -c ${bin.value} -n '__${name.value}_clear_perform_completion_once_result'
|
|
260
|
+
# The call to __${name.value}_prepare_completions will setup __${name.value}_comp_results
|
|
261
|
+
# which provides the program's completion choices.
|
|
262
|
+
# If this doesn't require order preservation, we don't use the -k flag
|
|
263
|
+
complete -c ${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} -n 'not __${name.value}_requires_order_preservation && __${name.value}_prepare_completions' -f -a '$__${name.value}_comp_results'
|
|
264
|
+
# Otherwise we use the -k flag
|
|
265
|
+
complete -k -c ${bin.value} -n '__${name.value}_requires_order_preservation && __${name.value}_prepare_completions' -f -a '$__${name.value}_comp_results'
|
|
266
|
+
\`; `;
|
|
267
|
+
}
|
|
268
|
+
}),
|
|
269
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
270
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
271
|
+
"export": true,
|
|
272
|
+
"const": true,
|
|
273
|
+
name: "SHELL_COMPLETIONS_DISPLAY",
|
|
274
|
+
initializer: _alloy_js_core.code` SHELL_COMPLETIONS.split("\\n").map(line => {
|
|
275
|
+
if (!line.trim()) {
|
|
276
|
+
return "";
|
|
277
|
+
}
|
|
278
|
+
if (line.trim().startsWith("#")) {
|
|
279
|
+
return \`\${colors.dim(line)}\`;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return colors.white(line).replaceAll(/(?<=\\\$(\\{|\\()).*(?=(\\}\\)))/g, colors.green("$&"))
|
|
283
|
+
.replaceAll(/(\\"|\\').*(\\"|\\')/g, colors.cyan("$&"))
|
|
284
|
+
.replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|:)/g, colors.bold(colors.gray("$&")))
|
|
285
|
+
.replaceAll(/(function|complete)\\s+/g, colors.green("$&"))
|
|
286
|
+
.replaceAll(/(?<=(function|complete)\\s+)\\w/g, colors.bold(colors.greenBright("$&")))
|
|
287
|
+
.replaceAll(/set\\s+/g, colors.red("$&"))
|
|
288
|
+
.replaceAll(/(?<=set\\s+)\\w/g, colors.bold(colors.redBright("$&")))
|
|
289
|
+
.replaceAll(/while\\s+/g, colors.cyan("$&"))
|
|
290
|
+
.replaceAll(/(?<=while\\s+)\\w/g, colors.bold(colors.cyanBright("$&")))
|
|
291
|
+
.replaceAll(/(if|fi|else|elif|then|done)\\s+/g, colors.green("$&"))
|
|
292
|
+
.replaceAll(/\\s__\\w/g, colors.bold(colors.magentaBright("$&")))
|
|
293
|
+
.replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, colors.bold(colors.magenta("$&")));
|
|
294
|
+
|
|
295
|
+
}).join("\\n"); `
|
|
296
|
+
})
|
|
297
|
+
];
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
//#endregion
|
|
303
|
+
exports.FishCompletionsShared = FishCompletionsShared;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
//#region src/components/fish-shared.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The Fish Completions generation for the Shell Shock project.
|
|
6
|
+
*/
|
|
7
|
+
declare function FishCompletionsShared(): _$_alloy_js_core0.Children;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { FishCompletionsShared };
|
|
10
|
+
//# sourceMappingURL=fish-shared.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fish-shared.d.cts","names":[],"sources":["../../src/components/fish-shared.tsx"],"mappings":";;;;;;iBAiCgB,qBAAA,CAAA,GAAqB,iBAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
//#region src/components/fish-shared.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The Fish Completions generation for the Shell Shock project.
|
|
6
|
+
*/
|
|
7
|
+
declare function FishCompletionsShared(): _$_alloy_js_core0.Children;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { FishCompletionsShared };
|
|
10
|
+
//# sourceMappingURL=fish-shared.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fish-shared.d.mts","names":[],"sources":["../../src/components/fish-shared.tsx"],"mappings":";;;;;;iBAiCgB,qBAAA,CAAA,GAAqB,iBAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { EXEC_COMMAND } from "../helpers/complete-command.mjs";
|
|
2
|
+
import { CompletionDirective } from "../helpers/completion-directive-constants.mjs";
|
|
3
|
+
import "../helpers/index.mjs";
|
|
4
|
+
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
5
|
+
import { getAppBin } from "@shell-shock/core/plugin-utils";
|
|
6
|
+
import { code, computed } from "@alloy-js/core";
|
|
7
|
+
import { VarDeclaration } from "@alloy-js/typescript";
|
|
8
|
+
import { Spacing } from "@powerlines/plugin-alloy/core";
|
|
9
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
10
|
+
import { TypescriptFile } from "@powerlines/plugin-alloy/typescript";
|
|
11
|
+
import { joinPaths } from "@stryke/path";
|
|
12
|
+
import { snakeCase } from "@stryke/string-format/snake-case";
|
|
13
|
+
|
|
14
|
+
//#region src/components/fish-shared.tsx
|
|
15
|
+
/**
|
|
16
|
+
* The Fish Completions generation for the Shell Shock project.
|
|
17
|
+
*/
|
|
18
|
+
function FishCompletionsShared() {
|
|
19
|
+
const context = usePowerlines();
|
|
20
|
+
const bin = computed(() => getAppBin(context));
|
|
21
|
+
const name = computed(() => snakeCase(bin.value));
|
|
22
|
+
return createComponent(TypescriptFile, {
|
|
23
|
+
get path() {
|
|
24
|
+
return joinPaths(context.entryPath, "completions", "fish", "shared.ts");
|
|
25
|
+
},
|
|
26
|
+
builtinImports: { console: ["colors"] },
|
|
27
|
+
get children() {
|
|
28
|
+
return [
|
|
29
|
+
createComponent(Spacing, {}),
|
|
30
|
+
createComponent(VarDeclaration, {
|
|
31
|
+
"const": true,
|
|
32
|
+
"export": true,
|
|
33
|
+
name: "SHELL_COMPLETIONS",
|
|
34
|
+
get initializer() {
|
|
35
|
+
return code` \`function __${name.value}_debug
|
|
36
|
+
set -l file "$BASH_COMP_DEBUG_FILE"
|
|
37
|
+
if test -n "$file"
|
|
38
|
+
echo "$argv" >> $file
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
function __${name.value}_perform_completion
|
|
43
|
+
__${name.value}_debug "Starting __${name.value}_perform_completion"
|
|
44
|
+
|
|
45
|
+
# Extract all args except the last one
|
|
46
|
+
set -l args (commandline -opc)
|
|
47
|
+
# Extract the last arg and escape it in case it is a space or wildcard
|
|
48
|
+
set -l lastArg (string escape -- (commandline -ct))
|
|
49
|
+
|
|
50
|
+
__${name.value}_debug "args: $args"
|
|
51
|
+
__${name.value}_debug "last arg: $lastArg"
|
|
52
|
+
|
|
53
|
+
# Build the completion request command
|
|
54
|
+
set -l requestComp "${EXEC_COMMAND} complete -- (string join ' ' -- (string escape -- $args[2..-1])) $lastArg"
|
|
55
|
+
|
|
56
|
+
__${name.value}_debug "Calling $requestComp"
|
|
57
|
+
set -l results (eval $requestComp 2> /dev/null)
|
|
58
|
+
|
|
59
|
+
# Some programs may output extra empty lines after the directive.
|
|
60
|
+
# Let's ignore them or else it will break completion.
|
|
61
|
+
# Ref: https://github.com/spf13/cobra/issues/1279
|
|
62
|
+
for line in $results[-1..1]
|
|
63
|
+
if test (string trim -- $line) = ""
|
|
64
|
+
# Found an empty line, remove it
|
|
65
|
+
set results $results[1..-2]
|
|
66
|
+
else
|
|
67
|
+
# Found non-empty line, we have our proper output
|
|
68
|
+
break
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
set -l comps $results[1..-2]
|
|
73
|
+
set -l directiveLine $results[-1]
|
|
74
|
+
|
|
75
|
+
# For Fish, when completing a flag with an = (e.g., <program> -n=<TAB>)
|
|
76
|
+
# completions must be prefixed with the flag
|
|
77
|
+
set -l flagPrefix (string match -r -- '-.*=' "$lastArg")
|
|
78
|
+
|
|
79
|
+
__${name.value}_debug "Comps: $comps"
|
|
80
|
+
__${name.value}_debug "DirectiveLine: $directiveLine"
|
|
81
|
+
__${name.value}_debug "flagPrefix: $flagPrefix"
|
|
82
|
+
|
|
83
|
+
for comp in $comps
|
|
84
|
+
printf "%s%s\\n" "$flagPrefix" "$comp"
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
printf "%s\\n" "$directiveLine"
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# This function limits calls to __${name.value}_perform_completion, by caching the result
|
|
91
|
+
function __${name.value}_perform_completion_once
|
|
92
|
+
__${name.value}_debug "Starting __${name.value}_perform_completion_once"
|
|
93
|
+
|
|
94
|
+
if test -n "$__${name.value}_perform_completion_once_result"
|
|
95
|
+
__${name.value}_debug "Seems like a valid result already exists, skipping __${name.value}_perform_completion"
|
|
96
|
+
return 0
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
set --global __${name.value}_perform_completion_once_result (__${name.value}_perform_completion)
|
|
100
|
+
if test -z "$__${name.value}_perform_completion_once_result"
|
|
101
|
+
__${name.value}_debug "No completions, probably due to a failure"
|
|
102
|
+
return 1
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
__${name.value}_debug "Performed completions and set __${name.value}_perform_completion_once_result"
|
|
106
|
+
return 0
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# This function is used to clear the cached result after completions are run
|
|
110
|
+
function __${name.value}_clear_perform_completion_once_result
|
|
111
|
+
__${name.value}_debug ""
|
|
112
|
+
__${name.value}_debug "========= clearing previously set __${name.value}_perform_completion_once_result variable =========="
|
|
113
|
+
set --erase __${name.value}_perform_completion_once_result
|
|
114
|
+
__${name.value}_debug "Successfully erased the variable __${name.value}_perform_completion_once_result"
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
function __${name.value}_requires_order_preservation
|
|
118
|
+
__${name.value}_debug ""
|
|
119
|
+
__${name.value}_debug "========= checking if order preservation is required =========="
|
|
120
|
+
|
|
121
|
+
__${name.value}_perform_completion_once
|
|
122
|
+
if test -z "$__${name.value}_perform_completion_once_result"
|
|
123
|
+
__${name.value}_debug "Error determining if order preservation is required"
|
|
124
|
+
return 1
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
set -l directive (string sub --start 2 $__${name.value}_perform_completion_once_result[-1])
|
|
128
|
+
__${name.value}_debug "Directive is: $directive"
|
|
129
|
+
|
|
130
|
+
set -l shellCompDirectiveKeepOrder ${CompletionDirective.CompletionDirectiveKeepOrder}
|
|
131
|
+
set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) % 2)
|
|
132
|
+
__${name.value}_debug "Keeporder is: $keeporder"
|
|
133
|
+
|
|
134
|
+
if test $keeporder -ne 0
|
|
135
|
+
__${name.value}_debug "This does require order preservation"
|
|
136
|
+
return 0
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
__${name.value}_debug "This doesn't require order preservation"
|
|
140
|
+
return 1
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# This function does two things:
|
|
144
|
+
# - Obtain the completions and store them in the global __${name.value}_comp_results
|
|
145
|
+
# - Return false if file completion should be performed
|
|
146
|
+
function __${name.value}_prepare_completions
|
|
147
|
+
__${name.value}_debug ""
|
|
148
|
+
__${name.value}_debug "========= starting completion logic =========="
|
|
149
|
+
|
|
150
|
+
# Start fresh
|
|
151
|
+
set --erase __${name.value}_comp_results
|
|
152
|
+
|
|
153
|
+
__${name.value}_perform_completion_once
|
|
154
|
+
__${name.value}_debug "Completion results: $__${name.value}_perform_completion_once_result"
|
|
155
|
+
|
|
156
|
+
if test -z "$__${name.value}_perform_completion_once_result"
|
|
157
|
+
__${name.value}_debug "No completion, probably due to a failure"
|
|
158
|
+
# Might as well do file completion, in case it helps
|
|
159
|
+
return 1
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
set -l directive (string sub --start 2 $__${name.value}_perform_completion_once_result[-1])
|
|
163
|
+
set --global __${name.value}_comp_results $__${name.value}_perform_completion_once_result[1..-2]
|
|
164
|
+
|
|
165
|
+
__${name.value}_debug "Completions are: $__${name.value}_comp_results"
|
|
166
|
+
__${name.value}_debug "Directive is: $directive"
|
|
167
|
+
|
|
168
|
+
set -l shellCompDirectiveError ${CompletionDirective.CompletionDirectiveError}
|
|
169
|
+
set -l shellCompDirectiveNoSpace ${CompletionDirective.CompletionDirectiveNoSpace}
|
|
170
|
+
set -l shellCompDirectiveNoFileComp ${CompletionDirective.CompletionDirectiveNoFileComp}
|
|
171
|
+
set -l shellCompDirectiveFilterFileExt ${CompletionDirective.CompletionDirectiveFilterFileExt}
|
|
172
|
+
set -l shellCompDirectiveFilterDirs ${CompletionDirective.CompletionDirectiveFilterDirs}
|
|
173
|
+
if test -z "$directive"
|
|
174
|
+
set directive 0
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2)
|
|
178
|
+
if test $compErr -eq 1
|
|
179
|
+
__${name.value}_debug "Received error directive: aborting."
|
|
180
|
+
# Might as well do file completion, in case it helps
|
|
181
|
+
return 1
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2)
|
|
185
|
+
set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2)
|
|
186
|
+
if test $filefilter -eq 1; or test $dirfilter -eq 1
|
|
187
|
+
__${name.value}_debug "File extension filtering or directory filtering not supported"
|
|
188
|
+
# Do full file completion instead
|
|
189
|
+
return 1
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2)
|
|
193
|
+
set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2)
|
|
194
|
+
|
|
195
|
+
__${name.value}_debug "nospace: $nospace, nofiles: $nofiles"
|
|
196
|
+
|
|
197
|
+
# If we want to prevent a space, or if file completion is NOT disabled,
|
|
198
|
+
# we need to count the number of valid completions.
|
|
199
|
+
# To do so, we will filter on prefix as the completions we have received
|
|
200
|
+
# may not already be filtered so as to allow fish to match on different
|
|
201
|
+
# criteria than the prefix.
|
|
202
|
+
if test $nospace -ne 0; or test $nofiles -eq 0
|
|
203
|
+
set -l prefix (commandline -t | string escape --style=regex)
|
|
204
|
+
__${name.value}_debug "prefix: $prefix"
|
|
205
|
+
|
|
206
|
+
set -l completions (string match -r -- "^$prefix.*" $__${name.value}_comp_results)
|
|
207
|
+
set --global __${name.value}_comp_results $completions
|
|
208
|
+
__${name.value}_debug "Filtered completions are: $__${name.value}_comp_results"
|
|
209
|
+
|
|
210
|
+
# Important not to quote the variable for count to work
|
|
211
|
+
set -l numComps (count $__${name.value}_comp_results)
|
|
212
|
+
__${name.value}_debug "numComps: $numComps"
|
|
213
|
+
|
|
214
|
+
if test $numComps -eq 1; and test $nospace -ne 0
|
|
215
|
+
# We must first split on \\t to get rid of the descriptions to be
|
|
216
|
+
# able to check what the actual completion will be.
|
|
217
|
+
# We don't need descriptions anyway since there is only a single
|
|
218
|
+
# real completion which the shell will expand immediately.
|
|
219
|
+
set -l split (string split --max 1 "\\t" $__${name.value}_comp_results[1])
|
|
220
|
+
|
|
221
|
+
# Fish won't add a space if the completion ends with any
|
|
222
|
+
# of the following characters: @=/:.,
|
|
223
|
+
set -l lastChar (string sub -s -1 -- $split)
|
|
224
|
+
if not string match -r -q "[@=/:.,]" -- "$lastChar"
|
|
225
|
+
# In other cases, to support the "nospace" directive we trick the shell
|
|
226
|
+
# by outputting an extra, longer completion.
|
|
227
|
+
__${name.value}_debug "Adding second completion to perform nospace directive"
|
|
228
|
+
set --global __${name.value}_comp_results $split[1] $split[1].
|
|
229
|
+
__${name.value}_debug "Completions are now: $__${name.value}_comp_results"
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
if test $numComps -eq 0; and test $nofiles -eq 0
|
|
234
|
+
# To be consistent with bash and zsh, we only trigger file
|
|
235
|
+
# completion when there are no other completions
|
|
236
|
+
__${name.value}_debug "Requesting file completion"
|
|
237
|
+
return 1
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
return 0
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves
|
|
245
|
+
# so we can properly delete any completions provided by another script.
|
|
246
|
+
# Only do this if the program can be found, or else fish may print some errors; besides,
|
|
247
|
+
# the existing completions will only be loaded if the program can be found.
|
|
248
|
+
if type -q "${bin.value}"
|
|
249
|
+
# The space after the program name is essential to trigger completion for the program
|
|
250
|
+
# and not completion of the program name itself.
|
|
251
|
+
# Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish.
|
|
252
|
+
complete --do-complete "${bin.value} " > /dev/null 2>&1
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Remove any pre-existing completions for the program since we will be handling all of them.
|
|
256
|
+
complete -c ${bin.value} -e
|
|
257
|
+
# This will get called after the two calls below and clear the cached result
|
|
258
|
+
complete -c ${bin.value} -n '__${name.value}_clear_perform_completion_once_result'
|
|
259
|
+
# The call to __${name.value}_prepare_completions will setup __${name.value}_comp_results
|
|
260
|
+
# which provides the program's completion choices.
|
|
261
|
+
# If this doesn't require order preservation, we don't use the -k flag
|
|
262
|
+
complete -c ${getAppBin(context)} -n 'not __${name.value}_requires_order_preservation && __${name.value}_prepare_completions' -f -a '$__${name.value}_comp_results'
|
|
263
|
+
# Otherwise we use the -k flag
|
|
264
|
+
complete -k -c ${bin.value} -n '__${name.value}_requires_order_preservation && __${name.value}_prepare_completions' -f -a '$__${name.value}_comp_results'
|
|
265
|
+
\`; `;
|
|
266
|
+
}
|
|
267
|
+
}),
|
|
268
|
+
createComponent(Spacing, {}),
|
|
269
|
+
createComponent(VarDeclaration, {
|
|
270
|
+
"export": true,
|
|
271
|
+
"const": true,
|
|
272
|
+
name: "SHELL_COMPLETIONS_DISPLAY",
|
|
273
|
+
initializer: code` SHELL_COMPLETIONS.split("\\n").map(line => {
|
|
274
|
+
if (!line.trim()) {
|
|
275
|
+
return "";
|
|
276
|
+
}
|
|
277
|
+
if (line.trim().startsWith("#")) {
|
|
278
|
+
return \`\${colors.dim(line)}\`;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return colors.white(line).replaceAll(/(?<=\\\$(\\{|\\()).*(?=(\\}\\)))/g, colors.green("$&"))
|
|
282
|
+
.replaceAll(/(\\"|\\').*(\\"|\\')/g, colors.cyan("$&"))
|
|
283
|
+
.replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|:)/g, colors.bold(colors.gray("$&")))
|
|
284
|
+
.replaceAll(/(function|complete)\\s+/g, colors.green("$&"))
|
|
285
|
+
.replaceAll(/(?<=(function|complete)\\s+)\\w/g, colors.bold(colors.greenBright("$&")))
|
|
286
|
+
.replaceAll(/set\\s+/g, colors.red("$&"))
|
|
287
|
+
.replaceAll(/(?<=set\\s+)\\w/g, colors.bold(colors.redBright("$&")))
|
|
288
|
+
.replaceAll(/while\\s+/g, colors.cyan("$&"))
|
|
289
|
+
.replaceAll(/(?<=while\\s+)\\w/g, colors.bold(colors.cyanBright("$&")))
|
|
290
|
+
.replaceAll(/(if|fi|else|elif|then|done)\\s+/g, colors.green("$&"))
|
|
291
|
+
.replaceAll(/\\s__\\w/g, colors.bold(colors.magentaBright("$&")))
|
|
292
|
+
.replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, colors.bold(colors.magenta("$&")));
|
|
293
|
+
|
|
294
|
+
}).join("\\n"); `
|
|
295
|
+
})
|
|
296
|
+
];
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
//#endregion
|
|
302
|
+
export { FishCompletionsShared };
|
|
303
|
+
//# sourceMappingURL=fish-shared.mjs.map
|