@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":"bash-script-command.mjs","names":[],"sources":["../../src/components/bash-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 Bash Completions - Script command's handler wrapper for the Shell Shock project.\n */\nexport function BashScriptCompletionsCommand() {\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 \"bash\",\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 Bash Completions - Script command.\" />\n <InterfaceDeclaration export name=\"BashScriptCompletionsOptions\">\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 bash script\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"BashScriptCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"./${bin.value}-completions.bash\"`\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}.bash\\` : path;`}\n />\n {code`\n await writeFile(scriptPath, \\`# Bash script to add completions for ${getAppTitle(context)}\\\\n\\\\n\\${SHELL_COMPLETIONS}\\`);\n\n success(\\`${getAppTitle(\n context\n )} Bash completion script has been generated at \\${bold(scriptPath)}.\\`); `}\n </IfStatement>\n <ElseClause>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(\"\");\n writeLine(\\`# Bash 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., ~/.bashrc)\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":"gwBA+BA,SAAE,GAAA,CACA,IAAM,EAAC,GAAwB,CAC1B,EAAA,MAAA,EAAA,EAAA,CAAA,CACL,OAAK,EAAA,EAAA,CACL,IAAA,MAAA,CACI,OAAG,EAAW,EAAO,UAAM,cAAsB,OAAM,SAAA,aAAA,EAE7D,QAAS,CACH,UAAQ,0BAEZ,mBAAA,CAAA,WAAA,YAAA,CACI,YAAM,CAAA,oBAA6B,4BAA0B,CACjE,CACF,eAAgB,CACd,QAAa,CAAC,OAAE,YAAc,UAAA,OAAwB,OAAG,CAAA,CAEzD,IAAM,UAAM,aAEN,QAAC,qDACJ,CAAA,CAAA,EAAA,EAAA,CACC,OAAM,GACJ,KAAA,+BACA,IAAC,UAAY,CACZ,MAAK,CAAA,EAAA,EAAA,CACL,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,+DACV,CAAC,CAAE,EAAgB,EAAK,CACvB,OAAG,GACH,QAAO,GACP,MAAC,GACD,KAAA,UACD,IAAA,YAAS,CACT,MAAM,CAAA,CACN,KAAA,UACC,KAAA,+BACA,QAAA,KACA,CAAA,CACI,KAAE,OACN,KAAU,SACR,QAAA,MAAA,EAAA,MAAA,oBACC,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,kDACrB,CAAA,CAAA,MAAA,CAAA;+EACC,EAAA,EAAA,CAAA;;sBAEM,EAAM,EAAA,CAAA,0EAAA,CAAA,EAEb,CAAA,CAAA,EAAA,EAAA,CACA,IAAI,UAAA,CACL,MAAM,EAAS;;gDAEQ,EAAA,EAAA,CAAA;;;;;;;;;;4GAc1B,CAAC,CAAC,EAEN,CAAC"}
1
+ {"version":3,"file":"bash-script-command.mjs","names":[],"sources":[],"mappings":""}
@@ -1,27 +1,75 @@
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`,`bash`,`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,{export:!0,const:!0,name:`SHELL_COMPLETIONS`,get initializer(){return i.code` \`# Define shell completion directives
2
- readonly ShellCompDirectiveError=${t.CompletionDirective.CompletionDirectiveError}
3
- readonly ShellCompDirectiveNoSpace=${t.CompletionDirective.CompletionDirectiveNoSpace}
4
- readonly ShellCompDirectiveNoFileComp=${t.CompletionDirective.CompletionDirectiveNoFileComp}
5
- readonly ShellCompDirectiveFilterFileExt=${t.CompletionDirective.CompletionDirectiveFilterFileExt}
6
- readonly ShellCompDirectiveFilterDirs=${t.CompletionDirective.CompletionDirectiveFilterDirs}
7
- readonly ShellCompDirectiveKeepOrder=${t.CompletionDirective.CompletionDirectiveKeepOrder}
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/bash-shared.tsx
16
+ /**
17
+ * The Bash Completions generation for the Shell Shock project.
18
+ */
19
+ function BashCompletionsShared() {
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", "bash", "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
+ "export": true,
46
+ "const": true,
47
+ name: "SHELL_COMPLETIONS",
48
+ get initializer() {
49
+ return _alloy_js_core.code` \`# Define shell completion directives
50
+ readonly ShellCompDirectiveError=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveError}
51
+ readonly ShellCompDirectiveNoSpace=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveNoSpace}
52
+ readonly ShellCompDirectiveNoFileComp=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveNoFileComp}
53
+ readonly ShellCompDirectiveFilterFileExt=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveFilterFileExt}
54
+ readonly ShellCompDirectiveFilterDirs=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveFilterDirs}
55
+ readonly ShellCompDirectiveKeepOrder=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveKeepOrder}
8
56
 
9
57
  # Function to debug completion
10
- __${p.value}_debug() {
58
+ __${name.value}_debug() {
11
59
  if [[ -n \\\${BASH_COMP_DEBUG_FILE:-} ]]; then
12
60
  echo "$*" >> "\\\${BASH_COMP_DEBUG_FILE}"
13
61
  fi
14
62
  }
15
63
 
16
64
  # Function to handle completions
17
- __${p.value}_complete() {
65
+ __${name.value}_complete() {
18
66
  local cur prev words cword
19
67
  _get_comp_words_by_ref -n "=:" cur prev words cword
20
68
 
21
69
  local requestComp out directive
22
70
 
23
71
  # Build the command to get completions
24
- requestComp="${e.EXEC_COMMAND} complete -- \\\${words[@]:1}"
72
+ requestComp="${require_helpers_complete_command.EXEC_COMMAND} complete -- \\\${words[@]:1}"
25
73
 
26
74
  # Add an empty parameter if the last parameter is complete
27
75
  if [[ -z "$cur" ]]; then
@@ -96,8 +144,16 @@ __${p.value}_complete() {
96
144
  }
97
145
 
98
146
  # Register completion function
99
- complete -F __${p.value}_complete ${f.value}
100
- \`; `}}),(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 => {
147
+ complete -F __${name.value}_complete ${bin.value}
148
+ \`; `;
149
+ }
150
+ }),
151
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
152
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
153
+ "export": true,
154
+ "const": true,
155
+ name: "SHELL_COMPLETIONS_DISPLAY",
156
+ initializer: _alloy_js_core.code` SHELL_COMPLETIONS.split("\\n").map(line => {
101
157
  if (!line.trim()) {
102
158
  return "";
103
159
  }
@@ -118,4 +174,12 @@ complete -F __${p.value}_complete ${f.value}
118
174
  .replaceAll(/__\\w/g, bold(magentaBright("$&")))
119
175
  .replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, bold(magenta("$&")));
120
176
 
121
- }).join("\\n"); `})]}})}exports.BashCompletionsShared=d;
177
+ }).join("\\n"); `
178
+ })
179
+ ];
180
+ }
181
+ });
182
+ }
183
+
184
+ //#endregion
185
+ exports.BashCompletionsShared = BashCompletionsShared;
@@ -1,10 +1,8 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
-
3
1
  //#region src/components/bash-shared.d.ts
4
2
  /**
5
3
  * The Bash Completions generation for the Shell Shock project.
6
4
  */
7
- declare function BashCompletionsShared(): _$_alloy_js_core0.Children;
5
+ declare function BashCompletionsShared(): import("@alloy-js/core").Children;
8
6
  //#endregion
9
7
  export { BashCompletionsShared };
10
8
  //# sourceMappingURL=bash-shared.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bash-shared.d.cts","names":[],"sources":["../../src/components/bash-shared.tsx"],"mappings":";;;;;;iBAiCgB,qBAAA,CAAA,GAAqB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"bash-shared.d.cts","names":[],"sources":["../../src/components/bash-shared.tsx"],"mappings":";;AAiCA;;iBAAgB,qBAAA,6BAAqB,QAAA"}
@@ -1,10 +1,8 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
-
3
1
  //#region src/components/bash-shared.d.ts
4
2
  /**
5
3
  * The Bash Completions generation for the Shell Shock project.
6
4
  */
7
- declare function BashCompletionsShared(): _$_alloy_js_core0.Children;
5
+ declare function BashCompletionsShared(): import("@alloy-js/core").Children;
8
6
  //#endregion
9
7
  export { BashCompletionsShared };
10
8
  //# sourceMappingURL=bash-shared.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bash-shared.d.mts","names":[],"sources":["../../src/components/bash-shared.tsx"],"mappings":";;;;;;iBAiCgB,qBAAA,CAAA,GAAqB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"bash-shared.d.mts","names":[],"sources":["../../src/components/bash-shared.tsx"],"mappings":""}
@@ -1,27 +1,74 @@
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`,`bash`,`shared.ts`)},builtinImports:{console:[`white`,`green`,`red`,`bold`,`cyan`,`gray`,`magenta`,`magentaBright`,`greenBright`,`redBright`,`cyanBright`,`dim`]},get children(){return[n(s,{}),n(o,{export:!0,const:!0,name:`SHELL_COMPLETIONS`,get initializer(){return i` \`# Define shell completion directives
2
- readonly ShellCompDirectiveError=${t.CompletionDirectiveError}
3
- readonly ShellCompDirectiveNoSpace=${t.CompletionDirectiveNoSpace}
4
- readonly ShellCompDirectiveNoFileComp=${t.CompletionDirectiveNoFileComp}
5
- readonly ShellCompDirectiveFilterFileExt=${t.CompletionDirectiveFilterFileExt}
6
- readonly ShellCompDirectiveFilterDirs=${t.CompletionDirectiveFilterDirs}
7
- readonly ShellCompDirectiveKeepOrder=${t.CompletionDirectiveKeepOrder}
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/bash-shared.tsx
15
+ /**
16
+ * The Bash Completions generation for the Shell Shock project.
17
+ */
18
+ function BashCompletionsShared() {
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", "bash", "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
+ "export": true,
45
+ "const": true,
46
+ name: "SHELL_COMPLETIONS",
47
+ get initializer() {
48
+ return code` \`# Define shell completion directives
49
+ readonly ShellCompDirectiveError=${CompletionDirective.CompletionDirectiveError}
50
+ readonly ShellCompDirectiveNoSpace=${CompletionDirective.CompletionDirectiveNoSpace}
51
+ readonly ShellCompDirectiveNoFileComp=${CompletionDirective.CompletionDirectiveNoFileComp}
52
+ readonly ShellCompDirectiveFilterFileExt=${CompletionDirective.CompletionDirectiveFilterFileExt}
53
+ readonly ShellCompDirectiveFilterDirs=${CompletionDirective.CompletionDirectiveFilterDirs}
54
+ readonly ShellCompDirectiveKeepOrder=${CompletionDirective.CompletionDirectiveKeepOrder}
8
55
 
9
56
  # Function to debug completion
10
- __${m.value}_debug() {
57
+ __${name.value}_debug() {
11
58
  if [[ -n \\\${BASH_COMP_DEBUG_FILE:-} ]]; then
12
59
  echo "$*" >> "\\\${BASH_COMP_DEBUG_FILE}"
13
60
  fi
14
61
  }
15
62
 
16
63
  # Function to handle completions
17
- __${m.value}_complete() {
64
+ __${name.value}_complete() {
18
65
  local cur prev words cword
19
66
  _get_comp_words_by_ref -n "=:" cur prev words cword
20
67
 
21
68
  local requestComp out directive
22
69
 
23
70
  # Build the command to get completions
24
- requestComp="${e} complete -- \\\${words[@]:1}"
71
+ requestComp="${EXEC_COMMAND} complete -- \\\${words[@]:1}"
25
72
 
26
73
  # Add an empty parameter if the last parameter is complete
27
74
  if [[ -z "$cur" ]]; then
@@ -96,8 +143,16 @@ __${m.value}_complete() {
96
143
  }
97
144
 
98
145
  # Register completion function
99
- complete -F __${m.value}_complete ${p.value}
100
- \`; `}}),n(s,{}),n(o,{export:!0,const:!0,name:`SHELL_COMPLETIONS_DISPLAY`,initializer:i` SHELL_COMPLETIONS.split("\\n").map(line => {
146
+ complete -F __${name.value}_complete ${bin.value}
147
+ \`; `;
148
+ }
149
+ }),
150
+ createComponent(Spacing, {}),
151
+ createComponent(VarDeclaration, {
152
+ "export": true,
153
+ "const": true,
154
+ name: "SHELL_COMPLETIONS_DISPLAY",
155
+ initializer: code` SHELL_COMPLETIONS.split("\\n").map(line => {
101
156
  if (!line.trim()) {
102
157
  return "";
103
158
  }
@@ -118,5 +173,13 @@ complete -F __${m.value}_complete ${p.value}
118
173
  .replaceAll(/__\\w/g, bold(magentaBright("$&")))
119
174
  .replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, bold(magenta("$&")));
120
175
 
121
- }).join("\\n"); `})]}})}export{f as BashCompletionsShared};
176
+ }).join("\\n"); `
177
+ })
178
+ ];
179
+ }
180
+ });
181
+ }
182
+
183
+ //#endregion
184
+ export { BashCompletionsShared };
122
185
  //# sourceMappingURL=bash-shared.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"bash-shared.mjs","names":[],"sources":["../../src/components/bash-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 Bash Completions generation for the Shell Shock project.\n */\nexport function BashCompletionsShared() {\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\", \"bash\", \"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 export\n const\n name=\"SHELL_COMPLETIONS\"\n initializer={code` \\`# Define shell completion directives\nreadonly ShellCompDirectiveError=${CompletionDirective.CompletionDirectiveError}\nreadonly ShellCompDirectiveNoSpace=${\n CompletionDirective.CompletionDirectiveNoSpace\n }\nreadonly ShellCompDirectiveNoFileComp=${\n CompletionDirective.CompletionDirectiveNoFileComp\n }\nreadonly ShellCompDirectiveFilterFileExt=${\n CompletionDirective.CompletionDirectiveFilterFileExt\n }\nreadonly ShellCompDirectiveFilterDirs=${\n CompletionDirective.CompletionDirectiveFilterDirs\n }\nreadonly ShellCompDirectiveKeepOrder=${\n CompletionDirective.CompletionDirectiveKeepOrder\n }\n\n# Function to debug completion\n__${name.value}_debug() {\n if [[ -n \\\\\\${BASH_COMP_DEBUG_FILE:-} ]]; then\n echo \"$*\" >> \"\\\\\\${BASH_COMP_DEBUG_FILE}\"\n fi\n}\n\n# Function to handle completions\n__${name.value}_complete() {\n local cur prev words cword\n _get_comp_words_by_ref -n \"=:\" cur prev words cword\n\n local requestComp out directive\n\n # Build the command to get completions\n requestComp=\"${EXEC_COMMAND} complete -- \\\\\\${words[@]:1}\"\n\n # Add an empty parameter if the last parameter is complete\n if [[ -z \"$cur\" ]]; then\n requestComp=\"$requestComp ''\"\n fi\n\n # Get completions from the program\n out=$(eval \"$requestComp\" 2>/dev/null)\n\n # Extract directive if present\n directive=0\n if [[ \"$out\" == *:* ]]; then\n directive=\\\\\\${out##*:}\n out=\\\\\\${out%:*}\n fi\n\n # Process completions based on directive\n if [[ $((directive & $ShellCompDirectiveError)) -ne 0 ]]; then\n # Error, no completion\n return\n fi\n\n # Apply directives\n if [[ $((directive & $ShellCompDirectiveNoSpace)) -ne 0 ]]; then\n compopt -o nospace\n fi\n if [[ $((directive & $ShellCompDirectiveKeepOrder)) -ne 0 ]]; then\n compopt -o nosort\n fi\n if [[ $((directive & $ShellCompDirectiveNoFileComp)) -ne 0 ]]; then\n compopt +o default\n fi\n\n # Handle file extension filtering\n if [[ $((directive & $ShellCompDirectiveFilterFileExt)) -ne 0 ]]; then\n local filter=\"\"\n for ext in $out; do\n filter=\"$filter|$ext\"\n done\n filter=\"\\\\.($filter)\"\n compopt -o filenames\n COMPREPLY=( $(compgen -f -X \"!$filter\" -- \"$cur\") )\n return\n fi\n\n # Handle directory filtering\n if [[ $((directive & $ShellCompDirectiveFilterDirs)) -ne 0 ]]; then\n compopt -o dirnames\n COMPREPLY=( $(compgen -d -- \"$cur\") )\n return\n fi\n\n # Process completions\n local IFS=$'\\\\n'\n local tab=$(printf '\\\\t')\n\n # Parse completions with descriptions\n local completions=()\n while read -r comp; do\n if [[ \"$comp\" == *$tab* ]]; then\n # Split completion and description\n local value=\\\\\\${comp%%$tab*}\n local desc=\\\\\\${comp#*$tab}\n completions+=(\"$value\")\n else\n completions+=(\"$comp\")\n fi\n done <<< \"$out\"\n\n # Return completions\n COMPREPLY=( $(compgen -W \"\\\\\\${completions[*]}\" -- \"$cur\") )\n}\n\n# Register completion function\ncomplete -F __${name.value}_complete ${bin.value}\n\\`; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"SHELL_COMPLETIONS_DISPLAY\"\n initializer={code` SHELL_COMPLETIONS.split(\"\\\\n\").map(line => {\n if (!line.trim()) {\n return \"\";\n }\n if (line.trim().startsWith(\"#\")) {\n return \\`\\${dim(line)}\\`;\n }\n\n return white(line).replaceAll(/(?<=\\\\\\$(\\\\{|\\\\()).*(?=(\\\\}\\\\)))/g, green(\"$&\"))\n .replaceAll(/\\\\\".*\\\\\"/g, cyan(\"$&\"))\n .replaceAll(/(\\\\[|\\\\]|\\\\(|\\\\)|\\\\||<|>|\\\\$\\\\(|\\\\$?\\\\{|\\\\}|\\\\+|=|;|:)/g, bold(gray(\"$&\")))\n .replaceAll(/(readonly|complete)\\\\s+/g, green(\"$&\"))\n .replaceAll(/(?<=(readonly|complete)\\\\s+)\\\\w/g, bold(greenBright(\"$&\")))\n .replaceAll(/local\\\\s+/g, red(\"$&\"))\n .replaceAll(/(?<=local\\\\s+)\\\\w/g, bold(redBright(\"$&\")))\n .replaceAll(/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":"osBAgCA,SAAE,GAAA,CACF,IAAO,EAAS,GAAA,CACR,EAAA,MAAU,EAAc,EAAA,CAAA,qBAE9B,OAAM,EAAmB,EAAY,CACrC,IAAM,MAAO,yDAGX,eAAC,CACC,QAAM,CAAA,QAAU,QAAQ,MAAW,OAAC,OAAe,OAAQ,UAAW,gBAAA,cAAA,YAAA,aAAA,MAAA,CACvE,CACD,IAAI,UAAS,CACX,MAAK,CAAA,EAAM,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACT,OAAS,GACT,MAAO,GACP,KAAG,oBACH,IAAG,aAAK,CACN,MAAM,EAAA;mCACG,EAAA,yBAAA;qCACM,EAAA,2BAAA;wCACF,EAAA,8BAAA;2CACF,EAAA,iCAAA;wCACC,EAAA,8BAAA;uCACR,EAAA,6BAAA;;;IAGV,EAAG,MAAQ;;;;;;;IAOf,EAAS,MAAA;;;;;;;mBAOC,EAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA2E1B,EAAA,MAAA,YAAA,EAAA,MAAA;OAGA,CAAA,CAAM,EAAS,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACf,OAAY,YAEV,KAAM,4BACR,YAAiB,CAAE;;;;;;;;;;;;;;;;;;;;;0BAsBhB,CAAC,CAAA,EAEL,CAAC"}
