@shell-shock/plugin-completions 0.4.16 → 0.4.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/components/bash-config-command.cjs +116 -6
  2. package/dist/components/bash-config-command.d.cts +1 -3
  3. package/dist/components/bash-config-command.d.cts.map +1 -1
  4. package/dist/components/bash-config-command.d.mts +1 -3
  5. package/dist/components/bash-config-command.d.mts.map +1 -1
  6. package/dist/components/bash-config-command.mjs +115 -6
  7. package/dist/components/bash-config-command.mjs.map +1 -1
  8. package/dist/components/bash-script-command.cjs +101 -5
  9. package/dist/components/bash-script-command.d.cts +1 -3
  10. package/dist/components/bash-script-command.d.cts.map +1 -1
  11. package/dist/components/bash-script-command.d.mts +1 -3
  12. package/dist/components/bash-script-command.d.mts.map +1 -1
  13. package/dist/components/bash-script-command.mjs +100 -5
  14. package/dist/components/bash-script-command.mjs.map +1 -1
  15. package/dist/components/bash-shared.cjs +77 -13
  16. package/dist/components/bash-shared.d.cts +1 -3
  17. package/dist/components/bash-shared.d.cts.map +1 -1
  18. package/dist/components/bash-shared.d.mts +1 -3
  19. package/dist/components/bash-shared.d.mts.map +1 -1
  20. package/dist/components/bash-shared.mjs +76 -13
  21. package/dist/components/bash-shared.mjs.map +1 -1
  22. package/dist/components/fish-config-command.cjs +116 -6
  23. package/dist/components/fish-config-command.d.cts +1 -3
  24. package/dist/components/fish-config-command.d.cts.map +1 -1
  25. package/dist/components/fish-config-command.d.mts +1 -3
  26. package/dist/components/fish-config-command.d.mts.map +1 -1
  27. package/dist/components/fish-config-command.mjs +115 -6
  28. package/dist/components/fish-config-command.mjs.map +1 -1
  29. package/dist/components/fish-script-command.cjs +100 -4
  30. package/dist/components/fish-script-command.d.cts +1 -3
  31. package/dist/components/fish-script-command.d.cts.map +1 -1
  32. package/dist/components/fish-script-command.d.mts +1 -3
  33. package/dist/components/fish-script-command.d.mts.map +1 -1
  34. package/dist/components/fish-script-command.mjs +99 -4
  35. package/dist/components/fish-script-command.mjs.map +1 -1
  36. package/dist/components/fish-shared.cjs +141 -77
  37. package/dist/components/fish-shared.d.cts +1 -3
  38. package/dist/components/fish-shared.d.cts.map +1 -1
  39. package/dist/components/fish-shared.d.mts +1 -3
  40. package/dist/components/fish-shared.d.mts.map +1 -1
  41. package/dist/components/fish-shared.mjs +140 -77
  42. package/dist/components/fish-shared.mjs.map +1 -1
  43. package/dist/components/index.cjs +26 -1
  44. package/dist/components/index.mjs +14 -1
  45. package/dist/components/powershell-config-command.cjs +112 -6
  46. package/dist/components/powershell-config-command.d.cts +1 -3
  47. package/dist/components/powershell-config-command.d.cts.map +1 -1
  48. package/dist/components/powershell-config-command.d.mts +1 -3
  49. package/dist/components/powershell-config-command.d.mts.map +1 -1
  50. package/dist/components/powershell-config-command.mjs +111 -6
  51. package/dist/components/powershell-config-command.mjs.map +1 -1
  52. package/dist/components/powershell-script-command.cjs +100 -4
  53. package/dist/components/powershell-script-command.d.cts +1 -3
  54. package/dist/components/powershell-script-command.d.cts.map +1 -1
  55. package/dist/components/powershell-script-command.d.mts +1 -3
  56. package/dist/components/powershell-script-command.d.mts.map +1 -1
  57. package/dist/components/powershell-script-command.mjs +99 -4
  58. package/dist/components/powershell-script-command.mjs.map +1 -1
  59. package/dist/components/powershell-shared.cjs +101 -37
  60. package/dist/components/powershell-shared.d.cts +1 -3
  61. package/dist/components/powershell-shared.d.cts.map +1 -1
  62. package/dist/components/powershell-shared.d.mts +1 -3
  63. package/dist/components/powershell-shared.d.mts.map +1 -1
  64. package/dist/components/powershell-shared.mjs +100 -37
  65. package/dist/components/powershell-shared.mjs.map +1 -1
  66. package/dist/components/zsh-config-command.cjs +116 -6
  67. package/dist/components/zsh-config-command.d.cts +1 -3
  68. package/dist/components/zsh-config-command.d.cts.map +1 -1
  69. package/dist/components/zsh-config-command.d.mts +1 -3
  70. package/dist/components/zsh-config-command.d.mts.map +1 -1
  71. package/dist/components/zsh-config-command.mjs +115 -6
  72. package/dist/components/zsh-config-command.mjs.map +1 -1
  73. package/dist/components/zsh-script-command.cjs +104 -6
  74. package/dist/components/zsh-script-command.d.cts +1 -3
  75. package/dist/components/zsh-script-command.d.cts.map +1 -1
  76. package/dist/components/zsh-script-command.d.mts +1 -3
  77. package/dist/components/zsh-script-command.d.mts.map +1 -1
  78. package/dist/components/zsh-script-command.mjs +103 -6
  79. package/dist/components/zsh-script-command.mjs.map +1 -1
  80. package/dist/components/zsh-shared.cjs +106 -42
  81. package/dist/components/zsh-shared.d.cts +1 -3
  82. package/dist/components/zsh-shared.d.cts.map +1 -1
  83. package/dist/components/zsh-shared.d.mts +1 -3
  84. package/dist/components/zsh-shared.d.mts.map +1 -1
  85. package/dist/components/zsh-shared.mjs +105 -42
  86. package/dist/components/zsh-shared.mjs.map +1 -1
  87. package/dist/helpers/complete-command.cjs +10 -1
  88. package/dist/helpers/complete-command.d.mts.map +1 -1
  89. package/dist/helpers/complete-command.mjs +8 -1
  90. package/dist/helpers/complete-command.mjs.map +1 -1
  91. package/dist/helpers/completion-directive-constants.cjs +16 -1
  92. package/dist/helpers/completion-directive-constants.d.mts.map +1 -1
  93. package/dist/helpers/completion-directive-constants.mjs +14 -1
  94. package/dist/helpers/completion-directive-constants.mjs.map +1 -1
  95. package/dist/helpers/index.cjs +6 -1
  96. package/dist/helpers/index.mjs +4 -1
  97. package/dist/index.cjs +290 -1
  98. package/dist/index.d.cts +2 -2
  99. package/dist/index.d.mts +2 -2
  100. package/dist/index.d.mts.map +1 -1
  101. package/dist/index.mjs +288 -1
  102. package/dist/index.mjs.map +1 -1
  103. package/dist/types/index.cjs +4 -1
  104. package/dist/types/index.mjs +3 -1
  105. package/dist/types/plugin.d.cts.map +1 -1
  106. package/dist/types/plugin.d.mts.map +1 -1
  107. package/dist/types/plugin.mjs +1 -1
  108. package/dist/types/shell-type.cjs +12 -1
  109. package/dist/types/shell-type.d.cts.map +1 -1
  110. package/dist/types/shell-type.d.mts.map +1 -1
  111. package/dist/types/shell-type.mjs +10 -1
  112. package/dist/types/shell-type.mjs.map +1 -1
  113. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"file":"zsh-script-command.mjs","names":[],"sources":["../../src/components/zsh-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 { snakeCase } from \"@stryke/string-format/snake-case\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Zsh Completions - Script command's handler wrapper for the Shell Shock project.\n */\nexport function ZshScriptCompletionsCommand() {\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(\n context.entryPath,\n \"completions\",\n \"zsh\",\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 Zsh Completions - Script command.\" />\n <InterfaceDeclaration export name=\"ZshScriptCompletionsOptions\">\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 zsh script\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"ZshScriptCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"${bin.value}-completions.zsh\"`\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}.zsh\\` : path;`}\n />\n {code`await writeFile(scriptPath, \\`# Zsh script to add completions for ${getAppTitle(context)}\\\\n\\\\n\\${SHELL_COMPLETIONS}\\`);\n\n success(\\`${getAppTitle(\n context\n )} Zsh completion script has been generated at \\${bold(scriptPath)}.\\`);`}\n </IfStatement>\n <ElseClause>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(\"\");\n writeLine(\"#compdef ${bin.value} \");\n writeLine(\"#compdef _${name.value} ${bin.value}\");\n writeLine(\"\");\n writeLine(\"# Zsh completion 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/zsh/.zshrc)\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":"6zBAgCA,SAAS,GAAmC,CAC5C,IAAO,EAAA,GAAA,CACA,EAAA,MAAA,EAAA,EAAA,CAAA,CACL,EAAA,MAAA,EAAA,EAAA,MAAA,CAAA,CACA,OAAO,EAAkB,EAAgB,CAC3C,IAAQ,MAAC,CACH,OAAG,EAAY,EAAO,UAAY,cAAA,MAAA,SAAA,aAAA,EAExC,QAAa,gBAEX,YAAA,CAAA,OAAA,CACI,mBAAmB,CAAA,WAAc,YAAW,CAChD,YAAA,CAAA,oBAAA,4BAAA,CACF,CACE,eAAgB,CAAA,QAAA,6CAEhB,CACA,IAAM,UAAO,aAEP,QAAC,oDACJ,CAAA,CAAA,EAAA,EAAA,CACC,OAAM,GACJ,KAAA,8BACA,IAAC,UAAY,CACZ,MAAI,CAAA,EAAA,EAAA,CACJ,QAAO,6LACP,IAAO,UAAG,CACZ,OAAA,EAAA,EAAA,CACQ,IAAA,MAAA,CACG,OAAK,EAAA,SAEP,aAAc,GAClB,CAAA,EAEN,CAAA,CAAA,EAAgB,EAAA,CACd,KAAU,UACV,SAAA,GACI,KAAC,UACN,CAAA,CAAA,EAEA,CAAC,CAAE,EAAC,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACH,QAAS,8DACV,CAAC,CAAE,EAAgB,EAAK,CACvB,OAAG,GACH,QAAO,GACP,MAAC,GACD,KAAA,UACD,IAAA,YAAS,CACT,MAAM,CAAA,CACN,KAAA,UACC,KAAA,8BACA,QAAA,KACA,CAAA,CACI,KAAE,OACN,KAAU,SACR,QAAA,IAAA,EAAA,MAAA,mBACC,CAAC,EAEJ,IAAI,UAAW,CACb,MAAC,CAAA,EAAA,EAAA,CACD,UAAA,CAAA,2BACE,IAAI,UAAQ,CACZ,MAAO,CAAA,EAAO,EAAA,CACd,MAAa,GACf,KAAA,aACA,KAAA,SACD,YAAY,CAAW,iDACrB,CAAA,CAAA,MAAA,CAAA,qEAAA,EAAA,EAAA,CAAA;;wBAEO,EAAU,EAAA,CAAA,wEAAA,CAAA,EAEjB,CAAC,CAAA,EAAmB,EAAa,CACjC,IAAA,UAAA,CACA,MAAU,EAAC;;kCAEE,EAAW,MAAA;mCACrB,EAAA,MAAA,GAAA,EAAA,MAAA;;8CAEO,EAAA,EAAA,CAAA;;;;;;;;;;4GAcd,CAAC,CAAC,EAEN,CAAC"}
