@shell-shock/plugin-completions 0.4.2 → 0.4.4
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 +5 -4
- package/dist/components/bash-config-command.mjs +5 -4
- package/dist/components/bash-config-command.mjs.map +1 -1
- package/dist/components/bash-script-command.cjs +3 -3
- package/dist/components/bash-script-command.mjs +3 -3
- package/dist/components/bash-script-command.mjs.map +1 -1
- package/dist/components/bash-shared.cjs +27 -14
- package/dist/components/bash-shared.mjs +27 -14
- package/dist/components/bash-shared.mjs.map +1 -1
- package/dist/components/fish-config-command.cjs +5 -4
- package/dist/components/fish-config-command.mjs +5 -4
- package/dist/components/fish-config-command.mjs.map +1 -1
- package/dist/components/fish-script-command.cjs +3 -3
- package/dist/components/fish-script-command.mjs +3 -3
- package/dist/components/fish-script-command.mjs.map +1 -1
- package/dist/components/fish-shared.cjs +27 -14
- package/dist/components/fish-shared.mjs +27 -14
- package/dist/components/fish-shared.mjs.map +1 -1
- package/dist/components/powershell-config-command.cjs +4 -3
- package/dist/components/powershell-config-command.mjs +4 -3
- package/dist/components/powershell-config-command.mjs.map +1 -1
- package/dist/components/powershell-script-command.cjs +3 -3
- package/dist/components/powershell-script-command.mjs +3 -3
- package/dist/components/powershell-script-command.mjs.map +1 -1
- package/dist/components/powershell-shared.cjs +27 -14
- package/dist/components/powershell-shared.mjs +27 -14
- package/dist/components/powershell-shared.mjs.map +1 -1
- package/dist/components/zsh-config-command.cjs +5 -4
- package/dist/components/zsh-config-command.mjs +5 -4
- package/dist/components/zsh-config-command.mjs.map +1 -1
- package/dist/components/zsh-script-command.cjs +3 -3
- package/dist/components/zsh-script-command.mjs +3 -3
- package/dist/components/zsh-script-command.mjs.map +1 -1
- package/dist/components/zsh-shared.cjs +27 -14
- package/dist/components/zsh-shared.mjs +27 -14
- package/dist/components/zsh-shared.mjs.map +1 -1
- package/package.json +9 -9
|
@@ -24,7 +24,20 @@ function FishCompletionsShared() {
|
|
|
24
24
|
get path() {
|
|
25
25
|
return (0, _stryke_path.joinPaths)(context.entryPath, "completions", "fish", "shared.ts");
|
|
26
26
|
},
|
|
27
|
-
builtinImports: { console: [
|
|
27
|
+
builtinImports: { console: [
|
|
28
|
+
"white",
|
|
29
|
+
"green",
|
|
30
|
+
"red",
|
|
31
|
+
"bold",
|
|
32
|
+
"cyan",
|
|
33
|
+
"gray",
|
|
34
|
+
"magenta",
|
|
35
|
+
"magentaBright",
|
|
36
|
+
"greenBright",
|
|
37
|
+
"redBright",
|
|
38
|
+
"cyanBright",
|
|
39
|
+
"dim"
|
|
40
|
+
] },
|
|
28
41
|
get children() {
|
|
29
42
|
return [
|
|
30
43
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
@@ -276,21 +289,21 @@ complete -k -c ${bin.value} -n '__${name.value}_requires_order_preservation && _
|
|
|
276
289
|
return "";
|
|
277
290
|
}
|
|
278
291
|
if (line.trim().startsWith("#")) {
|
|
279
|
-
return \`\${
|
|
292
|
+
return \`\${dim(line)}\`;
|
|
280
293
|
}
|
|
281
294
|
|
|
282
|
-
return
|
|
283
|
-
.replaceAll(/(\\"|\\').*(\\"|\\')/g,
|
|
284
|
-
.replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|:)/g,
|
|
285
|
-
.replaceAll(/(function|complete)\\s+/g,
|
|
286
|
-
.replaceAll(/(?<=(function|complete)\\s+)\\w/g,
|
|
287
|
-
.replaceAll(/set\\s+/g,
|
|
288
|
-
.replaceAll(/(?<=set\\s+)\\w/g,
|
|
289
|
-
.replaceAll(/while\\s+/g,
|
|
290
|
-
.replaceAll(/(?<=while\\s+)\\w/g,
|
|
291
|
-
.replaceAll(/(if|fi|else|elif|then|done)\\s+/g,
|
|
292
|
-
.replaceAll(/\\s__\\w/g,
|
|
293
|
-
.replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g,
|
|
295
|
+
return white(line).replaceAll(/(?<=\\\$(\\{|\\()).*(?=(\\}\\)))/g, green("$&"))
|
|
296
|
+
.replaceAll(/(\\"|\\').*(\\"|\\')/g, cyan("$&"))
|
|
297
|
+
.replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|:)/g, bold(gray("$&")))
|
|
298
|
+
.replaceAll(/(function|complete)\\s+/g, green("$&"))
|
|
299
|
+
.replaceAll(/(?<=(function|complete)\\s+)\\w/g, bold(greenBright("$&")))
|
|
300
|
+
.replaceAll(/set\\s+/g, red("$&"))
|
|
301
|
+
.replaceAll(/(?<=set\\s+)\\w/g, bold(redBright("$&")))
|
|
302
|
+
.replaceAll(/while\\s+/g, cyan("$&"))
|
|
303
|
+
.replaceAll(/(?<=while\\s+)\\w/g, bold(cyanBright("$&")))
|
|
304
|
+
.replaceAll(/(if|fi|else|elif|then|done)\\s+/g, green("$&"))
|
|
305
|
+
.replaceAll(/\\s__\\w/g, bold(magentaBright("$&")))
|
|
306
|
+
.replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, bold(magenta("$&")));
|
|
294
307
|
|
|
295
308
|
}).join("\\n"); `
|
|
296
309
|
})
|
|
@@ -23,7 +23,20 @@ function FishCompletionsShared() {
|
|
|
23
23
|
get path() {
|
|
24
24
|
return joinPaths(context.entryPath, "completions", "fish", "shared.ts");
|
|
25
25
|
},
|
|
26
|
-
builtinImports: { console: [
|
|
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
|
+
] },
|
|
27
40
|
get children() {
|
|
28
41
|
return [
|
|
29
42
|
createComponent(Spacing, {}),
|
|
@@ -275,21 +288,21 @@ complete -k -c ${bin.value} -n '__${name.value}_requires_order_preservation && _
|
|
|
275
288
|
return "";
|
|
276
289
|
}
|
|
277
290
|
if (line.trim().startsWith("#")) {
|
|
278
|
-
return \`\${
|
|
291
|
+
return \`\${dim(line)}\`;
|
|
279
292
|
}
|
|
280
293
|
|
|
281
|
-
return
|
|
282
|
-
.replaceAll(/(\\"|\\').*(\\"|\\')/g,
|
|
283
|
-
.replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|:)/g,
|
|
284
|
-
.replaceAll(/(function|complete)\\s+/g,
|
|
285
|
-
.replaceAll(/(?<=(function|complete)\\s+)\\w/g,
|
|
286
|
-
.replaceAll(/set\\s+/g,
|
|
287
|
-
.replaceAll(/(?<=set\\s+)\\w/g,
|
|
288
|
-
.replaceAll(/while\\s+/g,
|
|
289
|
-
.replaceAll(/(?<=while\\s+)\\w/g,
|
|
290
|
-
.replaceAll(/(if|fi|else|elif|then|done)\\s+/g,
|
|
291
|
-
.replaceAll(/\\s__\\w/g,
|
|
292
|
-
.replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g,
|
|
294
|
+
return white(line).replaceAll(/(?<=\\\$(\\{|\\()).*(?=(\\}\\)))/g, green("$&"))
|
|
295
|
+
.replaceAll(/(\\"|\\').*(\\"|\\')/g, cyan("$&"))
|
|
296
|
+
.replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|:)/g, bold(gray("$&")))
|
|
297
|
+
.replaceAll(/(function|complete)\\s+/g, green("$&"))
|
|
298
|
+
.replaceAll(/(?<=(function|complete)\\s+)\\w/g, bold(greenBright("$&")))
|
|
299
|
+
.replaceAll(/set\\s+/g, red("$&"))
|
|
300
|
+
.replaceAll(/(?<=set\\s+)\\w/g, bold(redBright("$&")))
|
|
301
|
+
.replaceAll(/while\\s+/g, cyan("$&"))
|
|
302
|
+
.replaceAll(/(?<=while\\s+)\\w/g, bold(cyanBright("$&")))
|
|
303
|
+
.replaceAll(/(if|fi|else|elif|then|done)\\s+/g, green("$&"))
|
|
304
|
+
.replaceAll(/\\s__\\w/g, bold(magentaBright("$&")))
|
|
305
|
+
.replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, bold(magenta("$&")));
|
|
293
306
|
|
|
294
307
|
}).join("\\n"); `
|
|
295
308
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fish-shared.mjs","names":[],"sources":["../../src/components/fish-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 Fish Completions generation for the Shell Shock project.\n */\nexport function FishCompletionsShared() {\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\", \"fish\", \"shared.ts\")}\n builtinImports={{\n console: [\"colors\"]\n }}>\n <Spacing />\n <VarDeclaration\n const\n export\n name=\"SHELL_COMPLETIONS\"\n initializer={code` \\`function __${name.value}_debug\n set -l file \"$BASH_COMP_DEBUG_FILE\"\n if test -n \"$file\"\n echo \"$argv\" >> $file\n end\nend\n\nfunction __${name.value}_perform_completion\n __${name.value}_debug \"Starting __${name.value}_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 __${name.value}_debug \"args: $args\"\n __${name.value}_debug \"last arg: $lastArg\"\n\n # Build the completion request command\n set -l requestComp \"${EXEC_COMMAND} complete -- (string join ' ' -- (string escape -- $args[2..-1])) $lastArg\"\n\n __${name.value}_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 __${name.value}_debug \"Comps: $comps\"\n __${name.value}_debug \"DirectiveLine: $directiveLine\"\n __${name.value}_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 __${\n name.value\n }_perform_completion, by caching the result\nfunction __${name.value}_perform_completion_once\n __${name.value}_debug \"Starting __${name.value}_perform_completion_once\"\n\n if test -n \"$__${name.value}_perform_completion_once_result\"\n __${name.value}_debug \"Seems like a valid result already exists, skipping __${name.value}_perform_completion\"\n return 0\n end\n\n set --global __${name.value}_perform_completion_once_result (__${\n name.value\n }_perform_completion)\n if test -z \"$__${name.value}_perform_completion_once_result\"\n __${name.value}_debug \"No completions, probably due to a failure\"\n return 1\n end\n\n __${name.value}_debug \"Performed completions and set __${\n name.value\n }_perform_completion_once_result\"\n return 0\nend\n\n# This function is used to clear the cached result after completions are run\nfunction __${name.value}_clear_perform_completion_once_result\n __${name.value}_debug \"\"\n __${name.value}_debug \"========= clearing previously set __${\n name.value\n }_perform_completion_once_result variable ==========\"\n set --erase __${name.value}_perform_completion_once_result\n __${name.value}_debug \"Successfully erased the variable __${\n name.value\n }_perform_completion_once_result\"\nend\n\nfunction __${name.value}_requires_order_preservation\n __${name.value}_debug \"\"\n __${name.value}_debug \"========= checking if order preservation is required ==========\"\n\n __${name.value}_perform_completion_once\n if test -z \"$__${name.value}_perform_completion_once_result\"\n __${name.value}_debug \"Error determining if order preservation is required\"\n return 1\n end\n\n set -l directive (string sub --start 2 $__${\n name.value\n }_perform_completion_once_result[-1])\n __${name.value}_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 __${name.value}_debug \"Keeporder is: $keeporder\"\n\n if test $keeporder -ne 0\n __${name.value}_debug \"This does require order preservation\"\n return 0\n end\n\n __${name.value}_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 __${\n name.value\n }_comp_results\n# - Return false if file completion should be performed\nfunction __${name.value}_prepare_completions\n __${name.value}_debug \"\"\n __${name.value}_debug \"========= starting completion logic ==========\"\n\n # Start fresh\n set --erase __${name.value}_comp_results\n\n __${name.value}_perform_completion_once\n __${name.value}_debug \"Completion results: $__${\n name.value\n }_perform_completion_once_result\"\n\n if test -z \"$__${name.value}_perform_completion_once_result\"\n __${name.value}_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 $__${\n name.value\n }_perform_completion_once_result[-1])\n set --global __${name.value}_comp_results $__${\n name.value\n }_perform_completion_once_result[1..-2]\n\n __${name.value}_debug \"Completions are: $__${name.value}_comp_results\"\n __${name.value}_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 __${name.value}_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 __${name.value}_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 __${name.value}_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 __${name.value}_debug \"prefix: $prefix\"\n\n set -l completions (string match -r -- \"^$prefix.*\" $__${\n name.value\n }_comp_results)\n set --global __${name.value}_comp_results $completions\n __${name.value}_debug \"Filtered completions are: $__${\n name.value\n }_comp_results\"\n\n # Important not to quote the variable for count to work\n set -l numComps (count $__${name.value}_comp_results)\n __${name.value}_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\" $__${\n name.value\n }_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 __${name.value}_debug \"Adding second completion to perform nospace directive\"\n set --global __${name.value}_comp_results $split[1] $split[1].\n __${name.value}_debug \"Completions are now: $__${\n name.value\n }_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 __${name.value}_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 \"${bin.value}\"\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 \"${bin.value} \" > /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 ${bin.value} -e\n# This will get called after the two calls below and clear the cached result\ncomplete -c ${bin.value} -n '__${name.value}_clear_perform_completion_once_result'\n# The call to __${name.value}_prepare_completions will setup __${\n name.value\n }_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 __${name.value}_requires_order_preservation && __${\n name.value\n }_prepare_completions' -f -a '$__${name.value}_comp_results'\n# Otherwise we use the -k flag\ncomplete -k -c ${bin.value} -n '__${name.value}_requires_order_preservation && __${\n name.value\n }_prepare_completions' -f -a '$__${name.value}_comp_results'\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 \\`\\${colors.dim(line)}\\`;\n }\n\n return colors.white(line).replaceAll(/(?<=\\\\\\$(\\\\{|\\\\()).*(?=(\\\\}\\\\)))/g, colors.green(\"$&\"))\n .replaceAll(/(\\\\\"|\\\\').*(\\\\\"|\\\\')/g, colors.cyan(\"$&\"))\n .replaceAll(/(\\\\[|\\\\]|\\\\(|\\\\)|\\\\||<|>|\\\\$\\\\(|\\\\$?\\\\{|\\\\}|\\\\+|=|;|:)/g, colors.bold(colors.gray(\"$&\")))\n .replaceAll(/(function|complete)\\\\s+/g, colors.green(\"$&\"))\n .replaceAll(/(?<=(function|complete)\\\\s+)\\\\w/g, colors.bold(colors.greenBright(\"$&\")))\n .replaceAll(/set\\\\s+/g, colors.red(\"$&\"))\n .replaceAll(/(?<=set\\\\s+)\\\\w/g, colors.bold(colors.redBright(\"$&\")))\n .replaceAll(/while\\\\s+/g, colors.cyan(\"$&\"))\n .replaceAll(/(?<=while\\\\s+)\\\\w/g, colors.bold(colors.cyanBright(\"$&\")))\n .replaceAll(/(if|fi|else|elif|then|done)\\\\s+/g, colors.green(\"$&\"))\n .replaceAll(/\\\\s__\\\\w/g, colors.bold(colors.magentaBright(\"$&\")))\n .replaceAll(/(?<=\\\\s)(-\\\\w|--\\\\w[\\\\w-]*)(?=\\\\s|$)/g, colors.bold(colors.magenta(\"$&\")));\n\n }).join(\"\\\\n\"); `}\n />\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkCA,SAAgB,wBAAgB;;CAE9B,MAAM,MAAM,eAAe,UAAU,QAAQ,CAAC;CAC9C,MAAM,OAAO,eAAe,UAAU,IAAI,MAAM,CAAC;;EAEjD,IAAM,OAAC;AACJ,UAAA,UAAA,QAAA,WAAA,eAAA,QAAA,YAAA;;EAED,gBAAgB,EACd,SAAS,CAAC,SAAS,EACpB;EACD,IAAG,WAAS;AACV,UAAC;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACC,SAAA;KACA,UAAA;KACA,MAAM;KACN,IAAA,cAAkB;AAChB,aAAO,IAAC,iBAAoB,KAAA,MAAA;;;;;;;aAOzB,KAAK,MAAC;;;;;;;;QAQX,KAAK,MAAM;;;;;;QAMX,KAAG,MAAQ;;;;;;;;;;;;;;;;;;;;;;;QAuBX,KAAK,MAAM;QACX,KAAK,MAAM;;;;;;;;;;oCAUJ,KAAA,MAAA;aACN,KAAA,MAAA;QACD,KAAK,MAAK,qBAAM,KAAA,MAAA;;;YAGZ,KAAK,MAAI,+DAA0C,KAAA,MAAA;;;;;qBAK1C,KAAK,MAAM;YACrB,KAAA,MAAA;;;;QAIH,KAAA,MAAO,0CAAA,KAAA,MAAA;;;;;aAKV,KAAA,MAAA;QACD,KAAO,MAAA;;;QAGJ,KAAA,MAAY,6CAAsC,KAAY,MAAI;;;aAG5D,KAAK,MAAC;QACb,KAAK,MAAA;QACN,KAAA,MAAA;;QAEG,KAAK,MAAM;qBACR,KAAA,MAAA;YACN,KAAA,MAAA;;;;gDAIsB,KAAA,MAAA;QACnB,KAAK,MAAM;;yCAEA,oBAAA,6BAAA;;QAEX,KAAI,MAAK;;;;;;;QAOT,KAAK,MAAM;;;;;4DAKsC,KAAA,MAAA;;;QAGlD,KAAM,MAAA;QACL,KAAI,MAAK;;;;;QAKb,KAAO,MAAA;;;qBAGU,KAAI,MAAM;YACpB,KAAI,MAAA;;;;;gDAKY,KAAA,MAAA;qBACR,KAAO,MAAM,mBAAc,KAAU,MAAM;;QAExD,KAAM,MAAA,8BAAA,KAAA,MAAA;QACJ,KAAE,MAAS;;qCAEA,oBAAA,yBAAA;uCACmB,oBAAa,2BAAA;0CACxC,oBAAA,8BAAA;6CACyB,oBAAA,iCAAA;;;;;;;;YAQzB,KAAA,MAAW;;;;;;;;YAQV,KAAC,MAAM;;;;;;;;QAQX,KAAG,MAAA;;;;;;;;;YASC,KAAK,MAAA;;iEAEb,KAAA,MAAA;;YAEO,KAAA,MAAS,uCAAmC,KAAA,MAAA;;;oCAGvB,KAAA,MAAe;YACvC,KAAO,MAAA;;;;;;;0DAOmB,KAAA,MAAA;;;;;;;;;iCASJ,KAAO,MAAM;oBAC1B,KAAM,MAAI,kCAA2B,KAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;8BAuB1B,IAAA,MAAY;;;;cAI3B,IAAA,MAAA;;cAEC,IAAI,MAAM,SAAO,KAAM,MAAO;kBAC3B,KAAI,MAAA,oCAA2B,KAAA,MAAA;;;cAGlC,UAAO,QAAW,CAAC,aAAY,KAAK,MAAO,oCAAyB,KAAA,MAAA,kCAAA,KAAA,MAAA;;iBAElE,IAAI,MAAK,SAAM,KAAQ,MAAO,oCAAqC,KAAA,MAAS,kCAAA,KAAA,MAAA;;;KAGrF,CAAC;IAAE,gBAAa,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACf,UAAS;KACT,SAAI;KACJ,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBR,CAAA"}
|
|
1
|
+
{"version":3,"file":"fish-shared.mjs","names":[],"sources":["../../src/components/fish-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 Fish Completions generation for the Shell Shock project.\n */\nexport function FishCompletionsShared() {\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\", \"fish\", \"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` \\`function __${name.value}_debug\n set -l file \"$BASH_COMP_DEBUG_FILE\"\n if test -n \"$file\"\n echo \"$argv\" >> $file\n end\nend\n\nfunction __${name.value}_perform_completion\n __${name.value}_debug \"Starting __${name.value}_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 __${name.value}_debug \"args: $args\"\n __${name.value}_debug \"last arg: $lastArg\"\n\n # Build the completion request command\n set -l requestComp \"${EXEC_COMMAND} complete -- (string join ' ' -- (string escape -- $args[2..-1])) $lastArg\"\n\n __${name.value}_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 __${name.value}_debug \"Comps: $comps\"\n __${name.value}_debug \"DirectiveLine: $directiveLine\"\n __${name.value}_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 __${\n name.value\n }_perform_completion, by caching the result\nfunction __${name.value}_perform_completion_once\n __${name.value}_debug \"Starting __${name.value}_perform_completion_once\"\n\n if test -n \"$__${name.value}_perform_completion_once_result\"\n __${name.value}_debug \"Seems like a valid result already exists, skipping __${name.value}_perform_completion\"\n return 0\n end\n\n set --global __${name.value}_perform_completion_once_result (__${\n name.value\n }_perform_completion)\n if test -z \"$__${name.value}_perform_completion_once_result\"\n __${name.value}_debug \"No completions, probably due to a failure\"\n return 1\n end\n\n __${name.value}_debug \"Performed completions and set __${\n name.value\n }_perform_completion_once_result\"\n return 0\nend\n\n# This function is used to clear the cached result after completions are run\nfunction __${name.value}_clear_perform_completion_once_result\n __${name.value}_debug \"\"\n __${name.value}_debug \"========= clearing previously set __${\n name.value\n }_perform_completion_once_result variable ==========\"\n set --erase __${name.value}_perform_completion_once_result\n __${name.value}_debug \"Successfully erased the variable __${\n name.value\n }_perform_completion_once_result\"\nend\n\nfunction __${name.value}_requires_order_preservation\n __${name.value}_debug \"\"\n __${name.value}_debug \"========= checking if order preservation is required ==========\"\n\n __${name.value}_perform_completion_once\n if test -z \"$__${name.value}_perform_completion_once_result\"\n __${name.value}_debug \"Error determining if order preservation is required\"\n return 1\n end\n\n set -l directive (string sub --start 2 $__${\n name.value\n }_perform_completion_once_result[-1])\n __${name.value}_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 __${name.value}_debug \"Keeporder is: $keeporder\"\n\n if test $keeporder -ne 0\n __${name.value}_debug \"This does require order preservation\"\n return 0\n end\n\n __${name.value}_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 __${\n name.value\n }_comp_results\n# - Return false if file completion should be performed\nfunction __${name.value}_prepare_completions\n __${name.value}_debug \"\"\n __${name.value}_debug \"========= starting completion logic ==========\"\n\n # Start fresh\n set --erase __${name.value}_comp_results\n\n __${name.value}_perform_completion_once\n __${name.value}_debug \"Completion results: $__${\n name.value\n }_perform_completion_once_result\"\n\n if test -z \"$__${name.value}_perform_completion_once_result\"\n __${name.value}_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 $__${\n name.value\n }_perform_completion_once_result[-1])\n set --global __${name.value}_comp_results $__${\n name.value\n }_perform_completion_once_result[1..-2]\n\n __${name.value}_debug \"Completions are: $__${name.value}_comp_results\"\n __${name.value}_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 __${name.value}_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 __${name.value}_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 __${name.value}_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 __${name.value}_debug \"prefix: $prefix\"\n\n set -l completions (string match -r -- \"^$prefix.*\" $__${\n name.value\n }_comp_results)\n set --global __${name.value}_comp_results $completions\n __${name.value}_debug \"Filtered completions are: $__${\n name.value\n }_comp_results\"\n\n # Important not to quote the variable for count to work\n set -l numComps (count $__${name.value}_comp_results)\n __${name.value}_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\" $__${\n name.value\n }_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 __${name.value}_debug \"Adding second completion to perform nospace directive\"\n set --global __${name.value}_comp_results $split[1] $split[1].\n __${name.value}_debug \"Completions are now: $__${\n name.value\n }_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 __${name.value}_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 \"${bin.value}\"\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 \"${bin.value} \" > /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 ${bin.value} -e\n# This will get called after the two calls below and clear the cached result\ncomplete -c ${bin.value} -n '__${name.value}_clear_perform_completion_once_result'\n# The call to __${name.value}_prepare_completions will setup __${\n name.value\n }_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 __${name.value}_requires_order_preservation && __${\n name.value\n }_prepare_completions' -f -a '$__${name.value}_comp_results'\n# Otherwise we use the -k flag\ncomplete -k -c ${bin.value} -n '__${name.value}_requires_order_preservation && __${\n name.value\n }_prepare_completions' -f -a '$__${name.value}_comp_results'\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(/(function|complete)\\\\s+/g, green(\"$&\"))\n .replaceAll(/(?<=(function|complete)\\\\s+)\\\\w/g, bold(greenBright(\"$&\")))\n .replaceAll(/set\\\\s+/g, red(\"$&\"))\n .replaceAll(/(?<=set\\\\s+)\\\\w/g, bold(redBright(\"$&\")))\n .replaceAll(/while\\\\s+/g, cyan(\"$&\"))\n .replaceAll(/(?<=while\\\\s+)\\\\w/g, bold(cyanBright(\"$&\")))\n .replaceAll(/(if|fi|else|elif|then|done)\\\\s+/g, green(\"$&\"))\n .replaceAll(/\\\\s__\\\\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":";;;;;;;;;;;;;;;;;AAkCA,SAAgB,wBAAgB;;CAE9B,MAAM,MAAM,eAAe,UAAU,QAAQ,CAAC;CAC9C,MAAM,OAAO,eAAe,UAAU,IAAI,MAAM,CAAC;;EAEjD,IAAM,OAAC;AACJ,UAAA,UAAA,QAAA,WAAA,eAAA,QAAA,YAAA;;EAED,gBAAgB,EACd,SAAS;GAAC;GAAC;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA,EACZ;EACD,IAAI,WAAS;AACX,UAAK;IAAG,gBAAC,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACP,SAAQ;KACR,UAAQ;KACR,MAAG;KACH,IAAG,cAAQ;AACT,aAAC,IAAA,iBAAc,KAAA,MAAA;;;;;;;aAOlB,KAAS,MAAA;QACT,KAAA,MAAA,qBAAA,KAAA,MAAA;;;;;;;QAOC,KAAK,MAAM;QACf,KAAA,MAAA;;;0BAGoB,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;QAyBhB,KAAK,MAAM;QACX,KAAI,MAAA;QACJ,KAAA,MAAA;;;;;;;;;;aAUK,KAAK,MAAC;QACX,KAAK,MAAM,qBAAqB,KAAG,MAAA;;;YAG/B,KAAK,MAAA,+DAAA,KAAA,MAAA;;;;qBAII,KAAA,MAAA,qCAAa,KAAA,MAAA;qBAClC,KAAA,MAAA;;;;;QAKQ,KAAK,MAAK,0CAAM,KAAA,MAAA;;;;;aAKhB,KAAO,MAAA;QACX,KAAA,MAAA;;oBAEgB,KAAK,MAAM;QACzB,KAAK,MAAA,6CAAA,KAAA,MAAA;;;aAGC,KAAK,MAAM;QACf,KAAA,MAAO;QACX,KAAA,MAAA;;QAEI,KAAK,MAAM;qBACR,KAAA,MAAA;YACN,KAAA,MAAA;;;;gDAIuC,KAAO,MAAM;QACjD,KAAK,MAAK;;yCAEmB,oBAAwB,6BAAG;;QAE3D,KAAA,MAAA;;;YAGM,KAAA,MAAA;;;;QAIH,KAAK,MAAK;;;;;4DAKc,KAA+B,MAAA;;aAEvD,KAAO,MAAA;QACX,KAAA,MAAA;;;;oBAIC,KAAA,MAAA;;;QAGG,KAAG,MAAA,iCAA6B,KAAA,MAAA;;qBAEpC,KAAA,MAAA;YACO,KAAA,MAAW;;;;;gDAKP,KAAA,MAAA;qBACX,KAAA,MAAA,mBAAA,KAAA,MAAA;;QAEI,KAAK,MAAM,8BAA6B,KAAM,MAAA;QAClD,KAAO,MAAA;;;uCAGoB,oBAAA,2BAAA;0CACW,oBAAiB,8BAAA;6CAC5C,oBAAA,iCAAA;0CACN,oBAAA,8BAAA;;;;;;;YAOC,KAAM,MAAI;;;;;;;;YAQR,KAAK,MAAM;;;;;;;;QAQf,KAAE,MAAS;;;;;;;;;YASf,KAAA,MAAA;;iEAEsB,KAAA,MAAA;yBACtB,KAAA,MAAA;YACO,KAAA,MAAA,uCAA8B,KAAA,MAAA;;;oCAG9B,KAAA,MAAiC;YACtC,KAAA,MAAA;;;;;;;0DAOF,KAAA,MAAA;;;;;;;;;iCAS6B,KAAG,MAAQ;oBACxB,KAAE,MAAM,kCAA6B,KAAA,MAAA;;;;;;;gBAO9C,KAAS,MAAM;;;;;;;;;;;;cAYd,IAAK,MAAM;;;;8BAID,IAAA,MAAA;;;;cAIb,IAAA,MAAa;;cAEZ,IAAA,MAAc,SAAS,KAAI,MAAA;kBACtB,KAAQ,MAAE,oCAAmC,KAAA,MAAA;;;cAGjD,UAAM,QAAe,CAAC,aAAU,KAAQ,MAAI,oCAAA,KAAA,MAAA,kCAAA,KAAA,MAAA;;iBAEzC,IAAO,MAAM,SAAS,KAAC,MAAO,oCAAkB,KAAA,MAAA,kCAAA,KAAA,MAAA;;;KAGvD,CAAC;IAAE,gBAAgB,SAAO,EAAM,CAAC;IAAC,gBAAgB,gBAAA;KACjD,UAAU;KACV,SAAK;;KAEL,aAAW,IAAM;;;;;;;;;;;;;;;;;;;;;;KAsBrB,CAAA;IAAA"}
|
|
@@ -23,7 +23,8 @@ function PowerShellConfigCompletionsCommand() {
|
|
|
23
23
|
"../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
|
|
24
24
|
},
|
|
25
25
|
builtinImports: { "shell-shock:console": [
|
|
26
|
-
"
|
|
26
|
+
"bold",
|
|
27
|
+
"inlineCode",
|
|
27
28
|
"writeLine",
|
|
28
29
|
"success",
|
|
29
30
|
"warn",
|
|
@@ -98,7 +99,7 @@ function PowerShellConfigCompletionsCommand() {
|
|
|
98
99
|
} catch (error) {
|
|
99
100
|
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
|
|
100
101
|
// If the file doesn't exist, we can create it later when writing the completion script.
|
|
101
|
-
warn(\`Configuration file \${
|
|
102
|
+
warn(\`Configuration file \${bold(configPath)} does not exist. It will be created when the completion script is written.\`);
|
|
102
103
|
} else {
|
|
103
104
|
return { error };
|
|
104
105
|
}
|
|
@@ -106,7 +107,7 @@ function PowerShellConfigCompletionsCommand() {
|
|
|
106
107
|
|
|
107
108
|
await writeFile(configPath, \`\${content}\\n\\n### Begin - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} PowerShell Completions ###\\n\\n\${SHELL_COMPLETIONS} \\n\\n### End - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} PowerShell Completions ###\`);
|
|
108
109
|
|
|
109
|
-
success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} shell completions have been applied to PowerShell configuration file at \${
|
|
110
|
+
success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} shell completions have been applied to PowerShell configuration file at \${bold(configPath)}. Please restart your terminal or run \${inlineCode(\`source \${configPath}\`)} for the changes to take effect.\`); `)
|
|
110
111
|
];
|
|
111
112
|
}
|
|
112
113
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
@@ -22,7 +22,8 @@ function PowerShellConfigCompletionsCommand() {
|
|
|
22
22
|
"../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
|
|
23
23
|
},
|
|
24
24
|
builtinImports: { "shell-shock:console": [
|
|
25
|
-
"
|
|
25
|
+
"bold",
|
|
26
|
+
"inlineCode",
|
|
26
27
|
"writeLine",
|
|
27
28
|
"success",
|
|
28
29
|
"warn",
|
|
@@ -97,7 +98,7 @@ function PowerShellConfigCompletionsCommand() {
|
|
|
97
98
|
} catch (error) {
|
|
98
99
|
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
|
|
99
100
|
// If the file doesn't exist, we can create it later when writing the completion script.
|
|
100
|
-
warn(\`Configuration file \${
|
|
101
|
+
warn(\`Configuration file \${bold(configPath)} does not exist. It will be created when the completion script is written.\`);
|
|
101
102
|
} else {
|
|
102
103
|
return { error };
|
|
103
104
|
}
|
|
@@ -105,7 +106,7 @@ function PowerShellConfigCompletionsCommand() {
|
|
|
105
106
|
|
|
106
107
|
await writeFile(configPath, \`\${content}\\n\\n### Begin - ${getAppTitle(context)} PowerShell Completions ###\\n\\n\${SHELL_COMPLETIONS} \\n\\n### End - ${getAppTitle(context)} PowerShell Completions ###\`);
|
|
107
108
|
|
|
108
|
-
success(\`${getAppTitle(context)} shell completions have been applied to PowerShell configuration file at \${
|
|
109
|
+
success(\`${getAppTitle(context)} shell completions have been applied to PowerShell configuration file at \${bold(configPath)}. Please restart your terminal or run \${inlineCode(\`source \${configPath}\`)} for the changes to take effect.\`); `)
|
|
109
110
|
];
|
|
110
111
|
}
|
|
111
112
|
}), createComponent(ElseClause, { get children() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powershell-config-command.mjs","names":[],"sources":["../../src/components/powershell-config-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 ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\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 TSDoc,\n TSDocDefaultValue,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types\";\n\nexport function PowerShellConfigCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"powershell\",\n \"config\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"
|
|
1
|
+
{"version":3,"file":"powershell-config-command.mjs","names":[],"sources":["../../src/components/powershell-config-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 ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\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 TSDoc,\n TSDocDefaultValue,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types\";\n\nexport function PowerShellConfigCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"powershell\",\n \"config\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"bold\",\n \"inlineCode\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"help\"\n ]\n }}>\n <TSDoc heading=\"Options for the PowerShell Completions - Configuration command.\" />\n <InterfaceDeclaration export name=\"PowerShellConfigCompletionsOptions\">\n <TSDoc heading=\"Should the generated completion script be written to console output instead of an actual file on disk? This is useful for debugging purposes or if you want to manually handle the output.\">\n <TSDocDefaultValue\n type={ReflectionKind.boolean}\n defaultValue={false}\n />\n </TSDoc>\n <InterfaceMember name=\"display\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions powershell config\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"PowerShellConfigCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"~/.config/powershell/Microsoft.PowerShell_profile.ps1\"`\n }\n ]}>\n <IfStatement condition={code`options.display !== true`}>\n <VarDeclaration\n let\n name=\"configPath\"\n type=\"string\"\n initializer={code` path.includes(\".\") ? path : join(path, \"Microsoft.PowerShell_profile.ps1\");`}\n />\n <Spacing />\n <IfStatement condition={code`configPath.startsWith(\"~\")`}>\n {code`configPath = join(os.homedir(), configPath.replace(\"~\", \"\")); `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"content\"\n type=\"string\"\n initializer={code`\"\";`}\n />\n <Spacing />\n {code`try {\n content = await readFile(configPath, \"utf8\");\n } catch (error) {\n if (typeof error === \"object\" && error !== null && \"code\" in error && error.code === \"ENOENT\") {\n // If the file doesn't exist, we can create it later when writing the completion script.\n warn(\\`Configuration file \\${bold(configPath)} does not exist. It will be created when the completion script is written.\\`);\n } else {\n return { error };\n }\n }\n\n await writeFile(configPath, \\`\\${content}\\\\n\\\\n### Begin - ${getAppTitle(context)} PowerShell Completions ###\\\\n\\\\n\\${SHELL_COMPLETIONS} \\\\n\\\\n### End - ${getAppTitle(\n context\n )} PowerShell Completions ###\\`);\n\n success(\\`${getAppTitle(\n context\n )} shell completions have been applied to PowerShell configuration file at \\${bold(configPath)}. Please restart your terminal or run \\${inlineCode(\\`source \\${configPath}\\`)} for the changes to take effect.\\`); `}\n </IfStatement>\n <ElseClause>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(\"\");\n writeLine(\\`### Begin - ${getAppTitle(context)} PowerShell Completions ###\\`);\n writeLine(\"\");\n SHELL_COMPLETIONS_DISPLAY.split(\"\\\\n\").map(line => writeLine(line));\n writeLine(\"\");\n writeLine(\\`### End - ${getAppTitle(context)} PowerShell Completions ###\\`);\n writeLine(\"\");\n writeLine(\" ------------------------------------------------- \");\n\n writeLine(\"\");\n help(\\`To enable these completions, perform one of the following actions:\n\n 1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/powershell/Microsoft.PowerShell_profile.ps1)\n 2) Save the above script to a file and source it from your shell configuration file \\`); `}\n </ElseClause>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;AA4BA,SAAgB,qCAAkC;CAClD,MAAQ,UAAC,eAA+C;AACxD,QAAO,gBAAA,gBAAA;EACL,IAAK,OAAA;AACL,UAAA,UAAiB,QAAA,WAAA,eAAA,cAAA,UAAA,aAAA;;EAEjB,SAAO;GACH,WAAG;GACH,aAAa,CAAC,OAAO;GACrB,oBAAQ,CAAA,YAAyB,YAAW;;GAElD;EACE,gBAAgB;;;;;;;KAEhB;EACE,IAAC,WAAA;AACC,UAAM;IAAA,gBAAS,OAAA,EACb,SAAQ,mEACT,CAAC;IAAC,gBAAY,sBAAA;KACb,UAAC;KACD,MAAC;KACD,IAAC,WAAU;AACZ,aAAA,CAAA,gBAAA,OAAA;OACD,SAAS;OACN,IAAO,WAAO;AACT,eAAO,gBAAQ,mBAAA;SACb,IAAC,OAAU;AACT,iBAAK,eAAiB;;SAElC,cAAgB;SACP,CAAA;;OAEJ,CAAA,EAAA,gBAAW,iBAAA;OACX,MAAA;OACA,UAAQ;OACR,MAAK;OACL,CAAA,CAAA;;KAEJ,CAAC;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,OAAA,EACD,SAAM,sEACN,CAAA;IAAA,gBAAqB,qBAAa;KACjC,UAAO;KACP,WAAG;KACH,OAAI;KACJ,MAAI;KACJ,YAAG,CAAA;MACD,MAAK;MACN,MAAA;MACD,SAAA;MACD,EAAA;MACA,MAAM;MACN,MAAA;MACC,SAAA;MACA,CAAA;KACA,IAAA,WAAA;AACA,aAAM,CAAA,gBAAO,aAAA;OACb,WAAY,IAAA;OACV,IAAA,WAAA;AACE,eAAO;SAAA,gBAAQ,gBAAA;UACX,OAAG;UACP,MAAU;UACX,MAAA;UACD,aAAA,IAAA;UACE,CAAI;SAAE,gBAAM,SAAA,EAAA,CAAA;SAAA,gBAAA,aAAA;UACR,WAAU,IAAA;UACd,UAAc,IAAA;UAChB,CAAA;SAAA,gBAAA,SAAA,EAAA,CAAA;SAAA,gBAAA,gBAAA;UACA,OAAA;UACD,MAAY;UACV,MAAA;UACC,aAAA,IAAA;UACA,CAAI;SAAE,gBAAU,SAAA,EAAA,CAAA;SAAA,WAAA,IAAA;;;;;;;;;;;uEAWH,YAAA,QAAA,CAAA,yEAAA,YAAA,QAAA,CAAA;;sBAEb,YAAsB,QAAA,CAAA,mNAAA;SAAA;;OAEvB,CAAA,EAAA,gBAAS,YAAA,EACT,IAAK,WAAI;AACR,cAAS,IAAC;;sCAEY,YAAgB,QAAK,CAAI;;;;oCAI7B,YAAA,QAAA,CAAA;;;;;;;;;SAUnB,CAAC,CAAC;;KAEN,CAAC;IAAC;;EAEN,CAAC"}
|
|
@@ -27,8 +27,8 @@ function PowerShellScriptCompletionsCommand() {
|
|
|
27
27
|
"node:fs/promises": ["readFile", "writeFile"],
|
|
28
28
|
"../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
|
|
29
29
|
},
|
|
30
|
-
builtinImports: {
|
|
31
|
-
"
|
|
30
|
+
builtinImports: { console: [
|
|
31
|
+
"bold",
|
|
32
32
|
"writeLine",
|
|
33
33
|
"success",
|
|
34
34
|
"warn",
|
|
@@ -87,7 +87,7 @@ function PowerShellScriptCompletionsCommand() {
|
|
|
87
87
|
initializer: _alloy_js_core.code` path.includes(".") ? \`\${path}.ps1\` : path;`
|
|
88
88
|
}), (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`await writeFile(scriptPath, \`# PowerShell script to add completions for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)}\\n\\n\${SHELL_COMPLETIONS}\`);
|
|
89
89
|
|
|
90
|
-
success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} PowerShell completion script has been generated at \${
|
|
90
|
+
success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} PowerShell completion script has been generated at \${bold(scriptPath)}.\`);`)];
|
|
91
91
|
}
|
|
92
92
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
93
93
|
return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
|
|
@@ -26,8 +26,8 @@ function PowerShellScriptCompletionsCommand() {
|
|
|
26
26
|
"node:fs/promises": ["readFile", "writeFile"],
|
|
27
27
|
"../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
|
|
28
28
|
},
|
|
29
|
-
builtinImports: {
|
|
30
|
-
"
|
|
29
|
+
builtinImports: { console: [
|
|
30
|
+
"bold",
|
|
31
31
|
"writeLine",
|
|
32
32
|
"success",
|
|
33
33
|
"warn",
|
|
@@ -86,7 +86,7 @@ function PowerShellScriptCompletionsCommand() {
|
|
|
86
86
|
initializer: code` path.includes(".") ? \`\${path}.ps1\` : path;`
|
|
87
87
|
}), memo(() => code`await writeFile(scriptPath, \`# PowerShell script to add completions for ${getAppTitle(context)}\\n\\n\${SHELL_COMPLETIONS}\`);
|
|
88
88
|
|
|
89
|
-
success(\`${getAppTitle(context)} PowerShell completion script has been generated at \${
|
|
89
|
+
success(\`${getAppTitle(context)} PowerShell completion script has been generated at \${bold(scriptPath)}.\`);`)];
|
|
90
90
|
}
|
|
91
91
|
}), createComponent(ElseClause, { get children() {
|
|
92
92
|
return code`writeLine(" ------------------------------------------------- ");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powershell-script-command.mjs","names":[],"sources":["../../src/components/powershell-script-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, computed } from \"@alloy-js/core\";\nimport {\n ElseClause,\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} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The PowerShell Completions - Script command's handler wrapper for the Shell Shock project.\n */\nexport function PowerShellScriptCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"powershell\",\n \"script\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n
|
|
1
|
+
{"version":3,"file":"powershell-script-command.mjs","names":[],"sources":["../../src/components/powershell-script-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, computed } from \"@alloy-js/core\";\nimport {\n ElseClause,\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} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The PowerShell Completions - Script command's handler wrapper for the Shell Shock project.\n */\nexport function PowerShellScriptCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"powershell\",\n \"script\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n console: [\"bold\", \"writeLine\", \"success\", \"warn\", \"help\"]\n }}>\n <TSDoc heading=\"Options for the PowerShell Completions - Script command.\" />\n <InterfaceDeclaration export name=\"PowerShellScriptCompletionsOptions\">\n <TSDoc heading=\"Should the generated completion script be written to console output instead of an actual file on disk? This is useful for debugging purposes or if you want to manually handle the output.\">\n <TSDocDefaultValue\n type={ReflectionKind.boolean}\n defaultValue={false}\n />\n </TSDoc>\n <InterfaceMember name=\"display\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions powershell script\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"PowerShellScriptCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"${bin.value}-completions.ps1\"`\n }\n ]}>\n <IfStatement condition={code`options.display !== true`}>\n <VarDeclaration\n const\n name=\"scriptPath\"\n type=\"string\"\n initializer={code` path.includes(\".\") ? \\`\\${path}.ps1\\` : path;`}\n />\n {code`await writeFile(scriptPath, \\`# PowerShell script to add completions for ${getAppTitle(context)}\\\\n\\\\n\\${SHELL_COMPLETIONS}\\`);\n\n success(\\`${getAppTitle(\n context\n )} PowerShell completion script has been generated at \\${bold(scriptPath)}.\\`);`}\n </IfStatement>\n <ElseClause>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(\"\");\n writeLine(\\`# PowerShell completions for ${getAppTitle(context)}\\`);\n writeLine(\"\");\n SHELL_COMPLETIONS_DISPLAY.split(\"\\\\n\").map(line => writeLine(line));\n writeLine(\"\");\n writeLine(\" ------------------------------------------------- \");\n\n writeLine(\"\");\n help(\\`To enable these completions, perform one of the following actions:\n\n 1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/powershell/Microsoft.PowerShell_profile.ps1)\n 2) Save the above script to a file and source it from your shell configuration file \\`); `}\n </ElseClause>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,SAAO,qCAAA;CACL,MAAK,UAAA,eAAA;CACL,MAAA,MAAA,eAAA,UAAA,QAAA,CAAA;AACA,QAAO,gBAAkB,gBAAgB;EAC3C,IAAQ,OAAC;AACH,UAAG,UAAY,QAAO,WAAY,eAAA,cAAA,UAAA,aAAA;;;GAGtC,WAAA;GACI,aAAY,CAAA,OAAA;GAChB,oBAAA,CAAA,YAAA,YAAA;GACI,aAAU,CAAA,qBAAA,4BAAqC;GACnD;oBAEA,SAAY;GAAA;GAAU;GAAK;GAAmB;GAAA;GAAA;EAE9C,IAAM,WAAC;AACJ,UAAA;IAAA,gBAAA,SAAA,EACC,SAAM,4DACL,CAAC;IAAA,gBAAiB,sBAAA;KACjB,UAAC;KACD,MAAC;KACD,IAAC,WAAO;AACP,aAAQ,CAAA,gBAAE,SAAA;OACZ,SAAA;OACD,IAAS,WAAA;AACD,eAAM,gBAAG,qBAAA;SACT,IAAM,OAAO;AACV,iBAAQ,eAAe;;SAEjC,cAAA;SACD,CAAA;;OAEE,CAAA,EAAA,gBAAA,mBAAA;OACI,MAAC;OACN,UAAA;OACE,MAAM;OACJ,CAAA,CAAA;;KAEJ,CAAC;IAAE,gBAAgB,SAAK,EAAA,CAAA;IAAA,gBAAA,SAAA,EACvB,SAAG,sEACJ,CAAC;IAAE,gBAAK,qBAAA;KACP,UAAC;KACD,WAAA;KACD,OAAQ;KACR,MAAM;KACN,IAAA,aAAA;AACC,aAAA,CAAA;OACA,MAAA;OACA,MAAA;OACI,SAAS;OACb,EAAA;OACE,MAAA;OACE,MAAM;OACN,SAAO,IAAA,IAAA,MAAA;OACR,CAAC;;KAEJ,IAAE,WAAA;AACA,aAAO,CAAC,gBAAM,aAAA;OACZ,WAAO,IAAO;OACd,IAAA,WAAa;AACf,eAAA,CAAA,gBAAA,gBAAA;SACA,SAAA;SACD,MAAY;SACV,MAAA;SACC,aAAA,IAAA;SACA,CAAI,EAAE,WAAU,IAAA,4EAAA,YAAA,QAAA,CAAA;;wBAEJ,YAAY,QAAQ,CAAC,+EAAgC,CAAA;;OAElE,CAAA,EAAA,gBAAqB,YAAY;AAEhC,cAAS,IAAG;;uDAE6B,YAAc,QAAO,CAAA;;;;;;;;;;;SAY/D,CAAC,CAAA;;KAEL,CAAC;IAAC;;EAEN,CAAC"}
|
|
@@ -24,7 +24,20 @@ function PowerShellCompletionsShared() {
|
|
|
24
24
|
get path() {
|
|
25
25
|
return (0, _stryke_path.joinPaths)(context.entryPath, "completions", "powershell", "shared.ts");
|
|
26
26
|
},
|
|
27
|
-
builtinImports: { console: [
|
|
27
|
+
builtinImports: { console: [
|
|
28
|
+
"white",
|
|
29
|
+
"green",
|
|
30
|
+
"red",
|
|
31
|
+
"bold",
|
|
32
|
+
"cyan",
|
|
33
|
+
"gray",
|
|
34
|
+
"magenta",
|
|
35
|
+
"magentaBright",
|
|
36
|
+
"greenBright",
|
|
37
|
+
"redBright",
|
|
38
|
+
"cyanBright",
|
|
39
|
+
"dim"
|
|
40
|
+
] },
|
|
28
41
|
get children() {
|
|
29
42
|
return [
|
|
30
43
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
@@ -292,21 +305,21 @@ Register-ArgumentCompleter -CommandName '${bin.value}' -ScriptBlock $__${name.va
|
|
|
292
305
|
return "";
|
|
293
306
|
}
|
|
294
307
|
if (line.trim().startsWith("#")) {
|
|
295
|
-
return \`\${
|
|
308
|
+
return \`\${dim(line)}\`;
|
|
296
309
|
}
|
|
297
310
|
|
|
298
|
-
return
|
|
299
|
-
.replaceAll(/\\".*\\"/g,
|
|
300
|
-
.replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|::new|::OutputEncoding|::UTF8)/g,
|
|
301
|
-
.replaceAll(/(switch|complete)\\s+/g,
|
|
302
|
-
.replaceAll(/(?<=(switch|complete)\\s+)\\w/g,
|
|
303
|
-
.replaceAll(/(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\\w+)\\s+/g,
|
|
304
|
-
.replaceAll(/(?<=(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\\w+)\\s+)\\w/g,
|
|
305
|
-
.replaceAll(/while\\s+/g,
|
|
306
|
-
.replaceAll(/(?<=while\\s+)\\w/g,
|
|
307
|
-
.replaceAll(/(if|fi|else|elif|then|done)\\s+/g,
|
|
308
|
-
.replaceAll(/\\$?__\\w/g,
|
|
309
|
-
.replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g,
|
|
311
|
+
return white(line).replaceAll(/(?<=\\\$(\\{|\\()).*(?=(\\}\\)))/g, green("$&"))
|
|
312
|
+
.replaceAll(/\\".*\\"/g, cyan("$&"))
|
|
313
|
+
.replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|::new|::OutputEncoding|::UTF8)/g, bold(gray("$&")))
|
|
314
|
+
.replaceAll(/(switch|complete)\\s+/g, green("$&"))
|
|
315
|
+
.replaceAll(/(?<=(switch|complete)\\s+)\\w/g, bold(greenBright("$&")))
|
|
316
|
+
.replaceAll(/(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\\w+)\\s+/g, red("$&"))
|
|
317
|
+
.replaceAll(/(?<=(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\\w+)\\s+)\\w/g, bold(redBright("$&")))
|
|
318
|
+
.replaceAll(/while\\s+/g, cyan("$&"))
|
|
319
|
+
.replaceAll(/(?<=while\\s+)\\w/g, bold(cyanBright("$&")))
|
|
320
|
+
.replaceAll(/(if|fi|else|elif|then|done)\\s+/g, green("$&"))
|
|
321
|
+
.replaceAll(/\\$?__\\w/g, bold(magentaBright("$&")))
|
|
322
|
+
.replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, bold(magenta("$&")));
|
|
310
323
|
|
|
311
324
|
}).join("\\n"); `
|
|
312
325
|
})
|
|
@@ -23,7 +23,20 @@ function PowerShellCompletionsShared() {
|
|
|
23
23
|
get path() {
|
|
24
24
|
return joinPaths(context.entryPath, "completions", "powershell", "shared.ts");
|
|
25
25
|
},
|
|
26
|
-
builtinImports: { console: [
|
|
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
|
+
] },
|
|
27
40
|
get children() {
|
|
28
41
|
return [
|
|
29
42
|
createComponent(Spacing, {}),
|
|
@@ -291,21 +304,21 @@ Register-ArgumentCompleter -CommandName '${bin.value}' -ScriptBlock $__${name.va
|
|
|
291
304
|
return "";
|
|
292
305
|
}
|
|
293
306
|
if (line.trim().startsWith("#")) {
|
|
294
|
-
return \`\${
|
|
307
|
+
return \`\${dim(line)}\`;
|
|
295
308
|
}
|
|
296
309
|
|
|
297
|
-
return
|
|
298
|
-
.replaceAll(/\\".*\\"/g,
|
|
299
|
-
.replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|::new|::OutputEncoding|::UTF8)/g,
|
|
300
|
-
.replaceAll(/(switch|complete)\\s+/g,
|
|
301
|
-
.replaceAll(/(?<=(switch|complete)\\s+)\\w/g,
|
|
302
|
-
.replaceAll(/(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\\w+)\\s+/g,
|
|
303
|
-
.replaceAll(/(?<=(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\\w+)\\s+)\\w/g,
|
|
304
|
-
.replaceAll(/while\\s+/g,
|
|
305
|
-
.replaceAll(/(?<=while\\s+)\\w/g,
|
|
306
|
-
.replaceAll(/(if|fi|else|elif|then|done)\\s+/g,
|
|
307
|
-
.replaceAll(/\\$?__\\w/g,
|
|
308
|
-
.replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g,
|
|
310
|
+
return white(line).replaceAll(/(?<=\\\$(\\{|\\()).*(?=(\\}\\)))/g, green("$&"))
|
|
311
|
+
.replaceAll(/\\".*\\"/g, cyan("$&"))
|
|
312
|
+
.replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|::new|::OutputEncoding|::UTF8)/g, bold(gray("$&")))
|
|
313
|
+
.replaceAll(/(switch|complete)\\s+/g, green("$&"))
|
|
314
|
+
.replaceAll(/(?<=(switch|complete)\\s+)\\w/g, bold(greenBright("$&")))
|
|
315
|
+
.replaceAll(/(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\\w+)\\s+/g, red("$&"))
|
|
316
|
+
.replaceAll(/(?<=(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\\w+)\\s+)\\w/g, bold(redBright("$&")))
|
|
317
|
+
.replaceAll(/while\\s+/g, cyan("$&"))
|
|
318
|
+
.replaceAll(/(?<=while\\s+)\\w/g, bold(cyanBright("$&")))
|
|
319
|
+
.replaceAll(/(if|fi|else|elif|then|done)\\s+/g, green("$&"))
|
|
320
|
+
.replaceAll(/\\$?__\\w/g, bold(magentaBright("$&")))
|
|
321
|
+
.replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, bold(magenta("$&")));
|
|
309
322
|
|
|
310
323
|
}).join("\\n"); `
|
|
311
324
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powershell-shared.mjs","names":[],"sources":["../../src/components/powershell-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, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { CompletionDirective } from \"../helpers\";\nimport { EXEC_COMMAND } from \"../helpers/complete-command\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The PowerShell Completions generation for the Shell Shock project.\n */\nexport function PowerShellCompletionsShared() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n const name = computed(() => camelCase(bin.value));\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"powershell\",\n \"shared.ts\"\n )}\n builtinImports={{\n console: [\"colors\"]\n }}>\n <Spacing />\n <VarDeclaration\n const\n export\n name=\"SHELL_COMPLETIONS\"\n initializer={code` \\`# powershell completion for ${getAppTitle(context)}\n\n [Console]::OutputEncoding = [System.Text.Encoding]::UTF8\n function __${name.value}_debug {\n if ($env:BASH_COMP_DEBUG_FILE) {\n \"$args\" | Out-File -Append -FilePath \"$env:BASH_COMP_DEBUG_FILE\"\n }\n }\n\n filter __${name.value}_escapeStringWithSpecialChars {\n $_ -replace '\\\\s|#|@|\\\\$|;|,|''|\\\\{|\\\\}|\\\\(|\\\\)|\"|\\\\||<|>|&','\\\\\\`$&'\n }\n\n[scriptblock]$__${name.value}CompleterBlock = {\n param(\n $WordToComplete,\n $CommandAst,\n $CursorPosition\n )\n\n # Get the current command-line and convert into a string\n $Command = $CommandAst.CommandElements\n $Command = \"$Command\"\n\n __${name.value}_debug \"\"\n __${name.value}_debug \"========= starting completion logic ==========\"\n __${name.value}_debug \"WordToComplete: $WordToComplete Command: $Command CursorPosition: $CursorPosition\"\n\n # The user could have moved the cursor backwards on the command-line.\n # We need to trigger completion from the $CursorPosition location, so we need\n # to truncate the command-line ($Command) up to the $CursorPosition location.\n # Make sure the $Command is longer then the $CursorPosition before we truncate.\n # This happens because the $Command does not include the last space.\n if ($Command.Length -gt $CursorPosition) {\n $Command = $Command.Substring(0, $CursorPosition)\n }\n __${name.value}_debug \"Truncated command: $Command\"\n\n $ShellCompDirectiveError=${CompletionDirective.CompletionDirectiveError}\n $ShellCompDirectiveNoSpace=${CompletionDirective.CompletionDirectiveNoSpace}\n $ShellCompDirectiveNoFileComp=${\n CompletionDirective.CompletionDirectiveNoFileComp\n }\n $ShellCompDirectiveFilterFileExt=${\n CompletionDirective.CompletionDirectiveFilterFileExt\n }\n $ShellCompDirectiveFilterDirs=${\n CompletionDirective.CompletionDirectiveFilterDirs\n }\n $ShellCompDirectiveKeepOrder=${\n CompletionDirective.CompletionDirectiveKeepOrder\n }\n\n # Prepare the command to request completions for the program.\n # Split the command at the first space to separate the program and arguments.\n $Program, $Arguments = $Command.Split(\" \", 2)\n\n $QuotedArgs = ($Arguments -split ' ' | ForEach-Object { \"'\" + ($_ -replace \"'\", \"''\") + \"'\" }) -join ' '\n __${name.value}_debug \"QuotedArgs: $QuotedArgs\"\n\n $RequestComp = \"& ${EXEC_COMMAND} complete '--' $QuotedArgs\"\n __${name.value}_debug \"RequestComp: $RequestComp\"\n\n # we cannot use $WordToComplete because it\n # has the wrong values if the cursor was moved\n # so use the last argument\n if ($WordToComplete -ne \"\" ) {\n $WordToComplete = $Arguments.Split(\" \")[-1]\n }\n __${name.value}_debug \"New WordToComplete: $WordToComplete\"\n\n\n # Check for flag with equal sign\n $IsEqualFlag = ($WordToComplete -Like \"--*=*\" )\n if ( $IsEqualFlag ) {\n __${name.value}_debug \"Completing equal sign flag\"\n # Remove the flag part\n $Flag, $WordToComplete = $WordToComplete.Split(\"=\", 2)\n }\n\n if ( $WordToComplete -eq \"\" -And ( -Not $IsEqualFlag )) {\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 method.\n __${name.value}_debug \"Adding extra empty parameter\"\n # PowerShell 7.2+ changed the way how the arguments are passed to executables,\n # so for pre-7.2 or when Legacy argument passing is enabled we need to use\n if ($PSVersionTable.PsVersion -lt [version]'7.2.0' -or\n ($PSVersionTable.PsVersion -lt [version]'7.3.0' -and -not [ExperimentalFeature]::IsEnabled(\"PSNativeCommandArgumentPassing\")) -or\n (($PSVersionTable.PsVersion -ge [version]'7.3.0' -or [ExperimentalFeature]::IsEnabled(\"PSNativeCommandArgumentPassing\")) -and\n $PSNativeCommandArgumentPassing -eq 'Legacy')) {\n $RequestComp=\"$RequestComp\" + ' \\\\\\`\"\\\\\\`\"'\n } else {\n $RequestComp = \"$RequestComp\" + ' \"\"'\n }\n }\n\n __${name.value}_debug \"Calling $RequestComp\"\n # First disable ActiveHelp which is not supported for Powershell\n $env:ActiveHelp = 0\n\n # call the command store the output in $out and redirect stderr and stdout to null\n # $Out is an array contains each line per element\n Invoke-Expression -OutVariable out \"$RequestComp\" 2>&1 | Out-Null\n\n # get directive from last line\n [int]$Directive = $Out[-1].TrimStart(':')\n if ($Directive -eq \"\") {\n # There is no directive specified\n $Directive = 0\n }\n __${name.value}_debug \"The completion directive is: $Directive\"\n\n # remove directive (last element) from out\n $Out = $Out | Where-Object { $_ -ne $Out[-1] }\n __${name.value}_debug \"The completions are: $Out\"\n if (($Directive -band $ShellCompDirectiveError) -ne 0 ) {\n # Error code. No completion.\n __${name.value}_debug \"Received error from custom completion go code\"\n return\n }\n\n $Longest = 0\n [Array]$Values = $Out | ForEach-Object {\n # Split the output in name and description\n $Name, $Description = $_.Split(\"\\\\\\`t\", 2)\n __${name.value}_debug \"Name: $Name Description: $Description\"\n\n # Look for the longest completion so that we can format things nicely\n if ($Longest -lt $Name.Length) {\n $Longest = $Name.Length\n }\n\n # Set the description to a one space string if there is none set.\n # This is needed because the CompletionResult does not accept an empty string as argument\n if (-Not $Description) {\n $Description = \" \"\n }\n @{ Name = \"$Name\"; Description = \"$Description\" }\n }\n\n\n $Space = \" \"\n if (($Directive -band $ShellCompDirectiveNoSpace) -ne 0 ) {\n # remove the space here\n __${name.value}_debug \"ShellCompDirectiveNoSpace is called\"\n $Space = \"\"\n }\n\n if ((($Directive -band $ShellCompDirectiveFilterFileExt) -ne 0 ) -or\n (($Directive -band $ShellCompDirectiveFilterDirs) -ne 0 )) {\n __${\n name.value\n }_debug \"ShellCompDirectiveFilterFileExt ShellCompDirectiveFilterDirs are not supported\"\n\n # return here to prevent the completion of the extensions\n return\n }\n\n $Values = $Values | Where-Object {\n # filter the result\n $_.Name -like \"$WordToComplete*\"\n\n # Join the flag back if we have an equal sign flag\n if ( $IsEqualFlag ) {\n __${\n name.value\n }_debug \"Join the equal sign flag back to the completion value\"\n $_.Name = $Flag + \"=\" + $_.Name\n }\n }\n\n # we sort the values in ascending order by name if keep order isn't passed\n if (($Directive -band $ShellCompDirectiveKeepOrder) -eq 0 ) {\n $Values = $Values | Sort-Object -Property Name\n }\n\n if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {\n __${name.value}_debug \"ShellCompDirectiveNoFileComp is called\"\n\n if ($Values.Length -eq 0) {\n # Just print an empty string here so the\n # shell does not start to complete paths.\n # We cannot use CompletionResult here because\n # it does not accept an empty string as argument.\n \"\"\n return\n }\n }\n\n # Get the current mode\n $Mode = (Get-PSReadLineKeyHandler | Where-Object { $_.Key -eq \"Tab\" }).Function\n __${name.value}_debug \"Mode: $Mode\"\n\n $Values | ForEach-Object {\n\n # store temporary because switch will overwrite $_\n $comp = $_\n\n # PowerShell supports three different completion modes\n # - TabCompleteNext (default windows style - on each key press the next option is displayed)\n # - Complete (works like bash)\n # - MenuComplete (works like zsh)\n # You set the mode with Set-PSReadLineKeyHandler -Key Tab -Function <mode>\n\n # CompletionResult Arguments:\n # 1) CompletionText text to be used as the auto completion result\n # 2) ListItemText text to be displayed in the suggestion list\n # 3) ResultType type of completion result\n # 4) ToolTip text for the tooltip with details about the object\n\n switch ($Mode) {\n\n # bash like\n \"Complete\" {\n\n if ($Values.Length -eq 1) {\n __${name.value}_debug \"Only one completion left\"\n\n # insert space after value\n [System.Management.Automation.CompletionResult]::new($($comp.Name | __${\n name.value\n }_escapeStringWithSpecialChars) + $Space, \"$($comp.Name)\", 'ParameterValue', \"$($comp.Description)\")\n\n } else {\n # Add the proper number of spaces to align the descriptions\n while($comp.Name.Length -lt $Longest) {\n $comp.Name = $comp.Name + \" \"\n }\n\n # Check for empty description and only add parentheses if needed\n if ($($comp.Description) -eq \" \" ) {\n $Description = \"\"\n } else {\n $Description = \" ($($comp.Description))\"\n }\n\n [System.Management.Automation.CompletionResult]::new(\"$($comp.Name)$Description\", \"$($comp.Name)$Description\", 'ParameterValue', \"$($comp.Description)\")\n }\n }\n\n # zsh like\n \"MenuComplete\" {\n # insert space after value\n # MenuComplete will automatically show the ToolTip of\n # the highlighted value at the bottom of the suggestions.\n [System.Management.Automation.CompletionResult]::new($($comp.Name | __${\n name.value\n }_escapeStringWithSpecialChars) + $Space, \"$($comp.Name)\", 'ParameterValue', \"$($comp.Description)\")\n }\n\n # TabCompleteNext and in case we get something unknown\n Default {\n # Like MenuComplete but we don't want to add a space here because\n # the user need to press space anyway to get the completion.\n # Description will not be shown because that's not possible with TabCompleteNext\n [System.Management.Automation.CompletionResult]::new($($comp.Name | __${\n name.value\n }_escapeStringWithSpecialChars), \"$($comp.Name)\", 'ParameterValue', \"$($comp.Description)\")\n }\n }\n }\n}\n\nRegister-ArgumentCompleter -CommandName '${bin.value}' -ScriptBlock $__${\n name.value\n }CompleterBlock\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 \\`\\${colors.dim(line)}\\`;\n }\n\n return colors.white(line).replaceAll(/(?<=\\\\\\$(\\\\{|\\\\()).*(?=(\\\\}\\\\)))/g, colors.green(\"$&\"))\n .replaceAll(/\\\\\".*\\\\\"/g, colors.cyan(\"$&\"))\n .replaceAll(/(\\\\[|\\\\]|\\\\(|\\\\)|\\\\||<|>|\\\\$\\\\(|\\\\$?\\\\{|\\\\}|\\\\+|=|;|::new|::OutputEncoding|::UTF8)/g, colors.bold(colors.gray(\"$&\")))\n .replaceAll(/(switch|complete)\\\\s+/g, colors.green(\"$&\"))\n .replaceAll(/(?<=(switch|complete)\\\\s+)\\\\w/g, colors.bold(colors.greenBright(\"$&\")))\n .replaceAll(/(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\\\\w+)\\\\s+/g, colors.red(\"$&\"))\n .replaceAll(/(?<=(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\\\\w+)\\\\s+)\\\\w/g, colors.bold(colors.redBright(\"$&\")))\n .replaceAll(/while\\\\s+/g, colors.cyan(\"$&\"))\n .replaceAll(/(?<=while\\\\s+)\\\\w/g, colors.bold(colors.cyanBright(\"$&\")))\n .replaceAll(/(if|fi|else|elif|then|done)\\\\s+/g, colors.green(\"$&\"))\n .replaceAll(/\\\\$?__\\\\w/g, colors.bold(colors.magentaBright(\"$&\")))\n .replaceAll(/(?<=\\\\s)(-\\\\w|--\\\\w[\\\\w-]*)(?=\\\\s|$)/g, colors.bold(colors.magenta(\"$&\")));\n\n }).join(\"\\\\n\"); `}\n />\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkCA,SAAgB,8BAAgB;;CAE9B,MAAM,MAAM,eAAe,UAAU,QAAQ,CAAC;CAC9C,MAAM,OAAO,eAAe,UAAU,IAAI,MAAM,CAAC;;EAEjD,IAAM,OAAC;AACJ,UAAA,UAAA,QAAA,WAAA,eAAA,cAAA,YAAA;;EAED,gBAAY,EACV,SAAG,CAAA,SAAY,EAChB;EACD,IAAI,WAAU;AACZ,UAAC;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACD,SAAA;KACE,UAAU;KACV,MAAA;KACD,IAAA,cAAS;AACT,aAAA,IAAA,kCAAA,YAAA,QAAA,CAAA;;;iBAGO,KAAA,MAAA;;;;;;eAMA,KAAM,MAAM;;;;kBAIX,KAAK,MAAM;;;;;;;;;;;QAWpB,KAAO,MAAC;QACT,KAAQ,MAAG;QACX,KAAQ,MAAI;;;;;;;;;;QAUX,KAAK,MAAQ;;+BAES,oBAAc,yBAAc;iCACpD,oBAAA,2BAAA;oCACgC,oBAAkB,8BAAA;;oCAEvB,oBAAoB,8BAAwB;mCAC1C,oBAAoB,6BAA0B;;;;;;;QAO1E,KAAA,MAAA;;wBAED,aAAA;QACC,KAAA,MAAA;;;;;;;;QAQA,KAAA,MAAc;;;;;;YAMV,KAAO,MAAK;;;;;;;;;;;;;;;;;;;;;QAqBb,KAAE,MAAA;;;;;;;;;;;;;;QAcF,KAAC,MAAU;;;;QAIf,KAAO,MAAA;;;YAGD,KAAA,MAAa;;;;;;;;YAQX,KAAK,MAAM;;;;;;;;;;;;;;;;;;;YAmBb,KAAO,MAAC;;;;;;YAMd,KAAA,MAAA;;;;;;;;;;;;gBAYO,KAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkDW,KAAM,MAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;wFA2Bb,KAAA,MAAA;;;;;;;;;;;;;;2CAcO,IAAA,MAAA,oBAAA,KAAA,MAAA;;;KAGpB,CAAC;IAAE,gBAAY,SAAY,EAAK,CAAC;IAAE,gBAAkB,gBAAY;KAChE,UAAS;KACT,SAAS;KACT,MAAM;KACN,aAAI,IAAA;;;;;;;;;;;;;;;;;;;;;;KAsBL,CAAC;IAAA;;EAEL,CAAC"}
|
|
1
|
+
{"version":3,"file":"powershell-shared.mjs","names":[],"sources":["../../src/components/powershell-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, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { CompletionDirective } from \"../helpers\";\nimport { EXEC_COMMAND } from \"../helpers/complete-command\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The PowerShell Completions generation for the Shell Shock project.\n */\nexport function PowerShellCompletionsShared() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n const name = computed(() => camelCase(bin.value));\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"powershell\",\n \"shared.ts\"\n )}\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` \\`# powershell completion for ${getAppTitle(context)}\n\n [Console]::OutputEncoding = [System.Text.Encoding]::UTF8\n function __${name.value}_debug {\n if ($env:BASH_COMP_DEBUG_FILE) {\n \"$args\" | Out-File -Append -FilePath \"$env:BASH_COMP_DEBUG_FILE\"\n }\n }\n\n filter __${name.value}_escapeStringWithSpecialChars {\n $_ -replace '\\\\s|#|@|\\\\$|;|,|''|\\\\{|\\\\}|\\\\(|\\\\)|\"|\\\\||<|>|&','\\\\\\`$&'\n }\n\n[scriptblock]$__${name.value}CompleterBlock = {\n param(\n $WordToComplete,\n $CommandAst,\n $CursorPosition\n )\n\n # Get the current command-line and convert into a string\n $Command = $CommandAst.CommandElements\n $Command = \"$Command\"\n\n __${name.value}_debug \"\"\n __${name.value}_debug \"========= starting completion logic ==========\"\n __${name.value}_debug \"WordToComplete: $WordToComplete Command: $Command CursorPosition: $CursorPosition\"\n\n # The user could have moved the cursor backwards on the command-line.\n # We need to trigger completion from the $CursorPosition location, so we need\n # to truncate the command-line ($Command) up to the $CursorPosition location.\n # Make sure the $Command is longer then the $CursorPosition before we truncate.\n # This happens because the $Command does not include the last space.\n if ($Command.Length -gt $CursorPosition) {\n $Command = $Command.Substring(0, $CursorPosition)\n }\n __${name.value}_debug \"Truncated command: $Command\"\n\n $ShellCompDirectiveError=${CompletionDirective.CompletionDirectiveError}\n $ShellCompDirectiveNoSpace=${CompletionDirective.CompletionDirectiveNoSpace}\n $ShellCompDirectiveNoFileComp=${\n CompletionDirective.CompletionDirectiveNoFileComp\n }\n $ShellCompDirectiveFilterFileExt=${\n CompletionDirective.CompletionDirectiveFilterFileExt\n }\n $ShellCompDirectiveFilterDirs=${\n CompletionDirective.CompletionDirectiveFilterDirs\n }\n $ShellCompDirectiveKeepOrder=${\n CompletionDirective.CompletionDirectiveKeepOrder\n }\n\n # Prepare the command to request completions for the program.\n # Split the command at the first space to separate the program and arguments.\n $Program, $Arguments = $Command.Split(\" \", 2)\n\n $QuotedArgs = ($Arguments -split ' ' | ForEach-Object { \"'\" + ($_ -replace \"'\", \"''\") + \"'\" }) -join ' '\n __${name.value}_debug \"QuotedArgs: $QuotedArgs\"\n\n $RequestComp = \"& ${EXEC_COMMAND} complete '--' $QuotedArgs\"\n __${name.value}_debug \"RequestComp: $RequestComp\"\n\n # we cannot use $WordToComplete because it\n # has the wrong values if the cursor was moved\n # so use the last argument\n if ($WordToComplete -ne \"\" ) {\n $WordToComplete = $Arguments.Split(\" \")[-1]\n }\n __${name.value}_debug \"New WordToComplete: $WordToComplete\"\n\n\n # Check for flag with equal sign\n $IsEqualFlag = ($WordToComplete -Like \"--*=*\" )\n if ( $IsEqualFlag ) {\n __${name.value}_debug \"Completing equal sign flag\"\n # Remove the flag part\n $Flag, $WordToComplete = $WordToComplete.Split(\"=\", 2)\n }\n\n if ( $WordToComplete -eq \"\" -And ( -Not $IsEqualFlag )) {\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 method.\n __${name.value}_debug \"Adding extra empty parameter\"\n # PowerShell 7.2+ changed the way how the arguments are passed to executables,\n # so for pre-7.2 or when Legacy argument passing is enabled we need to use\n if ($PSVersionTable.PsVersion -lt [version]'7.2.0' -or\n ($PSVersionTable.PsVersion -lt [version]'7.3.0' -and -not [ExperimentalFeature]::IsEnabled(\"PSNativeCommandArgumentPassing\")) -or\n (($PSVersionTable.PsVersion -ge [version]'7.3.0' -or [ExperimentalFeature]::IsEnabled(\"PSNativeCommandArgumentPassing\")) -and\n $PSNativeCommandArgumentPassing -eq 'Legacy')) {\n $RequestComp=\"$RequestComp\" + ' \\\\\\`\"\\\\\\`\"'\n } else {\n $RequestComp = \"$RequestComp\" + ' \"\"'\n }\n }\n\n __${name.value}_debug \"Calling $RequestComp\"\n # First disable ActiveHelp which is not supported for Powershell\n $env:ActiveHelp = 0\n\n # call the command store the output in $out and redirect stderr and stdout to null\n # $Out is an array contains each line per element\n Invoke-Expression -OutVariable out \"$RequestComp\" 2>&1 | Out-Null\n\n # get directive from last line\n [int]$Directive = $Out[-1].TrimStart(':')\n if ($Directive -eq \"\") {\n # There is no directive specified\n $Directive = 0\n }\n __${name.value}_debug \"The completion directive is: $Directive\"\n\n # remove directive (last element) from out\n $Out = $Out | Where-Object { $_ -ne $Out[-1] }\n __${name.value}_debug \"The completions are: $Out\"\n if (($Directive -band $ShellCompDirectiveError) -ne 0 ) {\n # Error code. No completion.\n __${name.value}_debug \"Received error from custom completion go code\"\n return\n }\n\n $Longest = 0\n [Array]$Values = $Out | ForEach-Object {\n # Split the output in name and description\n $Name, $Description = $_.Split(\"\\\\\\`t\", 2)\n __${name.value}_debug \"Name: $Name Description: $Description\"\n\n # Look for the longest completion so that we can format things nicely\n if ($Longest -lt $Name.Length) {\n $Longest = $Name.Length\n }\n\n # Set the description to a one space string if there is none set.\n # This is needed because the CompletionResult does not accept an empty string as argument\n if (-Not $Description) {\n $Description = \" \"\n }\n @{ Name = \"$Name\"; Description = \"$Description\" }\n }\n\n\n $Space = \" \"\n if (($Directive -band $ShellCompDirectiveNoSpace) -ne 0 ) {\n # remove the space here\n __${name.value}_debug \"ShellCompDirectiveNoSpace is called\"\n $Space = \"\"\n }\n\n if ((($Directive -band $ShellCompDirectiveFilterFileExt) -ne 0 ) -or\n (($Directive -band $ShellCompDirectiveFilterDirs) -ne 0 )) {\n __${\n name.value\n }_debug \"ShellCompDirectiveFilterFileExt ShellCompDirectiveFilterDirs are not supported\"\n\n # return here to prevent the completion of the extensions\n return\n }\n\n $Values = $Values | Where-Object {\n # filter the result\n $_.Name -like \"$WordToComplete*\"\n\n # Join the flag back if we have an equal sign flag\n if ( $IsEqualFlag ) {\n __${\n name.value\n }_debug \"Join the equal sign flag back to the completion value\"\n $_.Name = $Flag + \"=\" + $_.Name\n }\n }\n\n # we sort the values in ascending order by name if keep order isn't passed\n if (($Directive -band $ShellCompDirectiveKeepOrder) -eq 0 ) {\n $Values = $Values | Sort-Object -Property Name\n }\n\n if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {\n __${name.value}_debug \"ShellCompDirectiveNoFileComp is called\"\n\n if ($Values.Length -eq 0) {\n # Just print an empty string here so the\n # shell does not start to complete paths.\n # We cannot use CompletionResult here because\n # it does not accept an empty string as argument.\n \"\"\n return\n }\n }\n\n # Get the current mode\n $Mode = (Get-PSReadLineKeyHandler | Where-Object { $_.Key -eq \"Tab\" }).Function\n __${name.value}_debug \"Mode: $Mode\"\n\n $Values | ForEach-Object {\n\n # store temporary because switch will overwrite $_\n $comp = $_\n\n # PowerShell supports three different completion modes\n # - TabCompleteNext (default windows style - on each key press the next option is displayed)\n # - Complete (works like bash)\n # - MenuComplete (works like zsh)\n # You set the mode with Set-PSReadLineKeyHandler -Key Tab -Function <mode>\n\n # CompletionResult Arguments:\n # 1) CompletionText text to be used as the auto completion result\n # 2) ListItemText text to be displayed in the suggestion list\n # 3) ResultType type of completion result\n # 4) ToolTip text for the tooltip with details about the object\n\n switch ($Mode) {\n\n # bash like\n \"Complete\" {\n\n if ($Values.Length -eq 1) {\n __${name.value}_debug \"Only one completion left\"\n\n # insert space after value\n [System.Management.Automation.CompletionResult]::new($($comp.Name | __${\n name.value\n }_escapeStringWithSpecialChars) + $Space, \"$($comp.Name)\", 'ParameterValue', \"$($comp.Description)\")\n\n } else {\n # Add the proper number of spaces to align the descriptions\n while($comp.Name.Length -lt $Longest) {\n $comp.Name = $comp.Name + \" \"\n }\n\n # Check for empty description and only add parentheses if needed\n if ($($comp.Description) -eq \" \" ) {\n $Description = \"\"\n } else {\n $Description = \" ($($comp.Description))\"\n }\n\n [System.Management.Automation.CompletionResult]::new(\"$($comp.Name)$Description\", \"$($comp.Name)$Description\", 'ParameterValue', \"$($comp.Description)\")\n }\n }\n\n # zsh like\n \"MenuComplete\" {\n # insert space after value\n # MenuComplete will automatically show the ToolTip of\n # the highlighted value at the bottom of the suggestions.\n [System.Management.Automation.CompletionResult]::new($($comp.Name | __${\n name.value\n }_escapeStringWithSpecialChars) + $Space, \"$($comp.Name)\", 'ParameterValue', \"$($comp.Description)\")\n }\n\n # TabCompleteNext and in case we get something unknown\n Default {\n # Like MenuComplete but we don't want to add a space here because\n # the user need to press space anyway to get the completion.\n # Description will not be shown because that's not possible with TabCompleteNext\n [System.Management.Automation.CompletionResult]::new($($comp.Name | __${\n name.value\n }_escapeStringWithSpecialChars), \"$($comp.Name)\", 'ParameterValue', \"$($comp.Description)\")\n }\n }\n }\n}\n\nRegister-ArgumentCompleter -CommandName '${bin.value}' -ScriptBlock $__${\n name.value\n }CompleterBlock\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(/(\\\\[|\\\\]|\\\\(|\\\\)|\\\\||<|>|\\\\$\\\\(|\\\\$?\\\\{|\\\\}|\\\\+|=|;|::new|::OutputEncoding|::UTF8)/g, bold(gray(\"$&\")))\n .replaceAll(/(switch|complete)\\\\s+/g, green(\"$&\"))\n .replaceAll(/(?<=(switch|complete)\\\\s+)\\\\w/g, bold(greenBright(\"$&\")))\n .replaceAll(/(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\\\\w+)\\\\s+/g, red(\"$&\"))\n .replaceAll(/(?<=(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\\\\w+)\\\\s+)\\\\w/g, bold(redBright(\"$&\")))\n .replaceAll(/while\\\\s+/g, cyan(\"$&\"))\n .replaceAll(/(?<=while\\\\s+)\\\\w/g, bold(cyanBright(\"$&\")))\n .replaceAll(/(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":";;;;;;;;;;;;;;;;;AAkCA,SAAgB,8BAAgB;;CAE9B,MAAM,MAAM,eAAe,UAAU,QAAQ,CAAC;CAC9C,MAAM,OAAO,eAAe,UAAU,IAAI,MAAM,CAAC;;EAEjD,IAAM,OAAC;AACJ,UAAA,UAAA,QAAA,WAAA,eAAA,cAAA,YAAA;;EAED,gBAAY,EACV,SAAG;GAAA;GAAY;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA,EAChB;EACD,IAAI,WAAU;AACZ,UAAC;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACD,SAAA;KACE,UAAS;KACT,MAAG;KACH,IAAG,cAAM;AACP,aAAK,IAAA,kCAAA,YAAA,QAAA,CAAA;;;iBAGC,KAAA,MAAA;;;;;;eAMF,KAAA,MAAA;;;;kBAIP,KAAA,MAAA;;;;;;;;;;;QAWH,KAAA,MAAA;;QAEA,KAAS,MAAM;;;;;;;;;;;;+BAYQ,oBAAA,yBAAA;iCACH,oBAAA,2BAAA;;uCAEG,oBAAA,iCAAA;oCACS,oBAAoB,8BAAiB;mCAC9C,oBAAiB,6BAAiC;;;;;;;QAOrE,KAAC,MAAQ;;wBAEb,aAAA;QACI,KAAK,MAAM;;;;;;;;QAQb,KAAA,MAAA;;;;;;YAMA,KAAA,MAAA;;;;;;;;YAQM,KAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2BX,KAAK,MAAI;;;;QAIT,KAAK,MAAE;;;YAGH,KAAE,MAAA;;;;;;;;YAQH,KAAI,MAAQ;;;;;;;;;;;;;;;;;;;YAmBnB,KAAA,MAAA;;;;;;YAMQ,KAAK,MAAM;;;;;;;;;;;;gBAYP,KAAI,MAAO;;;;;;;;;;;YAWhB,KAAA,MAAW;;;;;;;;;;;;;;QAcd,KAAE,MAAS;;;;;;;;;;;;;;;;;;;;;;;;;wBAyBf,KAAA,MAAA;;;4FAGuE,KAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCpE,CAAC;IAAE,gBAAe,SAAY,EAAE,CAAC;IAAA,gBAAA,gBAAA;KAChC,UAAU;KACV,SAAS;KACT,MAAM;;;;;;;;;;;;;;;;;;;;;;;KAuBP,CAAC;IAAC;;EAEN,CAAC"}
|