1
+ {"version":3,"file":"bash-shared.mjs","names":[],"sources":[],"mappings":""}
@@ -1,4 +1,100 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@shell-shock/core/plugin-utils`),n=require(`@alloy-js/core`),r=require(`@alloy-js/typescript`),i=require(`@powerlines/deepkit/vendor/type`),a=require(`@powerlines/plugin-alloy/core`),o=require(`@powerlines/plugin-alloy/core/contexts/context`),s=require(`@powerlines/plugin-alloy/typescript`),c=require(`@stryke/path`),l=require(`@powerlines/plugin-alloy/typescript/components/typescript-file`);function u(){let u=(0,o.usePowerlines)();return(0,e.createComponent)(l.TypescriptFile,{get path(){return(0,c.joinPaths)(u.entryPath,`completions`,`fish`,`config`,`command.ts`)},imports:{"node:os":`os`,"node:path":[`join`],"node:fs/promises":[`readFile`,`writeFile`],"../shared":[`SHELL_COMPLETIONS`,`SHELL_COMPLETIONS_DISPLAY`]},builtinImports:{console:[`bold`,`inlineCode`,`writeLine`,`success`,`warn`,`help`]},get children(){return[(0,e.createComponent)(s.TSDoc,{heading:`Options for the Fish Completions - Configuration command.`}),(0,e.createComponent)(r.InterfaceDeclaration,{export:!0,name:`FishConfigCompletionsOptions`,get children(){return[(0,e.createComponent)(s.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.`,get children(){return(0,e.createComponent)(s.TSDocDefaultValue,{get type(){return i.ReflectionKind.boolean},defaultValue:!1})}}),(0,e.createComponent)(r.InterfaceMember,{name:`display`,optional:!0,type:`boolean`})]}}),(0,e.createComponent)(a.Spacing,{}),(0,e.createComponent)(s.TSDoc,{heading:"Handler logic for the \\`completions fish config\\` command."}),(0,e.createComponent)(r.FunctionDeclaration,{export:!0,default:!0,async:!0,name:`handler`,parameters:[{name:`options`,type:`FishConfigCompletionsOptions`,default:`{}`},{name:`path`,type:`string`,default:`"~/.config/fish/config.fish"`}],get children(){return[(0,e.createComponent)(r.IfStatement,{condition:n.code`options.display !== true`,get children(){return[(0,e.createComponent)(r.VarDeclaration,{let:!0,name:`configPath`,type:`string`,initializer:n.code` path.includes(".") ? path : join(path, ".config", "fish", "config.fish");`}),(0,e.createComponent)(a.Spacing,{}),(0,e.createComponent)(r.IfStatement,{condition:n.code`configPath.startsWith("~")`,children:n.code`configPath = join(os.homedir(), configPath.replace("~", "")); `}),(0,e.createComponent)(a.Spacing,{}),(0,e.createComponent)(r.VarDeclaration,{let:!0,name:`content`,type:`string`,initializer:n.code`"";`}),(0,e.createComponent)(a.Spacing,{}),(0,e.memo)(()=>n.code`try {
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
3
+ let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
4
+ let _alloy_js_core = require("@alloy-js/core");
5
+ let _alloy_js_typescript = require("@alloy-js/typescript");
6
+ let _powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
7
+ let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
8
+ let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
9
+ let _stryke_path = require("@stryke/path");
10
+ let _powerlines_plugin_alloy_typescript_components_typescript_file = require("@powerlines/plugin-alloy/typescript/components/typescript-file");
11
+
12
+ //#region src/components/fish-config-command.tsx
13
+ /**
14
+ * The Fish Completions - Configuration command's handler wrapper for the Shell Shock project.
15
+ */
16
+ function FishConfigCompletionsCommand() {
17
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
18
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_typescript_file.TypescriptFile, {
19
+ get path() {
20
+ return (0, _stryke_path.joinPaths)(context.entryPath, "completions", "fish", "config", "command.ts");
21
+ },
22
+ imports: {
23
+ "node:os": "os",
24
+ "node:path": ["join"],
25
+ "node:fs/promises": ["readFile", "writeFile"],
26
+ "../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
27
+ },
28
+ builtinImports: { console: [
29
+ "bold",
30
+ "inlineCode",
31
+ "writeLine",
32
+ "success",
33
+ "warn",
34
+ "help"
35
+ ] },
36
+ get children() {
37
+ return [
38
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, { heading: "Options for the Fish Completions - Configuration command." }),
39
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceDeclaration, {
40
+ "export": true,
41
+ name: "FishConfigCompletionsOptions",
42
+ get children() {
43
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, {
44
+ 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.",
45
+ get children() {
46
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDocDefaultValue, {
47
+ type: "boolean",
48
+ defaultValue: false
49
+ });
50
+ }
51
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
52
+ name: "display",
53
+ type: "boolean"
54
+ })];
55
+ }
56
+ }),
57
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
58
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TSDoc, { heading: "Handler logic for the \\`completions fish config\\` command." }),
59
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
60
+ "export": true,
61
+ "default": true,
62
+ async: true,
63
+ name: "handler",
64
+ parameters: [{
65
+ name: "options",
66
+ type: "FishConfigCompletionsOptions",
67
+ default: "{}"
68
+ }, {
69
+ name: "path",
70
+ type: "string",
71
+ default: `"~/.config/fish/config.fish"`
72
+ }],
73
+ get children() {
74
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
75
+ condition: _alloy_js_core.code`options.display !== true`,
76
+ get children() {
77
+ return [
78
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
79
+ "let": true,
80
+ name: "configPath",
81
+ type: "string",
82
+ initializer: _alloy_js_core.code` path.includes(".") ? path : join(path, ".config", "fish", "config.fish");`
83
+ }),
84
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
85
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
86
+ condition: _alloy_js_core.code`configPath.startsWith("~")`,
87
+ children: _alloy_js_core.code`configPath = join(os.homedir(), configPath.replace("~", "")); `
88
+ }),
89
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
90
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
91
+ "let": true,
92
+ name: "content",
93
+ type: "string",
94
+ initializer: _alloy_js_core.code`"";`
95
+ }),
96
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
97
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`try {
2
98
  content = await readFile(configPath, "utf8");
3
99
  } catch (error) {
4
100
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
@@ -9,15 +105,19 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
9
105
  }
10
106
  }
11
107
 
12
- await writeFile(configPath, \`\${content}\\n\\n### Begin - ${(0,t.getAppTitle)(u)} Fish Completions ###\\n\\n\${SHELL_COMPLETIONS} \\n\\n### End - ${(0,t.getAppTitle)(u)} Fish Completions ###\`);
108
+ await writeFile(configPath, \`\${content}\\n\\n### Begin - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Fish Completions ###\\n\\n\${SHELL_COMPLETIONS} \\n\\n### End - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Fish Completions ###\`);
13
109
 
14
- success(\`${(0,t.getAppTitle)(u)} shell completions have been applied to Fish configuration file at \${bold(configPath)}. Please restart your terminal or run \${inlineCode(\`source \${configPath}\`)} for the changes to take effect.\`); `)]}}),(0,e.createComponent)(r.ElseClause,{get children(){return n.code`writeLine(" ------------------------------------------------- ");
110
+ success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} shell completions have been applied to Fish configuration file at \${bold(configPath)}. Please restart your terminal or run \${inlineCode(\`source \${configPath}\`)} for the changes to take effect.\`); `)
111
+ ];
112
+ }
113
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
114
+ return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
15
115
  writeLine("");
16
- writeLine(\`### Begin - ${(0,t.getAppTitle)(u)} Fish Completions ###\`);
116
+ writeLine(\`### Begin - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Fish Completions ###\`);
17
117
  writeLine("");
18
118
  SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
19
119
  writeLine("");
20
- writeLine(\`### End - ${(0,t.getAppTitle)(u)} Fish Completions ###\`);
120
+ writeLine(\`### End - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Fish Completions ###\`);
21
121
  writeLine("");
22
122
  writeLine(" ------------------------------------------------- ");
23
123
 
@@ -25,4 +125,14 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
25
125
  help(\`To enable these completions, perform one of the following actions:
26
126
 
27
127
  1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/fish/config.fish)
28
- 2) Save the above script to a file and source it from your shell configuration file \`); `}})]}})]}})}exports.FishConfigCompletionsCommand=u;
128
+ 2) Save the above script to a file and source it from your shell configuration file \`); `;
129
+ } })];
130
+ }
131
+ })
132
+ ];
133
+ }
134
+ });
135
+ }
136
+
137
+ //#endregion
138
+ exports.FishConfigCompletionsCommand = FishConfigCompletionsCommand;
@@ -1,10 +1,8 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
-
3
1
  //#region src/components/fish-config-command.d.ts