1
+ {"version":3,"file":"zsh-script-command.mjs","names":[],"sources":[],"mappings":""}
@@ -1,35 +1,83 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../helpers/complete-command.cjs`),t=require(`../helpers/completion-directive-constants.cjs`);require(`../helpers/index.cjs`);let n=require(`@alloy-js/core/jsx-runtime`),r=require(`@shell-shock/core/plugin-utils`),i=require(`@alloy-js/core`),a=require(`@alloy-js/typescript`),o=require(`@powerlines/plugin-alloy/core`),s=require(`@powerlines/plugin-alloy/core/contexts/context`),c=require(`@powerlines/plugin-alloy/typescript`),l=require(`@stryke/path`),u=require(`@stryke/string-format/snake-case`);function d(){let d=(0,s.usePowerlines)(),f=(0,i.computed)(()=>(0,r.getAppBin)(d)),p=(0,i.computed)(()=>(0,u.snakeCase)(f.value));return(0,n.createComponent)(c.TypescriptFile,{get path(){return(0,l.joinPaths)(d.entryPath,`completions`,`zsh`,`shared.ts`)},builtinImports:{console:[`white`,`green`,`red`,`bold`,`cyan`,`gray`,`magenta`,`magentaBright`,`greenBright`,`redBright`,`cyanBright`,`dim`]},get children(){return[(0,n.createComponent)(o.Spacing,{}),(0,n.createComponent)(a.VarDeclaration,{const:!0,export:!0,name:`SHELL_COMPLETIONS`,get initializer(){return i.code` \`__${p.value}_debug() {
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_helpers_complete_command = require('../helpers/complete-command.cjs');
3
+ const require_helpers_completion_directive_constants = require('../helpers/completion-directive-constants.cjs');
4
+ require('../helpers/index.cjs');
5
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
+ let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
7
+ let _alloy_js_core = require("@alloy-js/core");
8
+ let _alloy_js_typescript = require("@alloy-js/typescript");
9
+ let _powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
10
+ let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
11
+ let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
12
+ let _stryke_path = require("@stryke/path");
13
+ let _stryke_string_format_snake_case = require("@stryke/string-format/snake-case");
14
+
15
+ //#region src/components/zsh-shared.tsx
16
+ /**
17
+ * The Zsh Completions generation for the Shell Shock project.
18
+ */
19
+ function ZshCompletionsShared() {
20
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
21
+ const bin = (0, _alloy_js_core.computed)(() => (0, _shell_shock_core_plugin_utils.getAppBin)(context));
22
+ const name = (0, _alloy_js_core.computed)(() => (0, _stryke_string_format_snake_case.snakeCase)(bin.value));
23
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
24
+ get path() {
25
+ return (0, _stryke_path.joinPaths)(context.entryPath, "completions", "zsh", "shared.ts");
26
+ },
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
+ ] },
41
+ get children() {
42
+ return [
43
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
44
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
45
+ "const": true,
46
+ "export": true,
47
+ name: "SHELL_COMPLETIONS",
48
+ get initializer() {
49
+ return _alloy_js_core.code` \`__${name.value}_debug() {
2
50
  local file="$BASH_COMP_DEBUG_FILE"
3
51
  if [[ -n \\\${file} ]]; then
4
52
  echo "$*" >> "\\\${file}"
5
53
  fi
6
54
  }
7
55
 
8
- _${p.value}() {
9
- local shellCompDirectiveError=${t.CompletionDirective.CompletionDirectiveError}
10
- local shellCompDirectiveNoSpace=${t.CompletionDirective.CompletionDirectiveNoSpace}
11
- local shellCompDirectiveNoFileComp=${t.CompletionDirective.CompletionDirectiveNoFileComp}
12
- local shellCompDirectiveFilterFileExt=${t.CompletionDirective.CompletionDirectiveFilterFileExt}
13
- local shellCompDirectiveFilterDirs=${t.CompletionDirective.CompletionDirectiveFilterDirs}
14
- local shellCompDirectiveKeepOrder=${t.CompletionDirective.CompletionDirectiveKeepOrder}
56
+ _${name.value}() {
57
+ local shellCompDirectiveError=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveError}
58
+ local shellCompDirectiveNoSpace=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveNoSpace}
59
+ local shellCompDirectiveNoFileComp=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveNoFileComp}
60
+ local shellCompDirectiveFilterFileExt=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveFilterFileExt}
61
+ local shellCompDirectiveFilterDirs=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveFilterDirs}
62
+ local shellCompDirectiveKeepOrder=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveKeepOrder}
15
63
 
16
64
  local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
17
65
  local -a completions
18
66
 
19
- __${p.value}_debug "\\n========= starting completion logic =========="
20
- __${p.value}_debug "CURRENT: \\\${CURRENT}, words[*]: \\\${words[*]}"
67
+ __${name.value}_debug "\\n========= starting completion logic =========="
68
+ __${name.value}_debug "CURRENT: \\\${CURRENT}, words[*]: \\\${words[*]}"
21
69
 
22
70
  # The user could have moved the cursor backwards on the command-line.
23
71
  # We need to trigger completion from the $CURRENT location, so we need
24
72
  # to truncate the command-line ($words) up to the $CURRENT location.
25
73
  # (We cannot use $CURSOR as its value does not work when a command is an alias.)
26
74
  words=( "\\\${=words[1,CURRENT]}" )
27
- __${p.value}_debug "Truncated words[*]: \\\${words[*]},"
75
+ __${name.value}_debug "Truncated words[*]: \\\${words[*]},"
28
76
 
29
77
  lastParam=\\\${words[-1]}
30
78
  lastChar=\\\${lastParam[-1]}
31
- __${p.value}_debug "lastParam: \\\${lastParam}, lastChar: \\\${lastChar}"
32
- # For zsh, when completing a flag with an = (e.g., ${f.value} -n=<TAB>)
79
+ __${name.value}_debug "lastParam: \\\${lastParam}, lastChar: \\\${lastChar}"
80
+ # For zsh, when completing a flag with an = (e.g., ${bin.value} -n=<TAB>)
33
81
  # completions must be prefixed with the flag
34
82
  setopt local_options BASH_REMATCH
35
83
  if [[ "\\\${lastParam}" =~ '-.*=' ]]; then
@@ -42,7 +90,7 @@ _${p.value}() {
42
90
  if [ "\\\${lastChar}" = "" ]; then
43
91
  # If the last parameter is complete (there is a space following it)
44
92
  # We add an extra empty parameter so we can indicate this to the go completion code.
45
- __${p.value}_debug "Adding extra empty parameter"
93
+ __${name.value}_debug "Adding extra empty parameter"
46
94
  args_to_quote+=("")
47
95
  fi
48
96
 
@@ -50,20 +98,20 @@ _${p.value}() {
50
98
  local quoted_args=("\\\${(@q)args_to_quote}")
51
99
 
52
100
  # Join the main command and the quoted arguments into a single string for eval
53
- requestComp="${e.EXEC_COMMAND} complete -- \\\${quoted_args[*]}"
101
+ requestComp="${require_helpers_complete_command.EXEC_COMMAND} complete -- \\\${quoted_args[*]}"
54
102
 
55
- __${p.value}_debug "About to call: eval \\\${requestComp}"
103
+ __${name.value}_debug "About to call: eval \\\${requestComp}"
56
104
 
57
105
  # Use eval to handle any environment variables and such
58
106
  out=$(eval \\\${requestComp} 2>/dev/null)
59
- __${p.value}_debug "completion output: \\\${out}"
107
+ __${name.value}_debug "completion output: \\\${out}"
60
108
 
61
109
  # Extract the directive integer following a : from the last line
62
110
  local lastLine
63
111
  while IFS='\n' read -r line; do
64
112
  lastLine=\\\${line}
65
113
  done < <(printf "%s\n" "\\\${out[@]}")
66
- __${p.value}_debug "last line: \\\${lastLine}"
114
+ __${name.value}_debug "last line: \\\${lastLine}"
67
115
 
68
116
  if [ "\\\${lastLine[1]}" = : ]; then
69
117
  directive=\\\${lastLine[2,-1]}
@@ -73,16 +121,16 @@ _${p.value}() {
73
121
  out=\\\${out[1,-$suffix]}
74
122
  else
75
123
  # There is no directive specified. Leave $out as is.
76
- __${p.value}_debug "No directive found. Setting to default"
124
+ __${name.value}_debug "No directive found. Setting to default"
77
125
  directive=0
78
126
  fi
79
127
 
80
- __${p.value}_debug "directive: \\\${directive}"
81
- __${p.value}_debug "completions: \\\${out}"
82
- __${p.value}_debug "flagPrefix: \\\${flagPrefix}"
128
+ __${name.value}_debug "directive: \\\${directive}"
129
+ __${name.value}_debug "completions: \\\${out}"
130
+ __${name.value}_debug "flagPrefix: \\\${flagPrefix}"
83
131
 
84
132
  if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
85
- __${p.value}_debug "Completion received error. Ignoring completions."
133
+ __${name.value}_debug "Completion received error. Ignoring completions."
86
134
  return
87
135
  fi
88
136
 
@@ -93,11 +141,11 @@ _${p.value}() {
93
141
  while IFS='\n' read -r comp; do
94
142
  # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
95
143
  if [ "\\\${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
96
- __${p.value}_debug "ActiveHelp found: $comp"
144
+ __${name.value}_debug "ActiveHelp found: $comp"
97
145
  comp="\\\${comp[$startIndex,-1]}"
98
146
  if [ -n "$comp" ]; then
99
147
  compadd -x "\\\${comp}"
100
- __${p.value}_debug "ActiveHelp will need delimiter"
148
+ __${name.value}_debug "ActiveHelp will need delimiter"
101
149
  hasActiveHelp=1
102
150
  fi
103
151
  continue
@@ -113,7 +161,7 @@ _${p.value}() {
113
161
  local tab="$(printf '\\t')"
114
162
  comp=\\\${comp//$tab/:}
115
163
 
116
- __${p.value}_debug "Adding completion: \\\${comp}"
164
+ __${name.value}_debug "Adding completion: \\\${comp}"
117
165
  completions+=\\\${comp}
118
166
  lastComp=$comp
119
167
  fi
@@ -124,19 +172,19 @@ _${p.value}() {
124
172
  # - file completion will be performed (so there will be choices after the activeHelp)
125
173
  if [ $hasActiveHelp -eq 1 ]; then
126
174
  if [ \\\${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
127
- __${p.value}_debug "Adding activeHelp delimiter"
175
+ __${name.value}_debug "Adding activeHelp delimiter"
128
176
  compadd -x "--"
129
177
  hasActiveHelp=0
130
178
  fi
131
179
  fi
132
180
 
133
181
  if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
134
- __${p.value}_debug "Activating nospace."
182
+ __${name.value}_debug "Activating nospace."
135
183
  noSpace="-S ''"
136
184
  fi
137
185
 
138
186
  if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
139
- __${p.value}_debug "Activating keep order."
187
+ __${name.value}_debug "Activating keep order."
140
188
  keepOrder="-V"
141
189
  fi
142
190
 
@@ -153,17 +201,17 @@ _${p.value}() {
153
201
  done
154
202
  filteringCmd+=" \\\${flagPrefix}"
155
203
 
156
- __${p.value}_debug "File filtering command: $filteringCmd"
204
+ __${name.value}_debug "File filtering command: $filteringCmd"
157
205
  _arguments '*:filename:'"$filteringCmd"
158
206
  elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
159
207
  # File completion for directories only
160
208
  local subdir
161
209
  subdir="\\\${completions[1]}"
162
210
  if [ -n "$subdir" ]; then
163
- __${p.value}_debug "Listing directories in $subdir"
211
+ __${name.value}_debug "Listing directories in $subdir"
164
212
  pushd "\\\${subdir}" >/dev/null 2>&1
165
213
  else
166
- __${p.value}_debug "Listing directories in ."
214
+ __${name.value}_debug "Listing directories in ."
167
215
  fi
168
216
 
169
217
  local result
@@ -174,17 +222,17 @@ _${p.value}() {
174
222
  fi
175
223
  return $result
176
224
  else
177
- __${p.value}_debug "Calling _describe"
225
+ __${name.value}_debug "Calling _describe"
178
226
  if eval _describe $keepOrder "completions" completions -Q \\\${flagPrefix} \\\${noSpace}; then
179
- __${p.value}_debug "_describe found some completions"
227
+ __${name.value}_debug "_describe found some completions"
180
228
 
181
229
  # Return the success of having called _describe
182
230
  return 0
183
231
  else
184
- __${p.value}_debug "_describe did not find completions."
185
- __${p.value}_debug "Checking if we should do file completion."
232
+ __${name.value}_debug "_describe did not find completions."
233
+ __${name.value}_debug "Checking if we should do file completion."
186
234
  if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
187
- __${p.value}_debug "deactivating file completion"
235
+ __${name.value}_debug "deactivating file completion"
188
236
 
189
237
  # Return 0 to indicate completion is finished and prevent zsh from
190
238
  # trying other completion algorithms (which could cause hanging).
@@ -192,7 +240,7 @@ _${p.value}() {
192
240
  return 0
193
241
  else
194
242
  # Perform file completion
195
- __${p.value}_debug "Activating file completion"
243
+ __${name.value}_debug "Activating file completion"
196
244
 
197
245
  # We must return the result of this command, so it must be the
198
246
  # last command, or else we must store its result to return it.
@@ -203,10 +251,18 @@ _${p.value}() {
203
251
  }
204
252
 
205
253
  # don't run the completion function when being sourced or eval-ed
206
- if [ "\\\${funcstack[1]}" = "_${p.value}" ]; then
207
- _${p.value}
254
+ if [ "\\\${funcstack[1]}" = "_${name.value}" ]; then
255
+ _${name.value}
208
256
  fi
209
- \`; `}}),(0,n.createComponent)(o.Spacing,{}),(0,n.createComponent)(a.VarDeclaration,{export:!0,const:!0,name:`SHELL_COMPLETIONS_DISPLAY`,initializer:i.code` SHELL_COMPLETIONS.split("\\n").map(line => {
257
+ \`; `;
258
+ }
259
+ }),
260
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
261
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
262
+ "export": true,
263
+ "const": true,
264
+ name: "SHELL_COMPLETIONS_DISPLAY",
265
+ initializer: _alloy_js_core.code` SHELL_COMPLETIONS.split("\\n").map(line => {
210
266
  if (!line.trim()) {
211
267
  return "";
212
268
  }
@@ -227,4 +283,12 @@ fi
227
283
  .replaceAll(/__\\w/g, bold(magentaBright("$&")))
228
284
  .replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, bold(magenta("$&")));
229
285
 
230
- }).join("\\n"); `})]}})}exports.ZshCompletionsShared=d;
286
+ }).join("\\n"); `
287
+ })
288
+ ];
289
+ }
290
+ });
291
+ }
292
+
293
+ //#endregion
294
+ exports.ZshCompletionsShared = ZshCompletionsShared;
@@ -1,10 +1,8 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
-
3
1
  //#region src/components/zsh-shared.d.ts
4
2
  /**
5
3
  * The Zsh Completions generation for the Shell Shock project.
6
4
  */
7
- declare function ZshCompletionsShared(): _$_alloy_js_core0.Children;
5
+ declare function ZshCompletionsShared(): import("@alloy-js/core").Children;
8
6
  //#endregion
9
7
  export { ZshCompletionsShared };
10
8
  //# sourceMappingURL=zsh-shared.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zsh-shared.d.cts","names":[],"sources":["../../src/components/zsh-shared.tsx"],"mappings":";;;;;;iBAiCgB,oBAAA,CAAA,GAAoB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"zsh-shared.d.cts","names":[],"sources":["../../src/components/zsh-shared.tsx"],"mappings":";;AAiCA;;iBAAgB,oBAAA,6BAAoB,QAAA"}
@@ -1,10 +1,8 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
-
3
1
  //#region src/components/zsh-shared.d.ts
4
2
  /**
5
3
  * The Zsh Completions generation for the Shell Shock project.
6
4
  */
7
- declare function ZshCompletionsShared(): _$_alloy_js_core0.Children;
5
+ declare function ZshCompletionsShared(): import("@alloy-js/core").Children;
8
6
  //#endregion
9
7
  export { ZshCompletionsShared };
10
8
  //# sourceMappingURL=zsh-shared.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zsh-shared.d.mts","names":[],"sources":["../../src/components/zsh-shared.tsx"],"mappings":";;;;;;iBAiCgB,oBAAA,CAAA,GAAoB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"zsh-shared.d.mts","names":[],"sources":["../../src/components/zsh-shared.tsx"],"mappings":""}
@@ -1,35 +1,82 @@
1
- import{EXEC_COMMAND as e}from"../helpers/complete-command.mjs";import{CompletionDirective as t}from"../helpers/completion-directive-constants.mjs";import"../helpers/index.mjs";import{createComponent as n}from"@alloy-js/core/jsx-runtime";import{getAppBin as r}from"@shell-shock/core/plugin-utils";import{code as i,computed as a}from"@alloy-js/core";import{VarDeclaration as o}from"@alloy-js/typescript";import{Spacing as s}from"@powerlines/plugin-alloy/core";import{usePowerlines as c}from"@powerlines/plugin-alloy/core/contexts/context";import{TypescriptFile as l}from"@powerlines/plugin-alloy/typescript";import{joinPaths as u}from"@stryke/path";import{snakeCase as d}from"@stryke/string-format/snake-case";function f(){let f=c(),p=a(()=>r(f)),m=a(()=>d(p.value));return n(l,{get path(){return u(f.entryPath,`completions`,`zsh`,`shared.ts`)},builtinImports:{console:[`white`,`green`,`red`,`bold`,`cyan`,`gray`,`magenta`,`magentaBright`,`greenBright`,`redBright`,`cyanBright`,`dim`]},get children(){return[n(s,{}),n(o,{const:!0,export:!0,name:`SHELL_COMPLETIONS`,get initializer(){return i` \`__${m.value}_debug() {
1
+ import { EXEC_COMMAND } from "../helpers/complete-command.mjs";
2
+ import { CompletionDirective } from "../helpers/completion-directive-constants.mjs";
3
+ import "../helpers/index.mjs";
4
+ import { createComponent } from "@alloy-js/core/jsx-runtime";
5
+ import { getAppBin } from "@shell-shock/core/plugin-utils";
6
+ import { code, computed } from "@alloy-js/core";
7
+ import { VarDeclaration } from "@alloy-js/typescript";
8
+ import { Spacing } from "@powerlines/plugin-alloy/core";
9
+ import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
10
+ import { TypescriptFile } from "@powerlines/plugin-alloy/typescript";
11
+ import { joinPaths } from "@stryke/path";
12
+ import { snakeCase } from "@stryke/string-format/snake-case";
13
+
14
+ //#region src/components/zsh-shared.tsx
15
+ /**
16
+ * The Zsh Completions generation for the Shell Shock project.
17
+ */
18
+ function ZshCompletionsShared() {
19
+ const context = usePowerlines();
20
+ const bin = computed(() => getAppBin(context));
21
+ const name = computed(() => snakeCase(bin.value));
22
+ return createComponent(TypescriptFile, {
23
+ get path() {
24
+ return joinPaths(context.entryPath, "completions", "zsh", "shared.ts");
25
+ },
26
+ builtinImports: { console: [
27
+ "white",
28
+ "green",
29
+ "red",
30
+ "bold",
31
+ "cyan",
32
+ "gray",
33
+ "magenta",
34
+ "magentaBright",
35
+ "greenBright",
36
+ "redBright",
37
+ "cyanBright",
38
+ "dim"
39
+ ] },
40
+ get children() {
41
+ return [
42
+ createComponent(Spacing, {}),
43
+ createComponent(VarDeclaration, {
44
+ "const": true,
45
+ "export": true,
46
+ name: "SHELL_COMPLETIONS",
47
+ get initializer() {
48
+ return code` \`__${name.value}_debug() {
2
49
  local file="$BASH_COMP_DEBUG_FILE"
3
50
  if [[ -n \\\${file} ]]; then
4
51
  echo "$*" >> "\\\${file}"
5
52
  fi
6
53
  }
7
54
 
8
- _${m.value}() {
9
- local shellCompDirectiveError=${t.CompletionDirectiveError}
10
- local shellCompDirectiveNoSpace=${t.CompletionDirectiveNoSpace}
11
- local shellCompDirectiveNoFileComp=${t.CompletionDirectiveNoFileComp}
12
- local shellCompDirectiveFilterFileExt=${t.CompletionDirectiveFilterFileExt}
13
- local shellCompDirectiveFilterDirs=${t.CompletionDirectiveFilterDirs}
14
- local shellCompDirectiveKeepOrder=${t.CompletionDirectiveKeepOrder}
55
+ _${name.value}() {
56
+ local shellCompDirectiveError=${CompletionDirective.CompletionDirectiveError}
57
+ local shellCompDirectiveNoSpace=${CompletionDirective.CompletionDirectiveNoSpace}
58
+ local shellCompDirectiveNoFileComp=${CompletionDirective.CompletionDirectiveNoFileComp}
59
+ local shellCompDirectiveFilterFileExt=${CompletionDirective.CompletionDirectiveFilterFileExt}
60
+ local shellCompDirectiveFilterDirs=${CompletionDirective.CompletionDirectiveFilterDirs}
61
+ local shellCompDirectiveKeepOrder=${CompletionDirective.CompletionDirectiveKeepOrder}
15
62
 
16
63
  local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
17
64
  local -a completions
18
65
 
19
- __${m.value}_debug "\\n========= starting completion logic =========="
20
- __${m.value}_debug "CURRENT: \\\${CURRENT}, words[*]: \\\${words[*]}"
66
+ __${name.value}_debug "\\n========= starting completion logic =========="
67
+ __${name.value}_debug "CURRENT: \\\${CURRENT}, words[*]: \\\${words[*]}"
21
68
 
22
69
  # The user could have moved the cursor backwards on the command-line.
23
70
  # We need to trigger completion from the $CURRENT location, so we need
24
71
  # to truncate the command-line ($words) up to the $CURRENT location.
25
72
  # (We cannot use $CURSOR as its value does not work when a command is an alias.)
26
73
  words=( "\\\${=words[1,CURRENT]}" )
27
- __${m.value}_debug "Truncated words[*]: \\\${words[*]},"
74
+ __${name.value}_debug "Truncated words[*]: \\\${words[*]},"
28
75
 
29
76
  lastParam=\\\${words[-1]}
30
77
  lastChar=\\\${lastParam[-1]}
31
- __${m.value}_debug "lastParam: \\\${lastParam}, lastChar: \\\${lastChar}"
32
- # For zsh, when completing a flag with an = (e.g., ${p.value} -n=<TAB>)
78
+ __${name.value}_debug "lastParam: \\\${lastParam}, lastChar: \\\${lastChar}"
79
+ # For zsh, when completing a flag with an = (e.g., ${bin.value} -n=<TAB>)
33
80
  # completions must be prefixed with the flag
34
81
  setopt local_options BASH_REMATCH
35
82
  if [[ "\\\${lastParam}" =~ '-.*=' ]]; then
@@ -42,7 +89,7 @@ _${m.value}() {
42
89
  if [ "\\\${lastChar}" = "" ]; then
43
90
  # If the last parameter is complete (there is a space following it)
44
91
  # We add an extra empty parameter so we can indicate this to the go completion code.
45
- __${m.value}_debug "Adding extra empty parameter"
92
+ __${name.value}_debug "Adding extra empty parameter"
46
93
  args_to_quote+=("")
47
94
  fi
48
95
 
@@ -50,20 +97,20 @@ _${m.value}() {
50
97
  local quoted_args=("\\\${(@q)args_to_quote}")
51
98
 
52
99
  # Join the main command and the quoted arguments into a single string for eval
53
- requestComp="${e} complete -- \\\${quoted_args[*]}"
100
+ requestComp="${EXEC_COMMAND} complete -- \\\${quoted_args[*]}"
54
101
 
55
- __${m.value}_debug "About to call: eval \\\${requestComp}"
102
+ __${name.value}_debug "About to call: eval \\\${requestComp}"
56
103
 
57
104
  # Use eval to handle any environment variables and such
58
105
  out=$(eval \\\${requestComp} 2>/dev/null)
59
- __${m.value}_debug "completion output: \\\${out}"
106
+ __${name.value}_debug "completion output: \\\${out}"
60
107
 
61
108
  # Extract the directive integer following a : from the last line
62
109
  local lastLine
63
110
  while IFS='\n' read -r line; do
64
111
  lastLine=\\\${line}
65
112
  done < <(printf "%s\n" "\\\${out[@]}")
66
- __${m.value}_debug "last line: \\\${lastLine}"
113
+ __${name.value}_debug "last line: \\\${lastLine}"
67
114
 
68
115
  if [ "\\\${lastLine[1]}" = : ]; then
69
116
  directive=\\\${lastLine[2,-1]}
@@ -73,16 +120,16 @@ _${m.value}() {
73
120
  out=\\\${out[1,-$suffix]}
74
121
  else
75
122
  # There is no directive specified. Leave $out as is.
76
- __${m.value}_debug "No directive found. Setting to default"
123
+ __${name.value}_debug "No directive found. Setting to default"
77
124
  directive=0
78
125
  fi
79
126
 
80
- __${m.value}_debug "directive: \\\${directive}"
81
- __${m.value}_debug "completions: \\\${out}"
82
- __${m.value}_debug "flagPrefix: \\\${flagPrefix}"
127
+ __${name.value}_debug "directive: \\\${directive}"
128
+ __${name.value}_debug "completions: \\\${out}"
129
+ __${name.value}_debug "flagPrefix: \\\${flagPrefix}"
83
130
 
84
131
  if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
85
- __${m.value}_debug "Completion received error. Ignoring completions."
132
+ __${name.value}_debug "Completion received error. Ignoring completions."
86
133
  return
87
134
  fi
88
135
 
@@ -93,11 +140,11 @@ _${m.value}() {
93
140
  while IFS='\n' read -r comp; do
94
141
  # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
95
142
  if [ "\\\${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
96
- __${m.value}_debug "ActiveHelp found: $comp"
143
+ __${name.value}_debug "ActiveHelp found: $comp"
97
144
  comp="\\\${comp[$startIndex,-1]}"
98
145
  if [ -n "$comp" ]; then
99
146
  compadd -x "\\\${comp}"
100
- __${m.value}_debug "ActiveHelp will need delimiter"
147
+ __${name.value}_debug "ActiveHelp will need delimiter"
101
148
  hasActiveHelp=1
102
149
  fi
103
150
  continue
@@ -113,7 +160,7 @@ _${m.value}() {
113
160
  local tab="$(printf '\\t')"
114
161
  comp=\\\${comp//$tab/:}
115
162
 
116
- __${m.value}_debug "Adding completion: \\\${comp}"
163
+ __${name.value}_debug "Adding completion: \\\${comp}"
117
164
  completions+=\\\${comp}
118
165
  lastComp=$comp
119
166
  fi
@@ -124,19 +171,19 @@ _${m.value}() {
124
171
  # - file completion will be performed (so there will be choices after the activeHelp)
125
172
  if [ $hasActiveHelp -eq 1 ]; then
126
173
  if [ \\\${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
127
- __${m.value}_debug "Adding activeHelp delimiter"
174
+ __${name.value}_debug "Adding activeHelp delimiter"
128
175
  compadd -x "--"
129
176
  hasActiveHelp=0
130
177
  fi
131
178
  fi
132
179
 
133
180
  if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
134
- __${m.value}_debug "Activating nospace."
181
+ __${name.value}_debug "Activating nospace."
135
182
  noSpace="-S ''"
136
183
  fi
137
184
 
138
185
  if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
139
- __${m.value}_debug "Activating keep order."
186
+ __${name.value}_debug "Activating keep order."
140
187
  keepOrder="-V"
141
188
  fi
142
189
 
@@ -153,17 +200,17 @@ _${m.value}() {
153
200
  done
154
201
  filteringCmd+=" \\\${flagPrefix}"
155
202
 
156
- __${m.value}_debug "File filtering command: $filteringCmd"
203
+ __${name.value}_debug "File filtering command: $filteringCmd"
157
204
  _arguments '*:filename:'"$filteringCmd"
158
205
  elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
159
206
  # File completion for directories only
160
207
  local subdir
161
208
  subdir="\\\${completions[1]}"
162
209
  if [ -n "$subdir" ]; then
163
- __${m.value}_debug "Listing directories in $subdir"
210
+ __${name.value}_debug "Listing directories in $subdir"
164
211
  pushd "\\\${subdir}" >/dev/null 2>&1
165
212
  else
166
- __${m.value}_debug "Listing directories in ."
213
+ __${name.value}_debug "Listing directories in ."
167
214
  fi
168
215
 
169
216
  local result
@@ -174,17 +221,17 @@ _${m.value}() {
174
221
  fi
175
222
  return $result
176
223
  else
177
- __${m.value}_debug "Calling _describe"
224
+ __${name.value}_debug "Calling _describe"
178
225
  if eval _describe $keepOrder "completions" completions -Q \\\${flagPrefix} \\\${noSpace}; then
179
- __${m.value}_debug "_describe found some completions"
226
+ __${name.value}_debug "_describe found some completions"
180
227
 
181
228
  # Return the success of having called _describe
182
229
  return 0
183
230
  else
184
- __${m.value}_debug "_describe did not find completions."
185
- __${m.value}_debug "Checking if we should do file completion."
231
+ __${name.value}_debug "_describe did not find completions."
232
+ __${name.value}_debug "Checking if we should do file completion."
186
233
  if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
187
- __${m.value}_debug "deactivating file completion"
234
+ __${name.value}_debug "deactivating file completion"
188
235
 
189
236
  # Return 0 to indicate completion is finished and prevent zsh from
190
237
  # trying other completion algorithms (which could cause hanging).
@@ -192,7 +239,7 @@ _${m.value}() {
192
239
  return 0
193
240
  else
194
241
  # Perform file completion
195
- __${m.value}_debug "Activating file completion"
242
+ __${name.value}_debug "Activating file completion"
196
243
 
197
244
  # We must return the result of this command, so it must be the
198
245
  # last command, or else we must store its result to return it.
@@ -203,10 +250,18 @@ _${m.value}() {
203
250
  }
204
251
 
205
252
  # don't run the completion function when being sourced or eval-ed
206
- if [ "\\\${funcstack[1]}" = "_${m.value}" ]; then
207
- _${m.value}
253
+ if [ "\\\${funcstack[1]}" = "_${name.value}" ]; then
254
+ _${name.value}
208
255
  fi
209
- \`; `}}),n(s,{}),n(o,{export:!0,const:!0,name:`SHELL_COMPLETIONS_DISPLAY`,initializer:i` SHELL_COMPLETIONS.split("\\n").map(line => {
256
+ \`; `;
257
+ }
258
+ }),
259
+ createComponent(Spacing, {}),
260
+ createComponent(VarDeclaration, {
261
+ "export": true,
262
+ "const": true,
263
+ name: "SHELL_COMPLETIONS_DISPLAY",
264
+ initializer: code` SHELL_COMPLETIONS.split("\\n").map(line => {
210
265
  if (!line.trim()) {
211
266
  return "";
212
267
  }
@@ -227,5 +282,13 @@ fi
227
282
  .replaceAll(/__\\w/g, bold(magentaBright("$&")))
228
283
  .replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, bold(magenta("$&")));
229
284
 
230
- }).join("\\n"); `})]}})}export{f as ZshCompletionsShared};
285
+ }).join("\\n"); `
286
+ })
287
+ ];
288
+ }
289
+ });
290
+ }
291
+
292
+ //#endregion
293
+ export { ZshCompletionsShared };
231
294
  //# sourceMappingURL=zsh-shared.mjs.map