@shell-shock/plugin-completions 0.4.16 → 0.4.18
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/dist/components/bash-config-command.cjs +120 -6
- package/dist/components/bash-config-command.mjs +119 -6
- package/dist/components/bash-config-command.mjs.map +1 -1
- package/dist/components/bash-script-command.cjs +105 -5
- package/dist/components/bash-script-command.mjs +104 -5
- package/dist/components/bash-script-command.mjs.map +1 -1
- package/dist/components/bash-shared.cjs +77 -13
- package/dist/components/bash-shared.mjs +76 -13
- package/dist/components/bash-shared.mjs.map +1 -1
- package/dist/components/fish-config-command.cjs +120 -6
- package/dist/components/fish-config-command.mjs +119 -6
- package/dist/components/fish-config-command.mjs.map +1 -1
- package/dist/components/fish-script-command.cjs +104 -4
- package/dist/components/fish-script-command.mjs +103 -4
- package/dist/components/fish-script-command.mjs.map +1 -1
- package/dist/components/fish-shared.cjs +141 -77
- package/dist/components/fish-shared.mjs +140 -77
- package/dist/components/fish-shared.mjs.map +1 -1
- package/dist/components/index.cjs +26 -1
- package/dist/components/index.mjs +14 -1
- package/dist/components/powershell-config-command.cjs +116 -6
- package/dist/components/powershell-config-command.mjs +115 -6
- package/dist/components/powershell-config-command.mjs.map +1 -1
- package/dist/components/powershell-script-command.cjs +104 -4
- package/dist/components/powershell-script-command.mjs +103 -4
- package/dist/components/powershell-script-command.mjs.map +1 -1
- package/dist/components/powershell-shared.cjs +101 -37
- package/dist/components/powershell-shared.mjs +100 -37
- package/dist/components/powershell-shared.mjs.map +1 -1
- package/dist/components/zsh-config-command.cjs +120 -6
- package/dist/components/zsh-config-command.mjs +119 -6
- package/dist/components/zsh-config-command.mjs.map +1 -1
- package/dist/components/zsh-script-command.cjs +108 -6
- package/dist/components/zsh-script-command.mjs +107 -6
- package/dist/components/zsh-script-command.mjs.map +1 -1
- package/dist/components/zsh-shared.cjs +106 -42
- package/dist/components/zsh-shared.mjs +105 -42
- package/dist/components/zsh-shared.mjs.map +1 -1
- package/dist/helpers/complete-command.cjs +10 -1
- package/dist/helpers/complete-command.mjs +8 -1
- package/dist/helpers/complete-command.mjs.map +1 -1
- package/dist/helpers/completion-directive-constants.cjs +16 -1
- package/dist/helpers/completion-directive-constants.mjs +14 -1
- package/dist/helpers/completion-directive-constants.mjs.map +1 -1
- package/dist/helpers/index.cjs +6 -1
- package/dist/helpers/index.mjs +4 -1
- package/dist/index.cjs +303 -1
- package/dist/index.mjs +301 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.cjs +4 -1
- package/dist/types/index.mjs +3 -1
- package/dist/types/plugin.mjs +1 -1
- package/dist/types/shell-type.cjs +12 -1
- package/dist/types/shell-type.mjs +10 -1
- package/dist/types/shell-type.mjs.map +1 -1
- package/package.json +10 -10
|
@@ -1,35 +1,82 @@
|
|
|
1
|
-
import{EXEC_COMMAND
|
|
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/zsh-shared.tsx
|
|
15
|
+
/**
|
|
16
|
+
* The Zsh Completions generation for the Shell Shock project.
|
|
17
|
+
*/
|
|
18
|
+
function ZshCompletionsShared() {
|
|
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", "zsh", "shared.ts");
|
|
25
|
+
},
|
|
26
|
+
builtinImports: { console: [
|
|
27
|
+
"white",
|
|
28
|
+
"green",
|
|
29
|
+
"red",
|
|
30
|
+
"bold",
|
|
31
|
+
"cyan",
|
|
32
|
+
"gray",
|
|
33
|
+
"magenta",
|
|
34
|
+
"magentaBright",
|
|
35
|
+
"greenBright",
|
|
36
|
+
"redBright",
|
|
37
|
+
"cyanBright",
|
|
38
|
+
"dim"
|
|
39
|
+
] },
|
|
40
|
+
get children() {
|
|
41
|
+
return [
|
|
42
|
+
createComponent(Spacing, {}),
|
|
43
|
+
createComponent(VarDeclaration, {
|
|
44
|
+
"const": true,
|
|
45
|
+
"export": true,
|
|
46
|
+
name: "SHELL_COMPLETIONS",
|
|
47
|
+
get initializer() {
|
|
48
|
+
return code` \`__${name.value}_debug() {
|
|
2
49
|
local file="$BASH_COMP_DEBUG_FILE"
|
|
3
50
|
if [[ -n \\\${file} ]]; then
|
|
4
51
|
echo "$*" >> "\\\${file}"
|
|
5
52
|
fi
|
|
6
53
|
}
|
|
7
54
|
|
|
8
|
-
_${
|
|
9
|
-
local shellCompDirectiveError=${
|
|
10
|
-
local shellCompDirectiveNoSpace=${
|
|
11
|
-
local shellCompDirectiveNoFileComp=${
|
|
12
|
-
local shellCompDirectiveFilterFileExt=${
|
|
13
|
-
local shellCompDirectiveFilterDirs=${
|
|
14
|
-
local shellCompDirectiveKeepOrder=${
|
|
55
|
+
_${name.value}() {
|
|
56
|
+
local shellCompDirectiveError=${CompletionDirective.CompletionDirectiveError}
|
|
57
|
+
local shellCompDirectiveNoSpace=${CompletionDirective.CompletionDirectiveNoSpace}
|
|
58
|
+
local shellCompDirectiveNoFileComp=${CompletionDirective.CompletionDirectiveNoFileComp}
|
|
59
|
+
local shellCompDirectiveFilterFileExt=${CompletionDirective.CompletionDirectiveFilterFileExt}
|
|
60
|
+
local shellCompDirectiveFilterDirs=${CompletionDirective.CompletionDirectiveFilterDirs}
|
|
61
|
+
local shellCompDirectiveKeepOrder=${CompletionDirective.CompletionDirectiveKeepOrder}
|
|
15
62
|
|
|
16
63
|
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
|
|
17
64
|
local -a completions
|
|
18
65
|
|
|
19
|
-
__${
|
|
20
|
-
__${
|
|
66
|
+
__${name.value}_debug "\\n========= starting completion logic =========="
|
|
67
|
+
__${name.value}_debug "CURRENT: \\\${CURRENT}, words[*]: \\\${words[*]}"
|
|
21
68
|
|
|
22
69
|
# The user could have moved the cursor backwards on the command-line.
|
|
23
70
|
# We need to trigger completion from the $CURRENT location, so we need
|
|
24
71
|
# to truncate the command-line ($words) up to the $CURRENT location.
|
|
25
72
|
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
|
26
73
|
words=( "\\\${=words[1,CURRENT]}" )
|
|
27
|
-
__${
|
|
74
|
+
__${name.value}_debug "Truncated words[*]: \\\${words[*]},"
|
|
28
75
|
|
|
29
76
|
lastParam=\\\${words[-1]}
|
|
30
77
|
lastChar=\\\${lastParam[-1]}
|
|
31
|
-
__${
|
|
32
|
-
# For zsh, when completing a flag with an = (e.g., ${
|
|
78
|
+
__${name.value}_debug "lastParam: \\\${lastParam}, lastChar: \\\${lastChar}"
|
|
79
|
+
# For zsh, when completing a flag with an = (e.g., ${bin.value} -n=<TAB>)
|
|
33
80
|
# completions must be prefixed with the flag
|
|
34
81
|
setopt local_options BASH_REMATCH
|
|
35
82
|
if [[ "\\\${lastParam}" =~ '-.*=' ]]; then
|
|
@@ -42,7 +89,7 @@ _${m.value}() {
|
|
|
42
89
|
if [ "\\\${lastChar}" = "" ]; then
|
|
43
90
|
# If the last parameter is complete (there is a space following it)
|
|
44
91
|
# We add an extra empty parameter so we can indicate this to the go completion code.
|
|
45
|
-
__${
|
|
92
|
+
__${name.value}_debug "Adding extra empty parameter"
|
|
46
93
|
args_to_quote+=("")
|
|
47
94
|
fi
|
|
48
95
|
|
|
@@ -50,20 +97,20 @@ _${m.value}() {
|
|
|
50
97
|
local quoted_args=("\\\${(@q)args_to_quote}")
|
|
51
98
|
|
|
52
99
|
# Join the main command and the quoted arguments into a single string for eval
|
|
53
|
-
requestComp="${
|
|
100
|
+
requestComp="${EXEC_COMMAND} complete -- \\\${quoted_args[*]}"
|
|
54
101
|
|
|
55
|
-
__${
|
|
102
|
+
__${name.value}_debug "About to call: eval \\\${requestComp}"
|
|
56
103
|
|
|
57
104
|
# Use eval to handle any environment variables and such
|
|
58
105
|
out=$(eval \\\${requestComp} 2>/dev/null)
|
|
59
|
-
__${
|
|
106
|
+
__${name.value}_debug "completion output: \\\${out}"
|
|
60
107
|
|
|
61
108
|
# Extract the directive integer following a : from the last line
|
|
62
109
|
local lastLine
|
|
63
110
|
while IFS='\n' read -r line; do
|
|
64
111
|
lastLine=\\\${line}
|
|
65
112
|
done < <(printf "%s\n" "\\\${out[@]}")
|
|
66
|
-
__${
|
|
113
|
+
__${name.value}_debug "last line: \\\${lastLine}"
|
|
67
114
|
|
|
68
115
|
if [ "\\\${lastLine[1]}" = : ]; then
|
|
69
116
|
directive=\\\${lastLine[2,-1]}
|
|
@@ -73,16 +120,16 @@ _${m.value}() {
|
|
|
73
120
|
out=\\\${out[1,-$suffix]}
|
|
74
121
|
else
|
|
75
122
|
# There is no directive specified. Leave $out as is.
|
|
76
|
-
__${
|
|
123
|
+
__${name.value}_debug "No directive found. Setting to default"
|
|
77
124
|
directive=0
|
|
78
125
|
fi
|
|
79
126
|
|
|
80
|
-
__${
|
|
81
|
-
__${
|
|
82
|
-
__${
|
|
127
|
+
__${name.value}_debug "directive: \\\${directive}"
|
|
128
|
+
__${name.value}_debug "completions: \\\${out}"
|
|
129
|
+
__${name.value}_debug "flagPrefix: \\\${flagPrefix}"
|
|
83
130
|
|
|
84
131
|
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
|
85
|
-
__${
|
|
132
|
+
__${name.value}_debug "Completion received error. Ignoring completions."
|
|
86
133
|
return
|
|
87
134
|
fi
|
|
88
135
|
|
|
@@ -93,11 +140,11 @@ _${m.value}() {
|
|
|
93
140
|
while IFS='\n' read -r comp; do
|
|
94
141
|
# Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
|
|
95
142
|
if [ "\\\${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
|
|
96
|
-
__${
|
|
143
|
+
__${name.value}_debug "ActiveHelp found: $comp"
|
|
97
144
|
comp="\\\${comp[$startIndex,-1]}"
|
|
98
145
|
if [ -n "$comp" ]; then
|
|
99
146
|
compadd -x "\\\${comp}"
|
|
100
|
-
__${
|
|
147
|
+
__${name.value}_debug "ActiveHelp will need delimiter"
|
|
101
148
|
hasActiveHelp=1
|
|
102
149
|
fi
|
|
103
150
|
continue
|
|
@@ -113,7 +160,7 @@ _${m.value}() {
|
|
|
113
160
|
local tab="$(printf '\\t')"
|
|
114
161
|
comp=\\\${comp//$tab/:}
|
|
115
162
|
|
|
116
|
-
__${
|
|
163
|
+
__${name.value}_debug "Adding completion: \\\${comp}"
|
|
117
164
|
completions+=\\\${comp}
|
|
118
165
|
lastComp=$comp
|
|
119
166
|
fi
|
|
@@ -124,19 +171,19 @@ _${m.value}() {
|
|
|
124
171
|
# - file completion will be performed (so there will be choices after the activeHelp)
|
|
125
172
|
if [ $hasActiveHelp -eq 1 ]; then
|
|
126
173
|
if [ \\\${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
|
|
127
|
-
__${
|
|
174
|
+
__${name.value}_debug "Adding activeHelp delimiter"
|
|
128
175
|
compadd -x "--"
|
|
129
176
|
hasActiveHelp=0
|
|
130
177
|
fi
|
|
131
178
|
fi
|
|
132
179
|
|
|
133
180
|
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
|
134
|
-
__${
|
|
181
|
+
__${name.value}_debug "Activating nospace."
|
|
135
182
|
noSpace="-S ''"
|
|
136
183
|
fi
|
|
137
184
|
|
|
138
185
|
if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
|
|
139
|
-
__${
|
|
186
|
+
__${name.value}_debug "Activating keep order."
|
|
140
187
|
keepOrder="-V"
|
|
141
188
|
fi
|
|
142
189
|
|
|
@@ -153,17 +200,17 @@ _${m.value}() {
|
|
|
153
200
|
done
|
|
154
201
|
filteringCmd+=" \\\${flagPrefix}"
|
|
155
202
|
|
|
156
|
-
__${
|
|
203
|
+
__${name.value}_debug "File filtering command: $filteringCmd"
|
|
157
204
|
_arguments '*:filename:'"$filteringCmd"
|
|
158
205
|
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
|
159
206
|
# File completion for directories only
|
|
160
207
|
local subdir
|
|
161
208
|
subdir="\\\${completions[1]}"
|
|
162
209
|
if [ -n "$subdir" ]; then
|
|
163
|
-
__${
|
|
210
|
+
__${name.value}_debug "Listing directories in $subdir"
|
|
164
211
|
pushd "\\\${subdir}" >/dev/null 2>&1
|
|
165
212
|
else
|
|
166
|
-
__${
|
|
213
|
+
__${name.value}_debug "Listing directories in ."
|
|
167
214
|
fi
|
|
168
215
|
|
|
169
216
|
local result
|
|
@@ -174,17 +221,17 @@ _${m.value}() {
|
|
|
174
221
|
fi
|
|
175
222
|
return $result
|
|
176
223
|
else
|
|
177
|
-
__${
|
|
224
|
+
__${name.value}_debug "Calling _describe"
|
|
178
225
|
if eval _describe $keepOrder "completions" completions -Q \\\${flagPrefix} \\\${noSpace}; then
|
|
179
|
-
__${
|
|
226
|
+
__${name.value}_debug "_describe found some completions"
|
|
180
227
|
|
|
181
228
|
# Return the success of having called _describe
|
|
182
229
|
return 0
|
|
183
230
|
else
|
|
184
|
-
__${
|
|
185
|
-
__${
|
|
231
|
+
__${name.value}_debug "_describe did not find completions."
|
|
232
|
+
__${name.value}_debug "Checking if we should do file completion."
|
|
186
233
|
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
|
187
|
-
__${
|
|
234
|
+
__${name.value}_debug "deactivating file completion"
|
|
188
235
|
|
|
189
236
|
# Return 0 to indicate completion is finished and prevent zsh from
|
|
190
237
|
# trying other completion algorithms (which could cause hanging).
|
|
@@ -192,7 +239,7 @@ _${m.value}() {
|
|
|
192
239
|
return 0
|
|
193
240
|
else
|
|
194
241
|
# Perform file completion
|
|
195
|
-
__${
|
|
242
|
+
__${name.value}_debug "Activating file completion"
|
|
196
243
|
|
|
197
244
|
# We must return the result of this command, so it must be the
|
|
198
245
|
# last command, or else we must store its result to return it.
|
|
@@ -203,10 +250,18 @@ _${m.value}() {
|
|
|
203
250
|
}
|
|
204
251
|
|
|
205
252
|
# don't run the completion function when being sourced or eval-ed
|
|
206
|
-
if [ "\\\${funcstack[1]}" = "_${
|
|
207
|
-
_${
|
|
253
|
+
if [ "\\\${funcstack[1]}" = "_${name.value}" ]; then
|
|
254
|
+
_${name.value}
|
|
208
255
|
fi
|
|
209
|
-
\`;
|
|
256
|
+
\`; `;
|
|
257
|
+
}
|
|
258
|
+
}),
|
|
259
|
+
createComponent(Spacing, {}),
|
|
260
|
+
createComponent(VarDeclaration, {
|
|
261
|
+
"export": true,
|
|
262
|
+
"const": true,
|
|
263
|
+
name: "SHELL_COMPLETIONS_DISPLAY",
|
|
264
|
+
initializer: code` SHELL_COMPLETIONS.split("\\n").map(line => {
|
|
210
265
|
if (!line.trim()) {
|
|
211
266
|
return "";
|
|
212
267
|
}
|
|
@@ -227,5 +282,13 @@ fi
|
|
|
227
282
|
.replaceAll(/__\\w/g, bold(magentaBright("$&")))
|
|
228
283
|
.replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, bold(magenta("$&")));
|
|
229
284
|
|
|
230
|
-
}).join("\\n"); `
|
|
285
|
+
}).join("\\n"); `
|
|
286
|
+
})
|
|
287
|
+
];
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
//#endregion
|
|
293
|
+
export { ZshCompletionsShared };
|
|
231
294
|
//# sourceMappingURL=zsh-shared.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zsh-shared.mjs","names":[],"sources":["../../src/components/zsh-shared.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, computed } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript\";\nimport { getAppBin } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { CompletionDirective } from \"../helpers\";\nimport { EXEC_COMMAND } from \"../helpers/complete-command\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Zsh Completions generation for the Shell Shock project.\n */\nexport function ZshCompletionsShared() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n const name = computed(() => snakeCase(bin.value));\n\n return (\n <TypescriptFile\n path={joinPaths(context.entryPath, \"completions\", \"zsh\", \"shared.ts\")}\n builtinImports={{\n console: [\n \"white\",\n \"green\",\n \"red\",\n \"bold\",\n \"cyan\",\n \"gray\",\n \"magenta\",\n \"magentaBright\",\n \"greenBright\",\n \"redBright\",\n \"cyanBright\",\n \"dim\"\n ]\n }}>\n <Spacing />\n <VarDeclaration\n const\n export\n name=\"SHELL_COMPLETIONS\"\n initializer={code` \\`__${name.value}_debug() {\n local file=\"$BASH_COMP_DEBUG_FILE\"\n if [[ -n \\\\\\${file} ]]; then\n echo \"$*\" >> \"\\\\\\${file}\"\n fi\n}\n\n_${name.value}() {\n local shellCompDirectiveError=${\n CompletionDirective.CompletionDirectiveError\n }\n local shellCompDirectiveNoSpace=${\n CompletionDirective.CompletionDirectiveNoSpace\n }\n local shellCompDirectiveNoFileComp=${\n CompletionDirective.CompletionDirectiveNoFileComp\n }\n local shellCompDirectiveFilterFileExt=${\n CompletionDirective.CompletionDirectiveFilterFileExt\n }\n local shellCompDirectiveFilterDirs=${\n CompletionDirective.CompletionDirectiveFilterDirs\n }\n local shellCompDirectiveKeepOrder=${\n CompletionDirective.CompletionDirectiveKeepOrder\n }\n\n local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder\n local -a completions\n\n __${name.value}_debug \"\\\\n========= starting completion logic ==========\"\n __${name.value}_debug \"CURRENT: \\\\\\${CURRENT}, words[*]: \\\\\\${words[*]}\"\n\n # The user could have moved the cursor backwards on the command-line.\n # We need to trigger completion from the $CURRENT location, so we need\n # to truncate the command-line ($words) up to the $CURRENT location.\n # (We cannot use $CURSOR as its value does not work when a command is an alias.)\n words=( \"\\\\\\${=words[1,CURRENT]}\" )\n __${name.value}_debug \"Truncated words[*]: \\\\\\${words[*]},\"\n\n lastParam=\\\\\\${words[-1]}\n lastChar=\\\\\\${lastParam[-1]}\n __${name.value}_debug \"lastParam: \\\\\\${lastParam}, lastChar: \\\\\\${lastChar}\"\n # For zsh, when completing a flag with an = (e.g., ${bin.value} -n=<TAB>)\n # completions must be prefixed with the flag\n setopt local_options BASH_REMATCH\n if [[ \"\\\\\\${lastParam}\" =~ '-.*=' ]]; then\n # We are dealing with a flag with an =\n flagPrefix=\"-P \\\\\\${BASH_REMATCH}\"\n fi\n\n # Prepare the command to obtain completions, ensuring arguments are quoted for eval\n local -a args_to_quote=(\"\\\\\\${(@)words[2,-1]}\")\n if [ \"\\\\\\${lastChar}\" = \"\" ]; then\n # If the last parameter is complete (there is a space following it)\n # We add an extra empty parameter so we can indicate this to the go completion code.\n __${name.value}_debug \"Adding extra empty parameter\"\n args_to_quote+=(\"\")\n fi\n\n # Use Zsh's (q) flag to quote each argument safely for eval\n local quoted_args=(\"\\\\\\${(@q)args_to_quote}\")\n\n # Join the main command and the quoted arguments into a single string for eval\n requestComp=\"${EXEC_COMMAND} complete -- \\\\\\${quoted_args[*]}\"\n\n __${name.value}_debug \"About to call: eval \\\\\\${requestComp}\"\n\n # Use eval to handle any environment variables and such\n out=$(eval \\\\\\${requestComp} 2>/dev/null)\n __${name.value}_debug \"completion output: \\\\\\${out}\"\n\n # Extract the directive integer following a : from the last line\n local lastLine\n while IFS='\\n' read -r line; do\n lastLine=\\\\\\${line}\n done < <(printf \"%s\\n\" \"\\\\\\${out[@]}\")\n __${name.value}_debug \"last line: \\\\\\${lastLine}\"\n\n if [ \"\\\\\\${lastLine[1]}\" = : ]; then\n directive=\\\\\\${lastLine[2,-1]}\n # Remove the directive including the : and the newline\n local suffix\n (( suffix=\\\\\\${#lastLine}+2))\n out=\\\\\\${out[1,-$suffix]}\n else\n # There is no directive specified. Leave $out as is.\n __${name.value}_debug \"No directive found. Setting to default\"\n directive=0\n fi\n\n __${name.value}_debug \"directive: \\\\\\${directive}\"\n __${name.value}_debug \"completions: \\\\\\${out}\"\n __${name.value}_debug \"flagPrefix: \\\\\\${flagPrefix}\"\n\n if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then\n __${name.value}_debug \"Completion received error. Ignoring completions.\"\n return\n fi\n\n local activeHelpMarker=\"%\"\n local endIndex=\\\\\\${#activeHelpMarker}\n local startIndex=$((\\\\\\${#activeHelpMarker}+1))\n local hasActiveHelp=0\n while IFS='\\n' read -r comp; do\n # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)\n if [ \"\\\\\\${comp[1,$endIndex]}\" = \"$activeHelpMarker\" ];then\n __${name.value}_debug \"ActiveHelp found: $comp\"\n comp=\"\\\\\\${comp[$startIndex,-1]}\"\n if [ -n \"$comp\" ]; then\n compadd -x \"\\\\\\${comp}\"\n __${name.value}_debug \"ActiveHelp will need delimiter\"\n hasActiveHelp=1\n fi\n continue\n fi\n\n if [ -n \"$comp\" ]; then\n # If requested, completions are returned with a description.\n # The description is preceded by a TAB character.\n # For zsh's _describe, we need to use a : instead of a TAB.\n # We first need to escape any : as part of the completion itself.\n comp=\\\\\\${comp//:/\\\\:}\n\n local tab=\"$(printf '\\\\t')\"\n comp=\\\\\\${comp//$tab/:}\n\n __${name.value}_debug \"Adding completion: \\\\\\${comp}\"\n completions+=\\\\\\${comp}\n lastComp=$comp\n fi\n done < <(printf \"%s\\n\" \"\\\\\\${out[@]}\")\n\n # Add a delimiter after the activeHelp statements, but only if:\n # - there are completions following the activeHelp statements, or\n # - file completion will be performed (so there will be choices after the activeHelp)\n if [ $hasActiveHelp -eq 1 ]; then\n if [ \\\\\\${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then\n __${name.value}_debug \"Adding activeHelp delimiter\"\n compadd -x \"--\"\n hasActiveHelp=0\n fi\n fi\n\n if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then\n __${name.value}_debug \"Activating nospace.\"\n noSpace=\"-S ''\"\n fi\n\n if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then\n __${name.value}_debug \"Activating keep order.\"\n keepOrder=\"-V\"\n fi\n\n if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then\n # File extension filtering\n local filteringCmd\n filteringCmd='_files'\n for filter in \\\\\\${completions[@]}; do\n if [ \\\\\\${filter[1]} != '*' ]; then\n # zsh requires a glob pattern to do file filtering\n filter=\"\\\\*.$filter\"\n fi\n filteringCmd+=\" -g $filter\"\n done\n filteringCmd+=\" \\\\\\${flagPrefix}\"\n\n __${name.value}_debug \"File filtering command: $filteringCmd\"\n _arguments '*:filename:'\"$filteringCmd\"\n elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then\n # File completion for directories only\n local subdir\n subdir=\"\\\\\\${completions[1]}\"\n if [ -n \"$subdir\" ]; then\n __${name.value}_debug \"Listing directories in $subdir\"\n pushd \"\\\\\\${subdir}\" >/dev/null 2>&1\n else\n __${name.value}_debug \"Listing directories in .\"\n fi\n\n local result\n _arguments '*:dirname:_files -/'\" \\\\\\${flagPrefix}\"\n result=$?\n if [ -n \"$subdir\" ]; then\n popd >/dev/null 2>&1\n fi\n return $result\n else\n __${name.value}_debug \"Calling _describe\"\n if eval _describe $keepOrder \"completions\" completions -Q \\\\\\${flagPrefix} \\\\\\${noSpace}; then\n __${name.value}_debug \"_describe found some completions\"\n\n # Return the success of having called _describe\n return 0\n else\n __${name.value}_debug \"_describe did not find completions.\"\n __${name.value}_debug \"Checking if we should do file completion.\"\n if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then\n __${name.value}_debug \"deactivating file completion\"\n\n # Return 0 to indicate completion is finished and prevent zsh from\n # trying other completion algorithms (which could cause hanging).\n # We use NoFileComp directive to explicitly disable file completion.\n return 0\n else\n # Perform file completion\n __${name.value}_debug \"Activating file completion\"\n\n # We must return the result of this command, so it must be the\n # last command, or else we must store its result to return it.\n _arguments '*:filename:_files'\" \\\\\\${flagPrefix}\"\n fi\n fi\n fi\n}\n\n# don't run the completion function when being sourced or eval-ed\nif [ \"\\\\\\${funcstack[1]}\" = \"_${name.value}\" ]; then\n _${name.value}\nfi\n\\`; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"SHELL_COMPLETIONS_DISPLAY\"\n initializer={code` SHELL_COMPLETIONS.split(\"\\\\n\").map(line => {\n if (!line.trim()) {\n return \"\";\n }\n if (line.trim().startsWith(\"#\")) {\n return \\`\\${dim(line)}\\`;\n }\n\n return white(line).replaceAll(/(?<=\\\\\\$(\\\\{|\\\\()).*(?=(\\\\}\\\\)))/g, green(\"$&\"))\n .replaceAll(/\\\\\".*\\\\\"/g, cyan(\"$&\"))\n .replaceAll(/(\\\\[|\\\\]|\\\\(|\\\\)|\\\\||<|>|\\\\$\\\\(|\\\\$?\\\\{|\\\\}|\\\\+|=|;|:)/g, bold(gray(\"$&\")))\n .replaceAll(/(readonly|complete)\\\\s+/g, green(\"$&\"))\n .replaceAll(/(?<=(readonly|complete)\\\\s+)\\\\w/g, bold(greenBright(\"$&\")))\n .replaceAll(/local\\\\s+/g, red(\"$&\"))\n .replaceAll(/(?<=local\\\\s+)\\\\w/g, bold(redBright(\"$&\")))\n .replaceAll(/(for|while)\\\\s+/g, cyan(\"$&\"))\n .replaceAll(/(?<=for|while\\\\s+)\\\\w/g, bold(cyanBright(\"$&\")))\n .replaceAll(/(return|if|fi|else|elif|then|done)\\\\s+/g, green(\"$&\"))\n .replaceAll(/__\\\\w/g, bold(magentaBright(\"$&\")))\n .replaceAll(/(?<=\\\\s)(-\\\\w|--\\\\w[\\\\w-]*)(?=\\\\s|$)/g, bold(magenta(\"$&\")));\n\n }).join(\"\\\\n\"); `}\n />\n </TypescriptFile>\n );\n}\n"],"mappings":"osBAgCA,SAAE,GAAA,CACF,IAAO,EAAS,GAAA,CACR,EAAA,MAAU,EAAc,EAAA,CAAA,qBAE9B,OAAM,EAAmB,EAAY,CACrC,IAAM,MAAO,wDAGX,eAAC,CACC,QAAM,CAAA,QAAU,QAAQ,MAAW,OAAC,OAAe,OAAO,UAAW,gBAAA,cAAA,YAAA,aAAA,MAAA,CACtE,CACD,IAAI,UAAS,CACX,MAAK,CAAA,EAAM,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACT,MAAS,GACT,OAAO,GACP,KAAG,oBACH,IAAG,aAAK,CACN,MAAM,EAAA,QAAA,EAAA,MAAA;;;;;;;GAOb,EAAK,MAAA;oCACA,EAAA,yBAAA;sCACQ,EAAA,2BAAA;yCACT,EAAA,8BAAA;4CACC,EAAA,iCAAA;yCACA,EAAA,8BAAA;wCACuB,EAAA,6BAAA;;;;;QAK3B,EAAA,MAAA;QACJ,EAAA,MAAA;;;;;;;QAOM,EAAA,MAAA;;;;QAIF,EAAA,MAAA;yDACuC,EAAA,MAAA;;;;;;;;;;;;;YAa/B,EAAC,MAAM;;;;;;;;mBAQA,EAAQ;;QAEvB,EAAS,MAAM;;;;QAIb,EAAA,MAAY;;;;;;;QAOZ,EAAO,MAAK;;;;;;;;;;YAUR,EAAA,MAAa;;;;;QAKf,EAAK,MAAM;;;;YAIP,EAAC,MAAM;;;;;;;;;;;gBAWH,EAAK,MAAA;;;;oBAIjB,EAAA,MAAA;;;;;;;;;;;;;;;;gBAgBM,EAAW,MAAI;;;;;;;;;;;gBAWT,EAAA,MAAA;;;;;;;YAOJ,EAAK,MAAC;;;;;YAKN,EAAK,MAAM;;;;;;;;;;;;;;;;;YAiBf,EAAA,MAAA;;;;;;;;;;gBAUA,EAAa,MAAA;;;;;;;;;;;YAWT,EAAA,MAAA;;gBAEJ,EAAA,MAAA;;;;;gBAKM,EAAA,MAAY;gBACX,EAAA,MAAW;;oBAEN,EAAC,MAAA;;;;;;;;oBAQP,EAAA,MAAA;;;;;;;;;;;;OAYP,EAAK,MAAE;;OAIP,CAAC,CAAE,EAAiB,EAAQ,EAAA,CAAA,CAAA,EAAyB,EAAgB,CACpE,OAAU,GACV,MAAQ,oCAER,YAAU,CAAO;;;;;;;;;;;;;;;;;;;;;0BAsBlB,CAAA,CAAA,EAEJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"zsh-shared.mjs","names":[],"sources":["../../src/components/zsh-shared.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, computed } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript\";\nimport { getAppBin } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { CompletionDirective } from \"../helpers\";\nimport { EXEC_COMMAND } from \"../helpers/complete-command\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Zsh Completions generation for the Shell Shock project.\n */\nexport function ZshCompletionsShared() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n const name = computed(() => snakeCase(bin.value));\n\n return (\n <TypescriptFile\n path={joinPaths(context.entryPath, \"completions\", \"zsh\", \"shared.ts\")}\n builtinImports={{\n console: [\n \"white\",\n \"green\",\n \"red\",\n \"bold\",\n \"cyan\",\n \"gray\",\n \"magenta\",\n \"magentaBright\",\n \"greenBright\",\n \"redBright\",\n \"cyanBright\",\n \"dim\"\n ]\n }}>\n <Spacing />\n <VarDeclaration\n const\n export\n name=\"SHELL_COMPLETIONS\"\n initializer={code` \\`__${name.value}_debug() {\n local file=\"$BASH_COMP_DEBUG_FILE\"\n if [[ -n \\\\\\${file} ]]; then\n echo \"$*\" >> \"\\\\\\${file}\"\n fi\n}\n\n_${name.value}() {\n local shellCompDirectiveError=${\n CompletionDirective.CompletionDirectiveError\n }\n local shellCompDirectiveNoSpace=${\n CompletionDirective.CompletionDirectiveNoSpace\n }\n local shellCompDirectiveNoFileComp=${\n CompletionDirective.CompletionDirectiveNoFileComp\n }\n local shellCompDirectiveFilterFileExt=${\n CompletionDirective.CompletionDirectiveFilterFileExt\n }\n local shellCompDirectiveFilterDirs=${\n CompletionDirective.CompletionDirectiveFilterDirs\n }\n local shellCompDirectiveKeepOrder=${\n CompletionDirective.CompletionDirectiveKeepOrder\n }\n\n local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder\n local -a completions\n\n __${name.value}_debug \"\\\\n========= starting completion logic ==========\"\n __${name.value}_debug \"CURRENT: \\\\\\${CURRENT}, words[*]: \\\\\\${words[*]}\"\n\n # The user could have moved the cursor backwards on the command-line.\n # We need to trigger completion from the $CURRENT location, so we need\n # to truncate the command-line ($words) up to the $CURRENT location.\n # (We cannot use $CURSOR as its value does not work when a command is an alias.)\n words=( \"\\\\\\${=words[1,CURRENT]}\" )\n __${name.value}_debug \"Truncated words[*]: \\\\\\${words[*]},\"\n\n lastParam=\\\\\\${words[-1]}\n lastChar=\\\\\\${lastParam[-1]}\n __${name.value}_debug \"lastParam: \\\\\\${lastParam}, lastChar: \\\\\\${lastChar}\"\n # For zsh, when completing a flag with an = (e.g., ${bin.value} -n=<TAB>)\n # completions must be prefixed with the flag\n setopt local_options BASH_REMATCH\n if [[ \"\\\\\\${lastParam}\" =~ '-.*=' ]]; then\n # We are dealing with a flag with an =\n flagPrefix=\"-P \\\\\\${BASH_REMATCH}\"\n fi\n\n # Prepare the command to obtain completions, ensuring arguments are quoted for eval\n local -a args_to_quote=(\"\\\\\\${(@)words[2,-1]}\")\n if [ \"\\\\\\${lastChar}\" = \"\" ]; then\n # If the last parameter is complete (there is a space following it)\n # We add an extra empty parameter so we can indicate this to the go completion code.\n __${name.value}_debug \"Adding extra empty parameter\"\n args_to_quote+=(\"\")\n fi\n\n # Use Zsh's (q) flag to quote each argument safely for eval\n local quoted_args=(\"\\\\\\${(@q)args_to_quote}\")\n\n # Join the main command and the quoted arguments into a single string for eval\n requestComp=\"${EXEC_COMMAND} complete -- \\\\\\${quoted_args[*]}\"\n\n __${name.value}_debug \"About to call: eval \\\\\\${requestComp}\"\n\n # Use eval to handle any environment variables and such\n out=$(eval \\\\\\${requestComp} 2>/dev/null)\n __${name.value}_debug \"completion output: \\\\\\${out}\"\n\n # Extract the directive integer following a : from the last line\n local lastLine\n while IFS='\\n' read -r line; do\n lastLine=\\\\\\${line}\n done < <(printf \"%s\\n\" \"\\\\\\${out[@]}\")\n __${name.value}_debug \"last line: \\\\\\${lastLine}\"\n\n if [ \"\\\\\\${lastLine[1]}\" = : ]; then\n directive=\\\\\\${lastLine[2,-1]}\n # Remove the directive including the : and the newline\n local suffix\n (( suffix=\\\\\\${#lastLine}+2))\n out=\\\\\\${out[1,-$suffix]}\n else\n # There is no directive specified. Leave $out as is.\n __${name.value}_debug \"No directive found. Setting to default\"\n directive=0\n fi\n\n __${name.value}_debug \"directive: \\\\\\${directive}\"\n __${name.value}_debug \"completions: \\\\\\${out}\"\n __${name.value}_debug \"flagPrefix: \\\\\\${flagPrefix}\"\n\n if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then\n __${name.value}_debug \"Completion received error. Ignoring completions.\"\n return\n fi\n\n local activeHelpMarker=\"%\"\n local endIndex=\\\\\\${#activeHelpMarker}\n local startIndex=$((\\\\\\${#activeHelpMarker}+1))\n local hasActiveHelp=0\n while IFS='\\n' read -r comp; do\n # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)\n if [ \"\\\\\\${comp[1,$endIndex]}\" = \"$activeHelpMarker\" ];then\n __${name.value}_debug \"ActiveHelp found: $comp\"\n comp=\"\\\\\\${comp[$startIndex,-1]}\"\n if [ -n \"$comp\" ]; then\n compadd -x \"\\\\\\${comp}\"\n __${name.value}_debug \"ActiveHelp will need delimiter\"\n hasActiveHelp=1\n fi\n continue\n fi\n\n if [ -n \"$comp\" ]; then\n # If requested, completions are returned with a description.\n # The description is preceded by a TAB character.\n # For zsh's _describe, we need to use a : instead of a TAB.\n # We first need to escape any : as part of the completion itself.\n comp=\\\\\\${comp//:/\\\\:}\n\n local tab=\"$(printf '\\\\t')\"\n comp=\\\\\\${comp//$tab/:}\n\n __${name.value}_debug \"Adding completion: \\\\\\${comp}\"\n completions+=\\\\\\${comp}\n lastComp=$comp\n fi\n done < <(printf \"%s\\n\" \"\\\\\\${out[@]}\")\n\n # Add a delimiter after the activeHelp statements, but only if:\n # - there are completions following the activeHelp statements, or\n # - file completion will be performed (so there will be choices after the activeHelp)\n if [ $hasActiveHelp -eq 1 ]; then\n if [ \\\\\\${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then\n __${name.value}_debug \"Adding activeHelp delimiter\"\n compadd -x \"--\"\n hasActiveHelp=0\n fi\n fi\n\n if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then\n __${name.value}_debug \"Activating nospace.\"\n noSpace=\"-S ''\"\n fi\n\n if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then\n __${name.value}_debug \"Activating keep order.\"\n keepOrder=\"-V\"\n fi\n\n if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then\n # File extension filtering\n local filteringCmd\n filteringCmd='_files'\n for filter in \\\\\\${completions[@]}; do\n if [ \\\\\\${filter[1]} != '*' ]; then\n # zsh requires a glob pattern to do file filtering\n filter=\"\\\\*.$filter\"\n fi\n filteringCmd+=\" -g $filter\"\n done\n filteringCmd+=\" \\\\\\${flagPrefix}\"\n\n __${name.value}_debug \"File filtering command: $filteringCmd\"\n _arguments '*:filename:'\"$filteringCmd\"\n elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then\n # File completion for directories only\n local subdir\n subdir=\"\\\\\\${completions[1]}\"\n if [ -n \"$subdir\" ]; then\n __${name.value}_debug \"Listing directories in $subdir\"\n pushd \"\\\\\\${subdir}\" >/dev/null 2>&1\n else\n __${name.value}_debug \"Listing directories in .\"\n fi\n\n local result\n _arguments '*:dirname:_files -/'\" \\\\\\${flagPrefix}\"\n result=$?\n if [ -n \"$subdir\" ]; then\n popd >/dev/null 2>&1\n fi\n return $result\n else\n __${name.value}_debug \"Calling _describe\"\n if eval _describe $keepOrder \"completions\" completions -Q \\\\\\${flagPrefix} \\\\\\${noSpace}; then\n __${name.value}_debug \"_describe found some completions\"\n\n # Return the success of having called _describe\n return 0\n else\n __${name.value}_debug \"_describe did not find completions.\"\n __${name.value}_debug \"Checking if we should do file completion.\"\n if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then\n __${name.value}_debug \"deactivating file completion\"\n\n # Return 0 to indicate completion is finished and prevent zsh from\n # trying other completion algorithms (which could cause hanging).\n # We use NoFileComp directive to explicitly disable file completion.\n return 0\n else\n # Perform file completion\n __${name.value}_debug \"Activating file completion\"\n\n # We must return the result of this command, so it must be the\n # last command, or else we must store its result to return it.\n _arguments '*:filename:_files'\" \\\\\\${flagPrefix}\"\n fi\n fi\n fi\n}\n\n# don't run the completion function when being sourced or eval-ed\nif [ \"\\\\\\${funcstack[1]}\" = \"_${name.value}\" ]; then\n _${name.value}\nfi\n\\`; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"SHELL_COMPLETIONS_DISPLAY\"\n initializer={code` SHELL_COMPLETIONS.split(\"\\\\n\").map(line => {\n if (!line.trim()) {\n return \"\";\n }\n if (line.trim().startsWith(\"#\")) {\n return \\`\\${dim(line)}\\`;\n }\n\n return white(line).replaceAll(/(?<=\\\\\\$(\\\\{|\\\\()).*(?=(\\\\}\\\\)))/g, green(\"$&\"))\n .replaceAll(/\\\\\".*\\\\\"/g, cyan(\"$&\"))\n .replaceAll(/(\\\\[|\\\\]|\\\\(|\\\\)|\\\\||<|>|\\\\$\\\\(|\\\\$?\\\\{|\\\\}|\\\\+|=|;|:)/g, bold(gray(\"$&\")))\n .replaceAll(/(readonly|complete)\\\\s+/g, green(\"$&\"))\n .replaceAll(/(?<=(readonly|complete)\\\\s+)\\\\w/g, bold(greenBright(\"$&\")))\n .replaceAll(/local\\\\s+/g, red(\"$&\"))\n .replaceAll(/(?<=local\\\\s+)\\\\w/g, bold(redBright(\"$&\")))\n .replaceAll(/(for|while)\\\\s+/g, cyan(\"$&\"))\n .replaceAll(/(?<=for|while\\\\s+)\\\\w/g, bold(cyanBright(\"$&\")))\n .replaceAll(/(return|if|fi|else|elif|then|done)\\\\s+/g, green(\"$&\"))\n .replaceAll(/__\\\\w/g, bold(magentaBright(\"$&\")))\n .replaceAll(/(?<=\\\\s)(-\\\\w|--\\\\w[\\\\w-]*)(?=\\\\s|$)/g, bold(magenta(\"$&\")));\n\n }).join(\"\\\\n\"); `}\n />\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAgCA,SAAE,uBAAA;CACF,MAAO,UAAS,eAAA;CACd,MAAM,MAAA,eAAU,UAAc,QAAA,CAAA;;AAE9B,QAAM,gBAAmB,gBAAY;EACrC,IAAM,OAAO;;;EAGX,gBAAC,EACC,SAAM;GAAA;GAAU;GAAQ;GAAW;GAAC;GAAe;GAAO;GAAW;GAAA;GAAA;GAAA;GAAA;GAAA,EACtE;EACD,IAAI,WAAS;AACX,UAAK;IAAA,gBAAM,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACT,SAAS;KACT,UAAO;KACP,MAAG;KACH,IAAG,cAAK;AACN,aAAM,IAAA,QAAA,KAAA,MAAA;;;;;;;GAOb,KAAK,MAAA;oCACA,oBAAA,yBAAA;sCACQ,oBAAA,2BAAA;yCACT,oBAAA,8BAAA;4CACC,oBAAA,iCAAA;yCACA,oBAAA,8BAAA;wCACuB,oBAAA,6BAAA;;;;;QAK3B,KAAA,MAAA;QACJ,KAAA,MAAA;;;;;;;QAOM,KAAA,MAAA;;;;QAIF,KAAA,MAAA;yDACuC,IAAA,MAAA;;;;;;;;;;;;;YAa/B,KAAC,MAAM;;;;;;;;mBAQA,aAAQ;;QAEvB,KAAS,MAAM;;;;QAIb,KAAA,MAAY;;;;;;;QAOZ,KAAO,MAAK;;;;;;;;;;YAUR,KAAA,MAAa;;;;;QAKf,KAAK,MAAM;;;;YAIP,KAAC,MAAM;;;;;;;;;;;gBAWH,KAAK,MAAA;;;;oBAIjB,KAAA,MAAA;;;;;;;;;;;;;;;;gBAgBM,KAAW,MAAI;;;;;;;;;;;gBAWT,KAAA,MAAA;;;;;;;YAOJ,KAAK,MAAC;;;;;YAKN,KAAK,MAAM;;;;;;;;;;;;;;;;;YAiBf,KAAA,MAAA;;;;;;;;;;gBAUA,KAAa,MAAA;;;;;;;;;;;YAWT,KAAA,MAAA;;gBAEJ,KAAA,MAAA;;;;;gBAKM,KAAA,MAAY;gBACX,KAAA,MAAW;;oBAEN,KAAC,MAAA;;;;;;;;oBAQP,KAAA,MAAA;;;;;;;;;;;;OAYP,KAAK,MAAE;;;;KAIP,CAAC;IAAE,gBAAiB,SAAQ,EAAA,CAAA;IAAA,gBAAyB,gBAAgB;KACpE,UAAU;KACV,SAAQ;;KAER,aAAU,IAAO;;;;;;;;;;;;;;;;;;;;;;KAsBlB,CAAA;IAAA;;EAEJ,CAAC"}
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/complete-command.ts
|
|
4
|
+
function quoteIfNeeded(path) {
|
|
5
|
+
return path.includes(" ") ? `'${path}'` : path;
|
|
6
|
+
}
|
|
7
|
+
const EXEC_COMMAND = `${quoteIfNeeded(process.execPath)} ${process.execArgv.map(quoteIfNeeded).join(" ")} ${process.argv.slice(1).map(quoteIfNeeded)[0]}`;
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.EXEC_COMMAND = EXEC_COMMAND;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/helpers/complete-command.ts
|
|
2
|
+
function quoteIfNeeded(path) {
|
|
3
|
+
return path.includes(" ") ? `'${path}'` : path;
|
|
4
|
+
}
|
|
5
|
+
const EXEC_COMMAND = `${quoteIfNeeded(process.execPath)} ${process.execArgv.map(quoteIfNeeded).join(" ")} ${process.argv.slice(1).map(quoteIfNeeded)[0]}`;
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { EXEC_COMMAND };
|
|
2
9
|
//# sourceMappingURL=complete-command.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"complete-command.mjs","names":[],"sources":["../../src/helpers/complete-command.ts"],"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\nfunction quoteIfNeeded(path: string): string {\n return path.includes(\" \") ? `'${path}'` : path;\n}\n\nexport const EXEC_COMMAND = `${quoteIfNeeded(process.execPath)} ${process.execArgv\n .map(quoteIfNeeded)\n .join(\" \")} ${process.argv.slice(1).map(quoteIfNeeded)[0]}`;\n"],"mappings":"AAkBA,SAAS,
|
|
1
|
+
{"version":3,"file":"complete-command.mjs","names":[],"sources":["../../src/helpers/complete-command.ts"],"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\nfunction quoteIfNeeded(path: string): string {\n return path.includes(\" \") ? `'${path}'` : path;\n}\n\nexport const EXEC_COMMAND = `${quoteIfNeeded(process.execPath)} ${process.execArgv\n .map(quoteIfNeeded)\n .join(\" \")} ${process.argv.slice(1).map(quoteIfNeeded)[0]}`;\n"],"mappings":";AAkBA,SAAS,cAAc,MAAM;AAC3B,QAAO,KAAK,SAAS,IAAI,GAAG,IAAI,KAAK,KAAK"}
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/completion-directive-constants.ts
|
|
4
|
+
const CompletionDirective = {
|
|
5
|
+
CompletionDirectiveError: 1,
|
|
6
|
+
CompletionDirectiveNoSpace: 2,
|
|
7
|
+
CompletionDirectiveNoFileComp: 4,
|
|
8
|
+
CompletionDirectiveFilterFileExt: 8,
|
|
9
|
+
CompletionDirectiveFilterDirs: 16,
|
|
10
|
+
CompletionDirectiveKeepOrder: 32,
|
|
11
|
+
CompletionDirectiveMaxValue: 64,
|
|
12
|
+
CompletionDirectiveDefault: 0
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.CompletionDirective = CompletionDirective;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/helpers/completion-directive-constants.ts
|
|
2
|
+
const CompletionDirective = {
|
|
3
|
+
CompletionDirectiveError: 1,
|
|
4
|
+
CompletionDirectiveNoSpace: 2,
|
|
5
|
+
CompletionDirectiveNoFileComp: 4,
|
|
6
|
+
CompletionDirectiveFilterFileExt: 8,
|
|
7
|
+
CompletionDirectiveFilterDirs: 16,
|
|
8
|
+
CompletionDirectiveKeepOrder: 32,
|
|
9
|
+
CompletionDirectiveMaxValue: 64,
|
|
10
|
+
CompletionDirectiveDefault: 0
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CompletionDirective };
|
|
2
15
|
//# sourceMappingURL=completion-directive-constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion-directive-constants.mjs","names":[],"sources":["../../src/helpers/completion-directive-constants.ts"],"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\nexport const CompletionDirective = {\n CompletionDirectiveError: 1 << 0,\n CompletionDirectiveNoSpace: 1 << 1,\n CompletionDirectiveNoFileComp: 1 << 2,\n CompletionDirectiveFilterFileExt: 1 << 3,\n CompletionDirectiveFilterDirs: 1 << 4,\n CompletionDirectiveKeepOrder: 1 << 5,\n CompletionDirectiveMaxValue: 1 << 6,\n CompletionDirectiveDefault: 0\n};\n"],"mappings":"AAkBA,MAAa,
|
|
1
|
+
{"version":3,"file":"completion-directive-constants.mjs","names":[],"sources":["../../src/helpers/completion-directive-constants.ts"],"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\nexport const CompletionDirective = {\n CompletionDirectiveError: 1 << 0,\n CompletionDirectiveNoSpace: 1 << 1,\n CompletionDirectiveNoFileComp: 1 << 2,\n CompletionDirectiveFilterFileExt: 1 << 3,\n CompletionDirectiveFilterDirs: 1 << 4,\n CompletionDirectiveKeepOrder: 1 << 5,\n CompletionDirectiveMaxValue: 1 << 6,\n CompletionDirectiveDefault: 0\n};\n"],"mappings":";AAkBA,MAAa,sBAAsB;CACjC,0BAA0B;CAC1B,4BAA4B;CAC5B,+BAA+B;CAC/B,kCAAkC;CAClC,+BAA+B;CAC/B,8BAA8B;CAC9B,6BAA6B;CAC7B,4BAA4B;CAC7B"}
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_helpers_complete_command = require('./complete-command.cjs');
|
|
3
|
+
const require_helpers_completion_directive_constants = require('./completion-directive-constants.cjs');
|
|
4
|
+
|
|
5
|
+
exports.CompletionDirective = require_helpers_completion_directive_constants.CompletionDirective;
|
|
6
|
+
exports.EXEC_COMMAND = require_helpers_complete_command.EXEC_COMMAND;
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
import{EXEC_COMMAND
|
|
1
|
+
import { EXEC_COMMAND } from "./complete-command.mjs";
|
|
2
|
+
import { CompletionDirective } from "./completion-directive-constants.mjs";
|
|
3
|
+
|
|
4
|
+
export { CompletionDirective, EXEC_COMMAND };
|