4
2
  /**
5
3
  * The Fish Completions - Configuration command's handler wrapper for the Shell Shock project.
6
4
  */
7
- declare function FishConfigCompletionsCommand(): _$_alloy_js_core0.Children;
5
+ declare function FishConfigCompletionsCommand(): import("@alloy-js/core").Children;
8
6
  //#endregion
9
7
  export { FishConfigCompletionsCommand };
10
8
  //# sourceMappingURL=fish-config-command.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fish-config-command.d.cts","names":[],"sources":["../../src/components/fish-config-command.tsx"],"mappings":";;;;;;iBAuCgB,4BAAA,CAAA,GAA4B,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"fish-config-command.d.cts","names":[],"sources":["../../src/components/fish-config-command.tsx"],"mappings":";;AAyCA;;iBAAgB,4BAAA,6BAA4B,QAAA"}
@@ -1,10 +1,8 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
-
3
1
  //#region src/components/fish-config-command.d.ts
4
2
  /**
5
3
  * The Fish Completions - Configuration command's handler wrapper for the Shell Shock project.
6
4
  */
7
- declare function FishConfigCompletionsCommand(): _$_alloy_js_core0.Children;
5
+ declare function FishConfigCompletionsCommand(): import("@alloy-js/core").Children;
8
6
  //#endregion
9
7
  export { FishConfigCompletionsCommand };
10
8
  //# sourceMappingURL=fish-config-command.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fish-config-command.d.mts","names":[],"sources":["../../src/components/fish-config-command.tsx"],"mappings":";;;;;;iBAuCgB,4BAAA,CAAA,GAA4B,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"fish-config-command.d.mts","names":[],"sources":["../../src/components/fish-config-command.tsx"],"mappings":""}