@shell-shock/plugin-completions 0.1.3 → 0.1.5

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 (36) hide show
  1. package/dist/components/{bash.cjs → bash-command.cjs} +6 -7
  2. package/dist/components/bash-command.d.cts +10 -0
  3. package/dist/components/bash-command.d.cts.map +1 -0
  4. package/dist/components/bash-command.d.mts +10 -0
  5. package/dist/components/bash-command.d.mts.map +1 -0
  6. package/dist/components/{bash.mjs → bash-command.mjs} +8 -9
  7. package/dist/components/bash-command.mjs.map +1 -0
  8. package/dist/components/index.cjs +4 -4
  9. package/dist/components/index.d.cts +3 -3
  10. package/dist/components/index.d.mts +3 -3
  11. package/dist/components/index.mjs +3 -3
  12. package/dist/components/{zsh.cjs → zsh-command.cjs} +6 -7
  13. package/dist/components/zsh-command.d.cts +10 -0
  14. package/dist/components/zsh-command.d.cts.map +1 -0
  15. package/dist/components/zsh-command.d.mts +10 -0
  16. package/dist/components/zsh-command.d.mts.map +1 -0
  17. package/dist/components/{zsh.mjs → zsh-command.mjs} +8 -9
  18. package/dist/components/zsh-command.mjs.map +1 -0
  19. package/dist/index.cjs +7 -10
  20. package/dist/index.d.cts +3 -6
  21. package/dist/index.d.cts.map +1 -1
  22. package/dist/index.d.mts +3 -6
  23. package/dist/index.d.mts.map +1 -1
  24. package/dist/index.mjs +11 -11
  25. package/dist/index.mjs.map +1 -1
  26. package/package.json +22 -26
  27. package/dist/components/bash.d.cts +0 -10
  28. package/dist/components/bash.d.cts.map +0 -1
  29. package/dist/components/bash.d.mts +0 -10
  30. package/dist/components/bash.d.mts.map +0 -1
  31. package/dist/components/bash.mjs.map +0 -1
  32. package/dist/components/zsh.d.cts +0 -10
  33. package/dist/components/zsh.d.cts.map +0 -1
  34. package/dist/components/zsh.d.mts +0 -10
  35. package/dist/components/zsh.d.mts.map +0 -1
  36. package/dist/components/zsh.mjs.map +0 -1
@@ -1,22 +1,21 @@
1
1
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
2
2
  let __shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
3
+ let __stryke_path = require("@stryke/path");
3
4
  let __alloy_js_core = require("@alloy-js/core");
4
5
  let __alloy_js_typescript = require("@alloy-js/typescript");
5
6
  let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
6
7
  let __powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
7
8
  let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
8
9
  let __powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
9
- let __powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
10
10
  let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
11
- let __stryke_path = require("@stryke/path");
12
11
 
13
- //#region src/components/bash.tsx
12
+ //#region src/components/bash-command.tsx
14
13
  /**
15
14
  * The Bash Completions commands' handler wrapper for the Shell Shock project.
16
15
  */
17
- function BashCompletionsCommandEntryFile() {
16
+ function BashCompletionsCommand() {
18
17
  const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
19
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_entry_file.EntryFile, {
18
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.TypescriptFile, {
20
19
  get path() {
21
20
  return (0, __stryke_path.joinPaths)(context.entryPath, "completions", "bash", "command.ts");
22
21
  },
@@ -78,7 +77,7 @@ function BashCompletionsCommandEntryFile() {
78
77
  }
79
78
  }),
80
79
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core.Spacing, {}),
81
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Entry point for the Bash completions command." }),
80
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Handler logic for the \\`completions bash\\` command." }),
82
81
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
83
82
  "export": true,
84
83
  "default": true,
@@ -194,4 +193,4 @@ complete -o bashdefault -o default -F _${(0, __shell_shock_core_plugin_utils.get
194
193
  }
195
194
 
196
195
  //#endregion
197
- exports.BashCompletionsCommandEntryFile = BashCompletionsCommandEntryFile;
196
+ exports.BashCompletionsCommand = BashCompletionsCommand;
@@ -0,0 +1,10 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+
3
+ //#region src/components/bash-command.d.ts
4
+ /**
5
+ * The Bash Completions commands' handler wrapper for the Shell Shock project.
6
+ */
7
+ declare function BashCompletionsCommand(): _alloy_js_core0.Children;
8
+ //#endregion
9
+ export { BashCompletionsCommand };
10
+ //# sourceMappingURL=bash-command.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bash-command.d.cts","names":[],"sources":["../../src/components/bash-command.tsx"],"sourcesContent":[],"mappings":";;;;;;AA4CgB,iBAAA,sBAAA,CAAA,CAAsB,EAAA,eAAA,CAAA,QAAA"}
@@ -0,0 +1,10 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+
3
+ //#region src/components/bash-command.d.ts
4
+ /**
5
+ * The Bash Completions commands' handler wrapper for the Shell Shock project.
6
+ */
7
+ declare function BashCompletionsCommand(): _alloy_js_core0.Children;
8
+ //#endregion
9
+ export { BashCompletionsCommand };
10
+ //# sourceMappingURL=bash-command.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bash-command.d.mts","names":[],"sources":["../../src/components/bash-command.tsx"],"sourcesContent":[],"mappings":";;;;;;AA4CgB,iBAAA,sBAAA,CAAA,CAAsB,EAAA,eAAA,CAAA,QAAA"}
@@ -1,22 +1,21 @@
1
1
  import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
2
2
  import { getAppBin, getAppTitle } from "@shell-shock/core/plugin-utils";
3
+ import { joinPaths } from "@stryke/path";
3
4
  import { code } from "@alloy-js/core";
4
5
  import { FunctionDeclaration, IfStatement, InterfaceDeclaration, VarDeclaration } from "@alloy-js/typescript";
5
6
  import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
6
7
  import { Spacing } from "@powerlines/plugin-alloy/core";
7
8
  import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
8
- import { InterfaceMember } from "@powerlines/plugin-alloy/typescript";
9
- import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
9
+ import { InterfaceMember, TypescriptFile } from "@powerlines/plugin-alloy/typescript";
10
10
  import { TSDoc, TSDocDefaultValue, TSDocRemarks } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
11
- import { joinPaths } from "@stryke/path";
12
11
 
13
- //#region src/components/bash.tsx
12
+ //#region src/components/bash-command.tsx
14
13
  /**
15
14
  * The Bash Completions commands' handler wrapper for the Shell Shock project.
16
15
  */
17
- function BashCompletionsCommandEntryFile() {
16
+ function BashCompletionsCommand() {
18
17
  const context = usePowerlines();
19
- return createComponent(EntryFile, {
18
+ return createComponent(TypescriptFile, {
20
19
  get path() {
21
20
  return joinPaths(context.entryPath, "completions", "bash", "command.ts");
22
21
  },
@@ -78,7 +77,7 @@ function BashCompletionsCommandEntryFile() {
78
77
  }
79
78
  }),
80
79
  createComponent(Spacing, {}),
81
- createComponent(TSDoc, { heading: "Entry point for the Bash completions command." }),
80
+ createComponent(TSDoc, { heading: "Handler logic for the \\`completions bash\\` command." }),
82
81
  createComponent(FunctionDeclaration, {
83
82
  "export": true,
84
83
  "default": true,
@@ -194,5 +193,5 @@ complete -o bashdefault -o default -F _${getAppBin(context)}_completions ${getAp
194
193
  }
195
194
 
196
195
  //#endregion
197
- export { BashCompletionsCommandEntryFile };
198
- //# sourceMappingURL=bash.mjs.map
196
+ export { BashCompletionsCommand };
197
+ //# sourceMappingURL=bash-command.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bash-command.mjs","names":["code","FunctionDeclaration","IfStatement","InterfaceDeclaration","VarDeclaration","ReflectionKind","Spacing","usePowerlines","InterfaceMember","TypescriptFile","TSDoc","TSDocDefaultValue","TSDocRemarks","getAppBin","getAppTitle","joinPaths","BashCompletionsCommand","context","_$createComponent","path","entryPath","imports","builtinImports","children","heading","name","type","string","defaultValue","optional","async","parameters","initializer","condition","_$memo"],"sources":["../../src/components/bash-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 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 TSDocRemarks\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 commands' handler wrapper for the Shell Shock project.\n */\nexport function BashCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(context.entryPath, \"completions\", \"bash\", \"command.ts\")}\n imports={{\n \"node:os\": [\"os\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"colors\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"stripAnsi\"\n ]\n }}>\n <TSDoc heading=\"Options for the Bash completions command.\" />\n <InterfaceDeclaration export name=\"BashCompletionsOptions\">\n <TSDoc heading=\"The path to write the completion script to.\">\n <TSDocRemarks>{`If no extension is provided, the \\`.bash\\` extension will be used.`}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue={`${getAppBin(context)}-completions.bash`}\n />\n </TSDoc>\n <InterfaceMember name=\"script\" optional type=\"string | true\" />\n <Spacing />\n <TSDoc heading=\"The Bash configuration file to append the completion script to.\">\n <TSDocRemarks>{`The generated completion script will be appended to the specified configuration file. Possible values for the Bash configuration file include: \\\\n- \\`~/.bashrc\\` \\\\n- \\`~/.bash_profile\\``}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue=\"~/.bashrc\"\n />\n </TSDoc>\n <InterfaceMember name=\"config\" optional type=\"string | true\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions bash\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[{ name: \"options\", type: \"BashCompletionsOptions\" }]}>\n <VarDeclaration\n const\n name=\"completions\"\n type=\"string\"\n initializer={code`colors.white(\\`\\${colors.gray(\"###-begin-${getAppBin(context)}-completions-###\")}\n\n\\${colors.gray(\\`\n# \\${colors.bold(\"${getAppTitle(context)} Bash CLI command completion script\")}\n#\n# \\${colors.bold(\"Installation:\")} ${getAppBin(context)} completions bash --config ~/.bashrc or ${getAppBin(context)} completions bash --script or ${getAppBin(context)} completions bash >> ~/.bashrc or ${getAppBin(context)} completions bash >> ~/.bash_profile on OSX. \\`\n)}\n\\${colors.cyan(\"_${getAppBin(context)}_completions()\")}\n{\n local cur_word args type_list\n\n cur_word=\"\\\\\\${COMP_WORDS[COMP_CWORD]}\"\n args=(\"\\\\\\${COMP_WORDS[@]}\")\n\n \\${colors.gray(\"# Ask ${getAppTitle(context)} CLI to generate completions.\")}\n mapfile -t type_list < <(${getAppBin(context)} --get-completions \"\\\\\\${args[@]}\")\n mapfile -t COMPREPLY < <(compgen -W \"$( printf '%q ' \"\\\\\\${type_list[@]}\" )\" -- \"\\\\\\${cur_word}\" |\n awk '/ / { print \"\\\\\\\\\"\"$0\"\\\\\\\\\"\" } /^[^ ]+$/ { print $0 }')\n\n \\${colors.gray(\"# if no match was found, fall back to filename completion\")}\n if [ \\\\\\${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _${getAppBin(context)}_completions ${getAppBin(context)}\n\n\\${colors.gray(\"###-end-${getAppBin(context)}-completions-###\")}\n\\`); `}\n />\n <Spacing />\n <IfStatement condition={code`options.config`}>\n <VarDeclaration\n let\n name=\"configFilePath\"\n type=\"string\"\n initializer={code`options.config === true ? \"~/.bashrc\" : options.config`}\n />\n <Spacing />\n <IfStatement condition={code`configFilePath.startsWith(\"~\")`}>\n {code`configFilePath = join(os.homedir(), configFilePath.replace(\"~\", \"\")); `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"configFileContent\"\n type=\"string\"\n initializer={code`\"\";`}\n />\n <Spacing />\n {code`try {\n configFileContent = await readFile(configFilePath, \"utf8\");\n } catch (error) {\n if (error.code === \"ENOENT\") {\n // If the file doesn't exist, we can create it later when writing the completion script.\n warn(\\`Configuration file \\${colors.bold(configFilePath)} does not exist. It will be created when the completion script is written.\\`);\n } else {\n return { error };\n }\n }\n\n await writeFile(configFilePath, \\`\\${configFileContent}\\\\n\\\\n\\${stripAnsi(completions)}\\`);\n\n success(\\`${getAppTitle(context)} Bash completion script has been generated and appended to \\${colors.bold(configFilePath)}. Please restart your terminal or run \\`source \\${configFilePath}\\` to apply the changes.\\`); `}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`options.script`}>\n {code`const outputPath = options.script === true ? \"${getAppBin(context)}-completions.bash\" : options.script;\n await writeFile(outputPath, stripAnsi(completions));\n\n success(\\`${getAppTitle(context)} Bash completion script has been generated at \\${colors.bold(outputPath)}.\\`);`}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`!options.config && !options.script`}>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(completions);\n writeLine(\" ------------------------------------------------- \");`}\n </IfStatement>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4CA,SAAgBgB,yBAAyB;CACvC,MAAMC,UAAUV,eAAyC;AAEzD,QAAAW,gBACGT,gBAAc;EAAA,IACbU,OAAI;AAAA,UAAEJ,UAAUE,QAAQG,WAAW,eAAe,QAAQ,aAAa;;EACvEC,SAAS;GACP,WAAW,CAAC,KAAK;GACjB,oBAAoB,CAAC,YAAY,YAAW;GAC7C;EACDC,gBAAgB,EACd,uBAAuB;GACrB;GACA;GACA;GACA;GACA;GAAW,EAEd;EAAA,IAAAC,WAAA;AAAA,UAAA;IAAAL,gBACAR,OAAK,EAACc,SAAO,6CAAA,CAAA;IAAAN,gBACbf,sBAAoB;KAAA,UAAA;KAAQsB,MAAI;KAAA,IAAAF,WAAA;AAAA,aAAA;OAAAL,gBAC9BR,OAAK;QAACc,SAAO;QAAA,IAAAD,WAAA;AAAA,gBAAA,CAAAL,gBACXN,cAAY,EAAAW,UAAE,sEAAoE,CAAA,EAAAL,gBAClFP,mBAAiB;UAAA,IAChBe,OAAI;AAAA,kBAAErB,eAAesB;;UAAM,IAC3BC,eAAY;AAAA,kBAAE,GAAGf,UAAUI,QAAQ,CAAA;;UAAmB,CAAA,CAAA;;QAAA,CAAA;OAAAC,gBAGzDV,iBAAe;QAACiB,MAAI;QAAUI,UAAQ;QAAC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AAA,gBAAA;UAAAL,gBACzCd,gBAAc;WAAA,OAAA;WAEbqB,MAAI;WACJC,MAAI;WACJM,aAAahC,IAAI;WAAwD,CAAA;UAAAkB,gBAE1EZ,SAAO,EAAA,CAAA;UAAAY,gBACPhB,aAAW;WAAC+B,WAAWjC,IAAI;WAAgCuB,UACzDvB,IAAI;WAAwE,CAAA;UAAAkB,gBAE9EZ,SAAO,EAAA,CAAA;UAAAY,gBACPd,gBAAc;WAAA,OAAA;WAEbqB,MAAI;WACJC,MAAI;WACJM,aAAahC,IAAI;WAAK,CAAA;UAAAkB,gBAEvBZ,SAAO,EAAA,CAAA;UAAA4B,WACPlC,IAAI;;;;;;;;;;;;;sBAaOc,YAAYG,QAAQ,CAAA,0LAA0L;UAAA;;QAAA,CAAA;OAAAC,gBAE3NZ,SAAO,EAAA,CAAA;OAAAY,gBACPhB,aAAW;QAAC+B,WAAWjC,IAAI;QAAgB,IAAAuB,WAAA;AAAA,gBACzCvB,IAAI,iDAAiDa,UAAUI,QAAQ,CAAA;;;sBAG5DH,YAAYG,QAAQ,CAAA;;QAAgF,CAAA;OAAAC,gBAEjHZ,SAAO,EAAA,CAAA;OAAAY,gBACPhB,aAAW;QAAC+B,WAAWjC,IAAI;QAAoCuB,UAC7DvB,IAAI;;;QAE6D,CAAA;OAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA"}
@@ -1,5 +1,5 @@
1
- const require_components_bash = require('./bash.cjs');
2
- const require_components_zsh = require('./zsh.cjs');
1
+ const require_components_bash_command = require('./bash-command.cjs');
2
+ const require_components_zsh_command = require('./zsh-command.cjs');
3
3
 
4
- exports.BashCompletionsCommandEntryFile = require_components_bash.BashCompletionsCommandEntryFile;
5
- exports.ZshCompletionsCommandEntryFile = require_components_zsh.ZshCompletionsCommandEntryFile;
4
+ exports.BashCompletionsCommand = require_components_bash_command.BashCompletionsCommand;
5
+ exports.ZshCompletionsCommand = require_components_zsh_command.ZshCompletionsCommand;
@@ -1,3 +1,3 @@
1
- import { BashCompletionsCommandEntryFile } from "./bash.cjs";
2
- import { ZshCompletionsCommandEntryFile } from "./zsh.cjs";
3
- export { BashCompletionsCommandEntryFile, ZshCompletionsCommandEntryFile };
1
+ import { BashCompletionsCommand } from "./bash-command.cjs";
2
+ import { ZshCompletionsCommand } from "./zsh-command.cjs";
3
+ export { BashCompletionsCommand, ZshCompletionsCommand };
@@ -1,3 +1,3 @@
1
- import { BashCompletionsCommandEntryFile } from "./bash.mjs";
2
- import { ZshCompletionsCommandEntryFile } from "./zsh.mjs";
3
- export { BashCompletionsCommandEntryFile, ZshCompletionsCommandEntryFile };
1
+ import { BashCompletionsCommand } from "./bash-command.mjs";
2
+ import { ZshCompletionsCommand } from "./zsh-command.mjs";
3
+ export { BashCompletionsCommand, ZshCompletionsCommand };
@@ -1,4 +1,4 @@
1
- import { BashCompletionsCommandEntryFile } from "./bash.mjs";
2
- import { ZshCompletionsCommandEntryFile } from "./zsh.mjs";
1
+ import { BashCompletionsCommand } from "./bash-command.mjs";
2
+ import { ZshCompletionsCommand } from "./zsh-command.mjs";
3
3
 
4
- export { BashCompletionsCommandEntryFile, ZshCompletionsCommandEntryFile };
4
+ export { BashCompletionsCommand, ZshCompletionsCommand };
@@ -1,22 +1,21 @@
1
1
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
2
2
  let __shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
3
+ let __stryke_path = require("@stryke/path");
3
4
  let __alloy_js_core = require("@alloy-js/core");
4
5
  let __alloy_js_typescript = require("@alloy-js/typescript");
5
6
  let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
6
7
  let __powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
7
8
  let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
8
9
  let __powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
9
- let __powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
10
10
  let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
11
- let __stryke_path = require("@stryke/path");
12
11
 
13
- //#region src/components/zsh.tsx
12
+ //#region src/components/zsh-command.tsx
14
13
  /**
15
14
  * The Zsh Completions commands' handler wrapper for the Shell Shock project.
16
15
  */
17
- function ZshCompletionsCommandEntryFile() {
16
+ function ZshCompletionsCommand() {
18
17
  const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
19
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_entry_file.EntryFile, {
18
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript.TypescriptFile, {
20
19
  get path() {
21
20
  return (0, __stryke_path.joinPaths)(context.entryPath, "completions", "zsh", "command.ts");
22
21
  },
@@ -78,7 +77,7 @@ function ZshCompletionsCommandEntryFile() {
78
77
  }
79
78
  }),
80
79
  (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core.Spacing, {}),
81
- (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Entry point for the Zsh completions command." }),
80
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Handler logic for the \\`completions zsh\\` command." }),
82
81
  (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
83
82
  "export": true,
84
83
  "default": true,
@@ -194,4 +193,4 @@ complete -o bashdefault -o default -F _${(0, __shell_shock_core_plugin_utils.get
194
193
  }
195
194
 
196
195
  //#endregion
197
- exports.ZshCompletionsCommandEntryFile = ZshCompletionsCommandEntryFile;
196
+ exports.ZshCompletionsCommand = ZshCompletionsCommand;
@@ -0,0 +1,10 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+
3
+ //#region src/components/zsh-command.d.ts
4
+ /**
5
+ * The Zsh Completions commands' handler wrapper for the Shell Shock project.
6
+ */
7
+ declare function ZshCompletionsCommand(): _alloy_js_core0.Children;
8
+ //#endregion
9
+ export { ZshCompletionsCommand };
10
+ //# sourceMappingURL=zsh-command.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zsh-command.d.cts","names":[],"sources":["../../src/components/zsh-command.tsx"],"sourcesContent":[],"mappings":";;;;;;AA4CgB,iBAAA,qBAAA,CAAA,CAAqB,EAAA,eAAA,CAAA,QAAA"}
@@ -0,0 +1,10 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+
3
+ //#region src/components/zsh-command.d.ts
4
+ /**
5
+ * The Zsh Completions commands' handler wrapper for the Shell Shock project.
6
+ */
7
+ declare function ZshCompletionsCommand(): _alloy_js_core0.Children;
8
+ //#endregion
9
+ export { ZshCompletionsCommand };
10
+ //# sourceMappingURL=zsh-command.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zsh-command.d.mts","names":[],"sources":["../../src/components/zsh-command.tsx"],"sourcesContent":[],"mappings":";;;;;;AA4CgB,iBAAA,qBAAA,CAAA,CAAqB,EAAA,eAAA,CAAA,QAAA"}
@@ -1,22 +1,21 @@
1
1
  import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
2
2
  import { getAppBin, getAppTitle } from "@shell-shock/core/plugin-utils";
3
+ import { joinPaths } from "@stryke/path";
3
4
  import { code } from "@alloy-js/core";
4
5
  import { FunctionDeclaration, IfStatement, InterfaceDeclaration, VarDeclaration } from "@alloy-js/typescript";
5
6
  import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
6
7
  import { Spacing } from "@powerlines/plugin-alloy/core";
7
8
  import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
8
- import { InterfaceMember } from "@powerlines/plugin-alloy/typescript";
9
- import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
9
+ import { InterfaceMember, TypescriptFile } from "@powerlines/plugin-alloy/typescript";
10
10
  import { TSDoc, TSDocDefaultValue, TSDocRemarks } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
11
- import { joinPaths } from "@stryke/path";
12
11
 
13
- //#region src/components/zsh.tsx
12
+ //#region src/components/zsh-command.tsx
14
13
  /**
15
14
  * The Zsh Completions commands' handler wrapper for the Shell Shock project.
16
15
  */
17
- function ZshCompletionsCommandEntryFile() {
16
+ function ZshCompletionsCommand() {
18
17
  const context = usePowerlines();
19
- return createComponent(EntryFile, {
18
+ return createComponent(TypescriptFile, {
20
19
  get path() {
21
20
  return joinPaths(context.entryPath, "completions", "zsh", "command.ts");
22
21
  },
@@ -78,7 +77,7 @@ function ZshCompletionsCommandEntryFile() {
78
77
  }
79
78
  }),
80
79
  createComponent(Spacing, {}),
81
- createComponent(TSDoc, { heading: "Entry point for the Zsh completions command." }),
80
+ createComponent(TSDoc, { heading: "Handler logic for the \\`completions zsh\\` command." }),
82
81
  createComponent(FunctionDeclaration, {
83
82
  "export": true,
84
83
  "default": true,
@@ -194,5 +193,5 @@ complete -o bashdefault -o default -F _${getAppBin(context)}_completions ${getAp
194
193
  }
195
194
 
196
195
  //#endregion
197
- export { ZshCompletionsCommandEntryFile };
198
- //# sourceMappingURL=zsh.mjs.map
196
+ export { ZshCompletionsCommand };
197
+ //# sourceMappingURL=zsh-command.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zsh-command.mjs","names":["code","FunctionDeclaration","IfStatement","InterfaceDeclaration","VarDeclaration","ReflectionKind","Spacing","usePowerlines","InterfaceMember","TypescriptFile","TSDoc","TSDocDefaultValue","TSDocRemarks","getAppBin","getAppTitle","joinPaths","ZshCompletionsCommand","context","_$createComponent","path","entryPath","imports","builtinImports","children","heading","name","type","string","defaultValue","optional","async","parameters","initializer","condition","_$memo"],"sources":["../../src/components/zsh-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 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 TSDocRemarks\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 Zsh Completions commands' handler wrapper for the Shell Shock project.\n */\nexport function ZshCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(context.entryPath, \"completions\", \"zsh\", \"command.ts\")}\n imports={{\n \"node:os\": [\"os\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"colors\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"stripAnsi\"\n ]\n }}>\n <TSDoc heading=\"Options for the Zsh completions command.\" />\n <InterfaceDeclaration export name=\"ZshCompletionsOptions\">\n <TSDoc heading=\"The path to write the completion script to.\">\n <TSDocRemarks>{`If no extension is provided, the \\`.zsh\\` extension will be used.`}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue={`${getAppBin(context)}-completions.zsh`}\n />\n </TSDoc>\n <InterfaceMember name=\"script\" optional type=\"string | true\" />\n <Spacing />\n <TSDoc heading=\"The Zsh configuration file to append the completion script to.\">\n <TSDocRemarks>{`The generated completion script will be appended to the specified configuration file. Possible values for the Zsh configuration file include: \\\\n- \\`~/.zshrc\\` \\\\n- \\`~/.zprofile\\``}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue=\"~/.zshrc\"\n />\n </TSDoc>\n <InterfaceMember name=\"config\" optional type=\"string | true\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions zsh\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[{ name: \"options\", type: \"ZshCompletionsOptions\" }]}>\n <VarDeclaration\n const\n name=\"completions\"\n type=\"string\"\n initializer={code`colors.white(\\`\\${colors.gray(\\`#compdef \\${colors.bold(\"${getAppBin(context)}\")}\\`)}\n\\${colors.gray(\"###-begin-${getAppBin(context)}-completions-###\")}\n\n\\${colors.gray(\\`\n# \\${colors.bold(\"${getAppTitle(context)} Zsh CLI command completion script\")}\n#\n# \\${colors.bold(\"Installation:\")} ${getAppBin(context)} completions zsh --config ~/.zshrc or ${getAppBin(context)} completions zsh --script or ${getAppBin(context)} completions zsh >> ~/.zshrc or ${getAppBin(context)} completions zsh >> ~/.zprofile on OSX. \\`\n)}\n\\${colors.cyan(\"_${getAppBin(context)}_completions()\")}\n{\n local reply\n local si=$IFS\n IFS=$'\\\\n' reply=($(COMP_CWORD=\"$((CURRENT-1))\" COMP_LINE=\"$BUFFER\" COMP_POINT=\"$CURSOR\" ${getAppBin(context)} --get-completions \"\\\\\\${words[@]}\"))\n IFS=$si\n if [[ \\\\\\${#reply} -gt 0 ]]; then\n _describe 'values' reply\n else\n _default\n fi\n}\n\nif [[ \"\\\\\\${zsh_eval_context[-1]}\" == \"loadautofunc\" ]]; then\n _${getAppBin(context)}_completions \"$@\"\nelse\n compdef _${getAppBin(context)}_completions ${getAppBin(context)}\nfi\ncomplete -o bashdefault -o default -F _${getAppBin(context)}_completions ${getAppBin(context)}\n\n\\${colors.gray(\"###-end-${getAppBin(context)}-completions-###\")}\n\\`);`}\n />\n <Spacing />\n <IfStatement condition={code`options.config`}>\n <VarDeclaration\n let\n name=\"configFilePath\"\n type=\"string\"\n initializer={code`options.config === true ? \"~/.zshrc\" : options.config`}\n />\n <Spacing />\n <IfStatement condition={code`configFilePath.startsWith(\"~\")`}>\n {code`configFilePath = join(os.homedir(), configFilePath.replace(\"~\", \"\")); `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"configFileContent\"\n type=\"string\"\n initializer={code`\"\";`}\n />\n <Spacing />\n {code`try {\n configFileContent = await readFile(configFilePath, \"utf8\");\n } catch (error) {\n if (error.code === \"ENOENT\") {\n // If the file doesn't exist, we can create it later when writing the completion script.\n warn(\\`Configuration file \\${colors.bold(configFilePath)} does not exist. It will be created when the completion script is written.\\`);\n } else {\n return { error };\n }\n }\n\n await writeFile(configFilePath, \\`\\${configFileContent}\\\\n\\\\n\\${stripAnsi(completions)}\\`);\n\n success(\\`${getAppTitle(context)} Zsh completion script has been generated and appended to \\${colors.bold(configFilePath)}. Please restart your terminal or run \\`source \\${configFilePath}\\` to apply the changes.\\`); `}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`options.script`}>\n {code`const outputPath = options.script === true ? \"${getAppBin(context)}-completions.zsh\" : options.script;\n await writeFile(outputPath, stripAnsi(completions));\n\n success(\\`${getAppTitle(context)} Zsh completion script has been generated at \\${colors.bold(outputPath)}.\\`);`}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`!options.config && !options.script`}>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(completions);\n writeLine(\" ------------------------------------------------- \");`}\n </IfStatement>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;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,CAAA;UAAAkB,gBAEvBZ,SAAO,EAAA,CAAA;UAAA4B,WACPlC,IAAI;;;;;;;;;;;;;sBAaOc,YAAYG,QAAQ,CAAA,yLAAyL;UAAA;;QAAA,CAAA;OAAAC,gBAE1NZ,SAAO,EAAA,CAAA;OAAAY,gBACPhB,aAAW;QAAC+B,WAAWjC,IAAI;QAAgB,IAAAuB,WAAA;AAAA,gBACzCvB,IAAI,iDAAiDa,UAAUI,QAAQ,CAAA;;;sBAG5DH,YAAYG,QAAQ,CAAA;;QAA+E,CAAA;OAAAC,gBAEhHZ,SAAO,EAAA,CAAA;OAAAY,gBACPhB,aAAW;QAAC+B,WAAWjC,IAAI;QAAoCuB,UAC7DvB,IAAI;;;QAE6D,CAAA;OAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA"}
package/dist/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_components_bash = require('./components/bash.cjs');
3
- const require_components_zsh = require('./components/zsh.cjs');
2
+ const require_components_bash_command = require('./components/bash-command.cjs');
3
+ const require_components_zsh_command = require('./components/zsh-command.cjs');
4
4
  require('./components/index.cjs');
5
- const require_types_shell_type = require('./types/shell-type.cjs');
6
5
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
7
6
  let __powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
8
7
  let __shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
8
+ let __stryke_path = require("@stryke/path");
9
9
  let __stryke_path_join = require("@stryke/path/join");
10
10
 
11
11
  //#region src/index.tsx
@@ -20,7 +20,7 @@ const plugin = (options = {}) => {
20
20
  return { completions: options };
21
21
  },
22
22
  configResolved() {
23
- this.debug("Adding the CLI completion commands to the entry points.");
23
+ this.debug("Adding the CLI completion commands to the application context.");
24
24
  this.inputs ??= [];
25
25
  if (this.inputs.some((input) => input.id === "completions")) this.info("The `completions` command already exists in the commands list. If you would like the completions command to be managed by the `@shell-shock/plugin-completions` package, please remove or rename the command.");
26
26
  else this.inputs.push({
@@ -53,21 +53,18 @@ const plugin = (options = {}) => {
53
53
  path: "completions/zsh",
54
54
  segments: ["completions", "zsh"],
55
55
  title: "CLI Completions - Zsh Shell",
56
- entry: { file: (0, __stryke_path_join.joinPaths)(this.entryPath, "completions", "zsh", "command.ts") },
56
+ entry: { file: (0, __stryke_path.relativePath)(this.commandsPath, (0, __stryke_path_join.joinPaths)(this.entryPath, "completions", "zsh", "command.ts")) },
57
57
  isVirtual: false
58
58
  });
59
59
  },
60
60
  async prepare() {
61
- this.debug("Rendering entry point modules for the Shell Shock `completions` plugin.");
62
- return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_bash.BashCompletionsCommandEntryFile, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_zsh.ZshCompletionsCommandEntryFile, {})]);
61
+ this.debug("Rendering command handling modules for the Shell Shock `completions` plugin.");
62
+ return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_bash_command.BashCompletionsCommand, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_zsh_command.ZshCompletionsCommand, {})]);
63
63
  }
64
64
  }];
65
65
  };
66
66
  var src_default = plugin;
67
67
 
68
68
  //#endregion
69
- exports.BashCompletionsCommandEntryFile = require_components_bash.BashCompletionsCommandEntryFile;
70
- exports.SHELL_TYPES = require_types_shell_type.SHELL_TYPES;
71
- exports.ZshCompletionsCommandEntryFile = require_components_zsh.ZshCompletionsCommandEntryFile;
72
69
  exports.default = src_default;
73
70
  exports.plugin = plugin;
package/dist/index.d.cts CHANGED
@@ -1,15 +1,12 @@
1
- import { BashCompletionsCommandEntryFile } from "./components/bash.cjs";
2
- import { ZshCompletionsCommandEntryFile } from "./components/zsh.cjs";
3
- import "./components/index.cjs";
4
- import { CompletionsPluginContext, CompletionsPluginOptions, CompletionsPluginResolvedConfig, CompletionsPluginUserConfig } from "./types/plugin.cjs";
5
- import { SHELL_TYPES, ShellType } from "./types/shell-type.cjs";
1
+ import { CompletionsPluginContext, CompletionsPluginOptions } from "./types/plugin.cjs";
6
2
  import { Plugin } from "powerlines";
7
3
 
8
4
  //#region src/index.d.ts
5
+
9
6
  /**
10
7
  * The Completions - Shell Shock plugin to add completion commands to a Shell Shock application.
11
8
  */
12
9
  declare const plugin: <TContext extends CompletionsPluginContext = CompletionsPluginContext>(options?: CompletionsPluginOptions) => Plugin<TContext>[];
13
10
  //#endregion
14
- export { BashCompletionsCommandEntryFile, CompletionsPluginContext, CompletionsPluginOptions, CompletionsPluginResolvedConfig, CompletionsPluginUserConfig, SHELL_TYPES, ShellType, ZshCompletionsCommandEntryFile, plugin as default, plugin };
11
+ export { plugin as default, plugin };
15
12
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;cAqCa,0BACM,2BAA2B,oCAEnC,6BACR,OAAO"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAgCA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,wBAAA,GAA2B,wBAA3B,CAAA,CAAA,OAAA,CAAA,EAER,wBAFQ,EAAA,GAGhB,MAHgB,CAGT,QAHS,CAAA,EAAA"}
package/dist/index.d.mts CHANGED
@@ -1,15 +1,12 @@
1
- import { BashCompletionsCommandEntryFile } from "./components/bash.mjs";
2
- import { ZshCompletionsCommandEntryFile } from "./components/zsh.mjs";
3
- import "./components/index.mjs";
4
- import { CompletionsPluginContext, CompletionsPluginOptions, CompletionsPluginResolvedConfig, CompletionsPluginUserConfig } from "./types/plugin.mjs";
5
- import { SHELL_TYPES, ShellType } from "./types/shell-type.mjs";
1
+ import { CompletionsPluginContext, CompletionsPluginOptions } from "./types/plugin.mjs";
6
2
  import { Plugin } from "powerlines";
7
3
 
8
4
  //#region src/index.d.ts
5
+
9
6
  /**
10
7
  * The Completions - Shell Shock plugin to add completion commands to a Shell Shock application.
11
8
  */
12
9
  declare const plugin: <TContext extends CompletionsPluginContext = CompletionsPluginContext>(options?: CompletionsPluginOptions) => Plugin<TContext>[];
13
10
  //#endregion
14
- export { BashCompletionsCommandEntryFile, CompletionsPluginContext, CompletionsPluginOptions, CompletionsPluginResolvedConfig, CompletionsPluginUserConfig, SHELL_TYPES, ShellType, ZshCompletionsCommandEntryFile, plugin as default, plugin };
11
+ export { plugin as default, plugin };
15
12
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;cAqCa,0BACM,2BAA2B,oCAEnC,6BACR,OAAO"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAgCA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,wBAAA,GAA2B,wBAA3B,CAAA,CAAA,OAAA,CAAA,EAER,wBAFQ,EAAA,GAGhB,MAHgB,CAGT,QAHS,CAAA,EAAA"}
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { BashCompletionsCommandEntryFile } from "./components/bash.mjs";
2
- import { ZshCompletionsCommandEntryFile } from "./components/zsh.mjs";
1
+ import { BashCompletionsCommand } from "./components/bash-command.mjs";
2
+ import { ZshCompletionsCommand } from "./components/zsh-command.mjs";
3
3
  import "./components/index.mjs";
4
- import { SHELL_TYPES } from "./types/shell-type.mjs";
5
4
  import { createComponent } from "@alloy-js/core/jsx-runtime";
6
5
  import { render } from "@powerlines/plugin-alloy/render";
7
6
  import { getAppTitle } from "@shell-shock/core/plugin-utils";
8
- import { joinPaths } from "@stryke/path/join";
7
+ import { relativePath } from "@stryke/path";
8
+ import { joinPaths as joinPaths$1 } from "@stryke/path/join";
9
9
 
10
10
  //#region src/index.tsx
11
11
  /**
@@ -19,7 +19,7 @@ const plugin = (options = {}) => {
19
19
  return { completions: options };
20
20
  },
21
21
  configResolved() {
22
- this.debug("Adding the CLI completion commands to the entry points.");
22
+ this.debug("Adding the CLI completion commands to the application context.");
23
23
  this.inputs ??= [];
24
24
  if (this.inputs.some((input) => input.id === "completions")) this.info("The `completions` command already exists in the commands list. If you would like the completions command to be managed by the `@shell-shock/plugin-completions` package, please remove or rename the command.");
25
25
  else this.inputs.push({
@@ -30,7 +30,7 @@ const plugin = (options = {}) => {
30
30
  segments: ["completions"],
31
31
  title: "CLI Completions",
32
32
  description: `Commands for generating shell completion scripts for the ${getAppTitle(this)}.`,
33
- entry: { file: joinPaths(this.entryPath, "completions", "command.ts") },
33
+ entry: { file: joinPaths$1(this.entryPath, "completions", "command.ts") },
34
34
  isVirtual: true
35
35
  });
36
36
  if (this.inputs.some((input) => input.id === "completions-bash")) this.info("The `completions-bash` command already exists in the commands list. If you would like the completions-bash command to be managed by the `@shell-shock/plugin-completions` package, please remove or rename the command.");
@@ -41,7 +41,7 @@ const plugin = (options = {}) => {
41
41
  path: "completions/bash",
42
42
  segments: ["completions", "bash"],
43
43
  title: "CLI Completions - Bash Shell",
44
- entry: { file: joinPaths(this.entryPath, "completions", "bash", "command.ts") },
44
+ entry: { file: joinPaths$1(this.entryPath, "completions", "bash", "command.ts") },
45
45
  isVirtual: false
46
46
  });
47
47
  if (this.inputs.some((input) => input.id === "completions-zsh")) this.info("The `completions-zsh` command already exists in the commands list. If you would like the completions-zsh command to be managed by the `@shell-shock/plugin-completions` package, please remove or rename the command.");
@@ -52,18 +52,18 @@ const plugin = (options = {}) => {
52
52
  path: "completions/zsh",
53
53
  segments: ["completions", "zsh"],
54
54
  title: "CLI Completions - Zsh Shell",
55
- entry: { file: joinPaths(this.entryPath, "completions", "zsh", "command.ts") },
55
+ entry: { file: relativePath(this.commandsPath, joinPaths$1(this.entryPath, "completions", "zsh", "command.ts")) },
56
56
  isVirtual: false
57
57
  });
58
58
  },
59
59
  async prepare() {
60
- this.debug("Rendering entry point modules for the Shell Shock `completions` plugin.");
61
- return render(this, [createComponent(BashCompletionsCommandEntryFile, {}), createComponent(ZshCompletionsCommandEntryFile, {})]);
60
+ this.debug("Rendering command handling modules for the Shell Shock `completions` plugin.");
61
+ return render(this, [createComponent(BashCompletionsCommand, {}), createComponent(ZshCompletionsCommand, {})]);
62
62
  }
63
63
  }];
64
64
  };
65
65
  var src_default = plugin;
66
66
 
67
67
  //#endregion
68
- export { BashCompletionsCommandEntryFile, SHELL_TYPES, ZshCompletionsCommandEntryFile, src_default as default, plugin };
68
+ export { src_default as default, plugin };
69
69
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["render","getAppTitle","joinPaths","BashCompletionsCommandEntryFile","ZshCompletionsCommandEntryFile","plugin","options","name","config","debug","completions","configResolved","inputs","some","input","id","info","push","alias","path","segments","title","description","entry","file","entryPath","isVirtual","prepare","_$createComponent"],"sources":["../src/index.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 { render } from \"@powerlines/plugin-alloy/render\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport type { Plugin } from \"powerlines\";\nimport {\n BashCompletionsCommandEntryFile,\n ZshCompletionsCommandEntryFile\n} from \"./components\";\nimport type {\n CompletionsPluginContext,\n CompletionsPluginOptions\n} from \"./types/plugin\";\n\nexport * from \"./components\";\nexport * from \"./types\";\n\n/**\n * The Completions - Shell Shock plugin to add completion commands to a Shell Shock application.\n */\nexport const plugin = <\n TContext extends CompletionsPluginContext = CompletionsPluginContext\n>(\n options: CompletionsPluginOptions = {}\n): Plugin<TContext>[] => {\n return [\n {\n name: \"shell-shock:completions\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `completions` plugin.\"\n );\n\n return {\n completions: options\n };\n },\n configResolved() {\n this.debug(\"Adding the CLI completion commands to the entry points.\");\n\n this.inputs ??= [];\n if (this.inputs.some(input => input.id === \"completions\")) {\n this.info(\n \"The `completions` command already exists in the commands list. If you would like the completions command to be managed by the `@shell-shock/plugin-completions` package, please remove or rename the command.\"\n );\n } else {\n this.inputs.push({\n id: \"completions\",\n name: \"completions\",\n alias: [\"completion\"],\n path: \"completions\",\n segments: [\"completions\"],\n title: \"CLI Completions\",\n description: `Commands for generating shell completion scripts for the ${getAppTitle(\n this\n )}.`,\n entry: {\n file: joinPaths(this.entryPath, \"completions\", \"command.ts\")\n },\n isVirtual: true\n });\n }\n\n if (this.inputs.some(input => input.id === \"completions-bash\")) {\n this.info(\n \"The `completions-bash` command already exists in the commands list. If you would like the completions-bash command to be managed by the `@shell-shock/plugin-completions` package, please remove or rename the command.\"\n );\n } else {\n this.inputs.push({\n id: \"completions-bash\",\n name: \"bash\",\n alias: [],\n path: \"completions/bash\",\n segments: [\"completions\", \"bash\"],\n title: \"CLI Completions - Bash Shell\",\n entry: {\n file: joinPaths(\n this.entryPath,\n \"completions\",\n \"bash\",\n \"command.ts\"\n )\n },\n isVirtual: false\n });\n }\n\n if (this.inputs.some(input => input.id === \"completions-zsh\")) {\n this.info(\n \"The `completions-zsh` command already exists in the commands list. If you would like the completions-zsh command to be managed by the `@shell-shock/plugin-completions` package, please remove or rename the command.\"\n );\n } else {\n this.inputs.push({\n id: \"completions-zsh\",\n name: \"zsh\",\n alias: [],\n path: \"completions/zsh\",\n segments: [\"completions\", \"zsh\"],\n title: \"CLI Completions - Zsh Shell\",\n entry: {\n file: joinPaths(\n this.entryPath,\n \"completions\",\n \"zsh\",\n \"command.ts\"\n )\n },\n isVirtual: false\n });\n }\n },\n async prepare() {\n this.debug(\n \"Rendering entry point modules for the Shell Shock `completions` plugin.\"\n );\n\n return render(\n this,\n <>\n <BashCompletionsCommandEntryFile />\n <ZshCompletionsCommandEntryFile />\n </>\n );\n }\n }\n ];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;AAqCA,MAAaK,UAGXC,UAAoC,EAAE,KACf;AACvB,QAAO,CACL;EACEC,MAAM;EACNC,SAAS;AACP,QAAKC,MACH,4EACD;AAED,UAAO,EACLC,aAAaJ,SACd;;EAEHK,iBAAiB;AACf,QAAKF,MAAM,0DAA0D;AAErE,QAAKG,WAAW,EAAE;AAClB,OAAI,KAAKA,OAAOC,MAAKC,UAASA,MAAMC,OAAO,cAAc,CACvD,MAAKC,KACH,gNACD;OAED,MAAKJ,OAAOK,KAAK;IACfF,IAAI;IACJR,MAAM;IACNW,OAAO,CAAC,aAAa;IACrBC,MAAM;IACNC,UAAU,CAAC,cAAc;IACzBC,OAAO;IACPC,aAAa,4DAA4DrB,YACvE,KACD,CAAA;IACDsB,OAAO,EACLC,MAAMtB,UAAU,KAAKuB,WAAW,eAAe,aAAY,EAC5D;IACDC,WAAW;IACZ,CAAC;AAGJ,OAAI,KAAKd,OAAOC,MAAKC,UAASA,MAAMC,OAAO,mBAAmB,CAC5D,MAAKC,KACH,0NACD;OAED,MAAKJ,OAAOK,KAAK;IACfF,IAAI;IACJR,MAAM;IACNW,OAAO,EAAE;IACTC,MAAM;IACNC,UAAU,CAAC,eAAe,OAAO;IACjCC,OAAO;IACPE,OAAO,EACLC,MAAMtB,UACJ,KAAKuB,WACL,eACA,QACA,aACF,EACD;IACDC,WAAW;IACZ,CAAC;AAGJ,OAAI,KAAKd,OAAOC,MAAKC,UAASA,MAAMC,OAAO,kBAAkB,CAC3D,MAAKC,KACH,wNACD;OAED,MAAKJ,OAAOK,KAAK;IACfF,IAAI;IACJR,MAAM;IACNW,OAAO,EAAE;IACTC,MAAM;IACNC,UAAU,CAAC,eAAe,MAAM;IAChCC,OAAO;IACPE,OAAO,EACLC,MAAMtB,UACJ,KAAKuB,WACL,eACA,OACA,aACF,EACD;IACDC,WAAW;IACZ,CAAC;;EAGN,MAAMC,UAAU;AACd,QAAKlB,MACH,0EACD;AAED,UAAOT,OACL,MAAI,CAAA4B,gBAEDzB,iCAA+B,EAAA,CAAA,EAAAyB,gBAC/BxB,gCAA8B,EAAA,CAAA,CAEnC,CAAC;;EAEJ,CACF;;AAGH,kBAAeC"}
1
+ {"version":3,"file":"index.mjs","names":["render","getAppTitle","relativePath","joinPaths","BashCompletionsCommand","ZshCompletionsCommand","plugin","options","name","config","debug","completions","configResolved","inputs","some","input","id","info","push","alias","path","segments","title","description","entry","file","entryPath","isVirtual","commandsPath","prepare","_$createComponent"],"sources":["../src/index.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 { render } from \"@powerlines/plugin-alloy/render\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { relativePath } from \"@stryke/path\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport type { Plugin } from \"powerlines\";\nimport { BashCompletionsCommand, ZshCompletionsCommand } from \"./components\";\nimport type {\n CompletionsPluginContext,\n CompletionsPluginOptions\n} from \"./types/plugin\";\n\n/**\n * The Completions - Shell Shock plugin to add completion commands to a Shell Shock application.\n */\nexport const plugin = <\n TContext extends CompletionsPluginContext = CompletionsPluginContext\n>(\n options: CompletionsPluginOptions = {}\n): Plugin<TContext>[] => {\n return [\n {\n name: \"shell-shock:completions\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `completions` plugin.\"\n );\n\n return {\n completions: options\n };\n },\n configResolved() {\n this.debug(\n \"Adding the CLI completion commands to the application context.\"\n );\n\n this.inputs ??= [];\n if (this.inputs.some(input => input.id === \"completions\")) {\n this.info(\n \"The `completions` command already exists in the commands list. If you would like the completions command to be managed by the `@shell-shock/plugin-completions` package, please remove or rename the command.\"\n );\n } else {\n this.inputs.push({\n id: \"completions\",\n name: \"completions\",\n alias: [\"completion\"],\n path: \"completions\",\n segments: [\"completions\"],\n title: \"CLI Completions\",\n description: `Commands for generating shell completion scripts for the ${getAppTitle(\n this\n )}.`,\n entry: {\n file: joinPaths(this.entryPath, \"completions\", \"command.ts\")\n },\n isVirtual: true\n });\n }\n\n if (this.inputs.some(input => input.id === \"completions-bash\")) {\n this.info(\n \"The `completions-bash` command already exists in the commands list. If you would like the completions-bash command to be managed by the `@shell-shock/plugin-completions` package, please remove or rename the command.\"\n );\n } else {\n this.inputs.push({\n id: \"completions-bash\",\n name: \"bash\",\n alias: [],\n path: \"completions/bash\",\n segments: [\"completions\", \"bash\"],\n title: \"CLI Completions - Bash Shell\",\n entry: {\n file: joinPaths(\n this.entryPath,\n \"completions\",\n \"bash\",\n \"command.ts\"\n )\n },\n isVirtual: false\n });\n }\n\n if (this.inputs.some(input => input.id === \"completions-zsh\")) {\n this.info(\n \"The `completions-zsh` command already exists in the commands list. If you would like the completions-zsh command to be managed by the `@shell-shock/plugin-completions` package, please remove or rename the command.\"\n );\n } else {\n this.inputs.push({\n id: \"completions-zsh\",\n name: \"zsh\",\n alias: [],\n path: \"completions/zsh\",\n segments: [\"completions\", \"zsh\"],\n title: \"CLI Completions - Zsh Shell\",\n entry: {\n file: relativePath(\n this.commandsPath,\n joinPaths(this.entryPath, \"completions\", \"zsh\", \"command.ts\")\n )\n },\n isVirtual: false\n });\n }\n },\n async prepare() {\n this.debug(\n \"Rendering command handling modules for the Shell Shock `completions` plugin.\"\n );\n\n return render(\n this,\n <>\n <BashCompletionsCommand />\n <ZshCompletionsCommand />\n </>\n );\n }\n }\n ];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;AAgCA,MAAaM,UAGXC,UAAoC,EAAE,KACf;AACvB,QAAO,CACL;EACEC,MAAM;EACNC,SAAS;AACP,QAAKC,MACH,4EACD;AAED,UAAO,EACLC,aAAaJ,SACd;;EAEHK,iBAAiB;AACf,QAAKF,MACH,iEACD;AAED,QAAKG,WAAW,EAAE;AAClB,OAAI,KAAKA,OAAOC,MAAKC,UAASA,MAAMC,OAAO,cAAc,CACvD,MAAKC,KACH,gNACD;OAED,MAAKJ,OAAOK,KAAK;IACfF,IAAI;IACJR,MAAM;IACNW,OAAO,CAAC,aAAa;IACrBC,MAAM;IACNC,UAAU,CAAC,cAAc;IACzBC,OAAO;IACPC,aAAa,4DAA4DtB,YACvE,KACD,CAAA;IACDuB,OAAO,EACLC,MAAMtB,YAAU,KAAKuB,WAAW,eAAe,aAAY,EAC5D;IACDC,WAAW;IACZ,CAAC;AAGJ,OAAI,KAAKd,OAAOC,MAAKC,UAASA,MAAMC,OAAO,mBAAmB,CAC5D,MAAKC,KACH,0NACD;OAED,MAAKJ,OAAOK,KAAK;IACfF,IAAI;IACJR,MAAM;IACNW,OAAO,EAAE;IACTC,MAAM;IACNC,UAAU,CAAC,eAAe,OAAO;IACjCC,OAAO;IACPE,OAAO,EACLC,MAAMtB,YACJ,KAAKuB,WACL,eACA,QACA,aACF,EACD;IACDC,WAAW;IACZ,CAAC;AAGJ,OAAI,KAAKd,OAAOC,MAAKC,UAASA,MAAMC,OAAO,kBAAkB,CAC3D,MAAKC,KACH,wNACD;OAED,MAAKJ,OAAOK,KAAK;IACfF,IAAI;IACJR,MAAM;IACNW,OAAO,EAAE;IACTC,MAAM;IACNC,UAAU,CAAC,eAAe,MAAM;IAChCC,OAAO;IACPE,OAAO,EACLC,MAAMvB,aACJ,KAAK0B,cACLzB,YAAU,KAAKuB,WAAW,eAAe,OAAO,aAClD,CAAA,EACD;IACDC,WAAW;IACZ,CAAC;;EAGN,MAAME,UAAU;AACd,QAAKnB,MACH,+EACD;AAED,UAAOV,OACL,MAAI,CAAA8B,gBAED1B,wBAAsB,EAAA,CAAA,EAAA0B,gBACtBzB,uBAAqB,EAAA,CAAA,CAE1B,CAAC;;EAEJ,CACF;;AAGH,kBAAeC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/plugin-completions",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "description": "A package containing a Shell Shock plugin to generate source code given a list design tokens.",
6
6
  "repository": {
@@ -69,32 +69,32 @@
69
69
  "default": "./dist/components/index.mjs"
70
70
  }
71
71
  },
72
- "./components/bash": {
72
+ "./components/bash-command": {
73
73
  "require": {
74
- "types": "./dist/components/bash.d.cts",
75
- "default": "./dist/components/bash.cjs"
74
+ "types": "./dist/components/bash-command.d.cts",
75
+ "default": "./dist/components/bash-command.cjs"
76
76
  },
77
77
  "import": {
78
- "types": "./dist/components/bash.d.mts",
79
- "default": "./dist/components/bash.mjs"
78
+ "types": "./dist/components/bash-command.d.mts",
79
+ "default": "./dist/components/bash-command.mjs"
80
80
  },
81
81
  "default": {
82
- "types": "./dist/components/bash.d.mts",
83
- "default": "./dist/components/bash.mjs"
82
+ "types": "./dist/components/bash-command.d.mts",
83
+ "default": "./dist/components/bash-command.mjs"
84
84
  }
85
85
  },
86
- "./components/zsh": {
86
+ "./components/zsh-command": {
87
87
  "require": {
88
- "types": "./dist/components/zsh.d.cts",
89
- "default": "./dist/components/zsh.cjs"
88
+ "types": "./dist/components/zsh-command.d.cts",
89
+ "default": "./dist/components/zsh-command.cjs"
90
90
  },
91
91
  "import": {
92
- "types": "./dist/components/zsh.d.mts",
93
- "default": "./dist/components/zsh.mjs"
92
+ "types": "./dist/components/zsh-command.d.mts",
93
+ "default": "./dist/components/zsh-command.mjs"
94
94
  },
95
95
  "default": {
96
- "types": "./dist/components/zsh.d.mts",
97
- "default": "./dist/components/zsh.mjs"
96
+ "types": "./dist/components/zsh-command.d.mts",
97
+ "default": "./dist/components/zsh-command.mjs"
98
98
  }
99
99
  },
100
100
  "./package.json": "./package.json",
@@ -151,22 +151,18 @@
151
151
  "powerlines",
152
152
  "storm-software"
153
153
  ],
154
- "peerDependencies": { "@shell-shock/preset-script": "*" },
155
- "peerDependenciesMeta": {
156
- "@shell-shock/preset-script": { "optional": true }
157
- },
158
154
  "dependencies": {
159
155
  "@alloy-js/core": "0.23.0-dev.8",
160
156
  "@alloy-js/typescript": "0.23.0-dev.4",
161
- "@powerlines/deepkit": "^0.6.63",
162
- "@powerlines/plugin-alloy": "^0.23.13",
163
- "@powerlines/plugin-plugin": "^0.12.234",
164
- "@shell-shock/core": "^0.8.9",
157
+ "@powerlines/deepkit": "^0.6.66",
158
+ "@powerlines/plugin-alloy": "^0.23.16",
159
+ "@powerlines/plugin-plugin": "^0.12.237",
160
+ "@shell-shock/core": "^0.8.11",
165
161
  "@stryke/path": "0.26.6",
166
- "powerlines": "^0.38.50"
162
+ "powerlines": "^0.38.53"
167
163
  },
168
164
  "devDependencies": {
169
- "@powerlines/plugin-deepkit": "^0.11.162",
165
+ "@powerlines/plugin-deepkit": "^0.11.165",
170
166
  "@types/node": "^22.19.11"
171
167
  },
172
168
  "publishConfig": {
@@ -184,5 +180,5 @@
184
180
  "./package.json": "./package.json"
185
181
  }
186
182
  },
187
- "gitHead": "305a2a23562d3ddd3f1c04bc770de72a30cf0fcb"
183
+ "gitHead": "1137a1ee3be5bb927dc9b15e118f804fd09a24b4"
188
184
  }
@@ -1,10 +0,0 @@
1
- import * as _alloy_js_core0 from "@alloy-js/core";
2
-
3
- //#region src/components/bash.d.ts
4
- /**
5
- * The Bash Completions commands' handler wrapper for the Shell Shock project.
6
- */
7
- declare function BashCompletionsCommandEntryFile(): _alloy_js_core0.Children;
8
- //#endregion
9
- export { BashCompletionsCommandEntryFile };
10
- //# sourceMappingURL=bash.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bash.d.cts","names":[],"sources":["../../src/components/bash.tsx"],"sourcesContent":[],"mappings":";;;;;;AA0CgB,iBAAA,+BAAA,CAAA,CAA+B,EAAA,eAAA,CAAA,QAAA"}
@@ -1,10 +0,0 @@
1
- import * as _alloy_js_core0 from "@alloy-js/core";
2
-
3
- //#region src/components/bash.d.ts
4
- /**
5
- * The Bash Completions commands' handler wrapper for the Shell Shock project.
6
- */
7
- declare function BashCompletionsCommandEntryFile(): _alloy_js_core0.Children;
8
- //#endregion
9
- export { BashCompletionsCommandEntryFile };
10
- //# sourceMappingURL=bash.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bash.d.mts","names":[],"sources":["../../src/components/bash.tsx"],"sourcesContent":[],"mappings":";;;;;;AA0CgB,iBAAA,+BAAA,CAAA,CAA+B,EAAA,eAAA,CAAA,QAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"bash.mjs","names":["code","FunctionDeclaration","IfStatement","InterfaceDeclaration","VarDeclaration","ReflectionKind","Spacing","usePowerlines","InterfaceMember","EntryFile","TSDoc","TSDocDefaultValue","TSDocRemarks","getAppBin","getAppTitle","joinPaths","BashCompletionsCommandEntryFile","context","_$createComponent","path","entryPath","imports","builtinImports","children","heading","name","type","string","defaultValue","optional","async","parameters","initializer","condition","_$memo"],"sources":["../../src/components/bash.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 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 { InterfaceMember } from \"@powerlines/plugin-alloy/typescript\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TSDocRemarks\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 commands' handler wrapper for the Shell Shock project.\n */\nexport function BashCompletionsCommandEntryFile() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <EntryFile\n path={joinPaths(context.entryPath, \"completions\", \"bash\", \"command.ts\")}\n imports={{\n \"node:os\": [\"os\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"colors\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"stripAnsi\"\n ]\n }}>\n <TSDoc heading=\"Options for the Bash completions command.\" />\n <InterfaceDeclaration export name=\"BashCompletionsOptions\">\n <TSDoc heading=\"The path to write the completion script to.\">\n <TSDocRemarks>{`If no extension is provided, the \\`.bash\\` extension will be used.`}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue={`${getAppBin(context)}-completions.bash`}\n />\n </TSDoc>\n <InterfaceMember name=\"script\" optional type=\"string | true\" />\n <Spacing />\n <TSDoc heading=\"The Bash configuration file to append the completion script to.\">\n <TSDocRemarks>{`The generated completion script will be appended to the specified configuration file. Possible values for the Bash configuration file include: \\\\n- \\`~/.bashrc\\` \\\\n- \\`~/.bash_profile\\``}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue=\"~/.bashrc\"\n />\n </TSDoc>\n <InterfaceMember name=\"config\" optional type=\"string | true\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Entry point for the Bash completions command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[{ name: \"options\", type: \"BashCompletionsOptions\" }]}>\n <VarDeclaration\n const\n name=\"completions\"\n type=\"string\"\n initializer={code`colors.white(\\`\\${colors.gray(\"###-begin-${getAppBin(context)}-completions-###\")}\n\n\\${colors.gray(\\`\n# \\${colors.bold(\"${getAppTitle(context)} Bash CLI command completion script\")}\n#\n# \\${colors.bold(\"Installation:\")} ${getAppBin(context)} completions bash --config ~/.bashrc or ${getAppBin(context)} completions bash --script or ${getAppBin(context)} completions bash >> ~/.bashrc or ${getAppBin(context)} completions bash >> ~/.bash_profile on OSX. \\`\n)}\n\\${colors.cyan(\"_${getAppBin(context)}_completions()\")}\n{\n local cur_word args type_list\n\n cur_word=\"\\\\\\${COMP_WORDS[COMP_CWORD]}\"\n args=(\"\\\\\\${COMP_WORDS[@]}\")\n\n \\${colors.gray(\"# Ask ${getAppTitle(context)} CLI to generate completions.\")}\n mapfile -t type_list < <(${getAppBin(context)} --get-completions \"\\\\\\${args[@]}\")\n mapfile -t COMPREPLY < <(compgen -W \"$( printf '%q ' \"\\\\\\${type_list[@]}\" )\" -- \"\\\\\\${cur_word}\" |\n awk '/ / { print \"\\\\\\\\\"\"$0\"\\\\\\\\\"\" } /^[^ ]+$/ { print $0 }')\n\n \\${colors.gray(\"# if no match was found, fall back to filename completion\")}\n if [ \\\\\\${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _${getAppBin(context)}_completions ${getAppBin(context)}\n\n\\${colors.gray(\"###-end-${getAppBin(context)}-completions-###\")}\n\\`); `}\n />\n <Spacing />\n <IfStatement condition={code`options.config`}>\n <VarDeclaration\n let\n name=\"configFilePath\"\n type=\"string\"\n initializer={code`options.config === true ? \"~/.bashrc\" : options.config`}\n />\n <Spacing />\n <IfStatement condition={code`configFilePath.startsWith(\"~\")`}>\n {code`configFilePath = join(os.homedir(), configFilePath.replace(\"~\", \"\")); `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"configFileContent\"\n type=\"string\"\n initializer={code`\"\";`}\n />\n <Spacing />\n {code`try {\n configFileContent = await readFile(configFilePath, \"utf8\");\n } catch (error) {\n if (error.code === \"ENOENT\") {\n // If the file doesn't exist, we can create it later when writing the completion script.\n warn(\\`Configuration file \\${colors.bold(configFilePath)} does not exist. It will be created when the completion script is written.\\`);\n } else {\n return { error };\n }\n }\n\n await writeFile(configFilePath, \\`\\${configFileContent}\\\\n\\\\n\\${stripAnsi(completions)}\\`);\n\n success(\\`${getAppTitle(context)} Bash completion script has been generated and appended to \\${colors.bold(configFilePath)}. Please restart your terminal or run \\`source \\${configFilePath}\\` to apply the changes.\\`); `}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`options.script`}>\n {code`const outputPath = options.script === true ? \"${getAppBin(context)}-completions.bash\" : options.script;\n await writeFile(outputPath, stripAnsi(completions));\n\n success(\\`${getAppTitle(context)} Bash completion script has been generated at \\${colors.bold(outputPath)}.\\`);`}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`!options.config && !options.script`}>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(completions);\n writeLine(\" ------------------------------------------------- \");`}\n </IfStatement>\n </FunctionDeclaration>\n </EntryFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0CA,SAAgBgB,kCAAkC;CAChD,MAAMC,UAAUV,eAAyC;AAEzD,QAAAW,gBACGT,WAAS;EAAA,IACRU,OAAI;AAAA,UAAEJ,UAAUE,QA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,IAAAuB,WAAA;AAAA,gBACzCvB,IAAI,iDAAiDa,UAAUI,QAAQ,CAAA;;;sBAG5DH,YAAYG,QAAQ,CAAA;;QAAgF,CAAA;OAAAC,gBAEjHZ,SAAO,EAAA,CAAA;OAAAY,gBACPhB,aAAW;QAAC+B,WAAWjC,IAAI;QAAoCuB,UAC7DvB,IAAI;;;QAE6D,CAAA;OAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA"}
@@ -1,10 +0,0 @@
1
- import * as _alloy_js_core0 from "@alloy-js/core";
2
-
3
- //#region src/components/zsh.d.ts
4
- /**
5
- * The Zsh Completions commands' handler wrapper for the Shell Shock project.
6
- */
7
- declare function ZshCompletionsCommandEntryFile(): _alloy_js_core0.Children;
8
- //#endregion
9
- export { ZshCompletionsCommandEntryFile };
10
- //# sourceMappingURL=zsh.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zsh.d.cts","names":[],"sources":["../../src/components/zsh.tsx"],"sourcesContent":[],"mappings":";;;;;;AA0CgB,iBAAA,8BAAA,CAAA,CAA8B,EAAA,eAAA,CAAA,QAAA"}
@@ -1,10 +0,0 @@
1
- import * as _alloy_js_core0 from "@alloy-js/core";
2
-
3
- //#region src/components/zsh.d.ts
4
- /**
5
- * The Zsh Completions commands' handler wrapper for the Shell Shock project.
6
- */
7
- declare function ZshCompletionsCommandEntryFile(): _alloy_js_core0.Children;
8
- //#endregion
9
- export { ZshCompletionsCommandEntryFile };
10
- //# sourceMappingURL=zsh.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zsh.d.mts","names":[],"sources":["../../src/components/zsh.tsx"],"sourcesContent":[],"mappings":";;;;;;AA0CgB,iBAAA,8BAAA,CAAA,CAA8B,EAAA,eAAA,CAAA,QAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"zsh.mjs","names":["code","FunctionDeclaration","IfStatement","InterfaceDeclaration","VarDeclaration","ReflectionKind","Spacing","usePowerlines","InterfaceMember","EntryFile","TSDoc","TSDocDefaultValue","TSDocRemarks","getAppBin","getAppTitle","joinPaths","ZshCompletionsCommandEntryFile","context","_$createComponent","path","entryPath","imports","builtinImports","children","heading","name","type","string","defaultValue","optional","async","parameters","initializer","condition","_$memo"],"sources":["../../src/components/zsh.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 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 { InterfaceMember } from \"@powerlines/plugin-alloy/typescript\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TSDocRemarks\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 Zsh Completions commands' handler wrapper for the Shell Shock project.\n */\nexport function ZshCompletionsCommandEntryFile() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <EntryFile\n path={joinPaths(context.entryPath, \"completions\", \"zsh\", \"command.ts\")}\n imports={{\n \"node:os\": [\"os\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"colors\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"stripAnsi\"\n ]\n }}>\n <TSDoc heading=\"Options for the Zsh completions command.\" />\n <InterfaceDeclaration export name=\"ZshCompletionsOptions\">\n <TSDoc heading=\"The path to write the completion script to.\">\n <TSDocRemarks>{`If no extension is provided, the \\`.zsh\\` extension will be used.`}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue={`${getAppBin(context)}-completions.zsh`}\n />\n </TSDoc>\n <InterfaceMember name=\"script\" optional type=\"string | true\" />\n <Spacing />\n <TSDoc heading=\"The Zsh configuration file to append the completion script to.\">\n <TSDocRemarks>{`The generated completion script will be appended to the specified configuration file. Possible values for the Zsh configuration file include: \\\\n- \\`~/.zshrc\\` \\\\n- \\`~/.zprofile\\``}</TSDocRemarks>\n <TSDocDefaultValue\n type={ReflectionKind.string}\n defaultValue=\"~/.zshrc\"\n />\n </TSDoc>\n <InterfaceMember name=\"config\" optional type=\"string | true\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Entry point for the Zsh completions command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[{ name: \"options\", type: \"ZshCompletionsOptions\" }]}>\n <VarDeclaration\n const\n name=\"completions\"\n type=\"string\"\n initializer={code`colors.white(\\`\\${colors.gray(\\`#compdef \\${colors.bold(\"${getAppBin(context)}\")}\\`)}\n\\${colors.gray(\"###-begin-${getAppBin(context)}-completions-###\")}\n\n\\${colors.gray(\\`\n# \\${colors.bold(\"${getAppTitle(context)} Zsh CLI command completion script\")}\n#\n# \\${colors.bold(\"Installation:\")} ${getAppBin(context)} completions zsh --config ~/.zshrc or ${getAppBin(context)} completions zsh --script or ${getAppBin(context)} completions zsh >> ~/.zshrc or ${getAppBin(context)} completions zsh >> ~/.zprofile on OSX. \\`\n)}\n\\${colors.cyan(\"_${getAppBin(context)}_completions()\")}\n{\n local reply\n local si=$IFS\n IFS=$'\\\\n' reply=($(COMP_CWORD=\"$((CURRENT-1))\" COMP_LINE=\"$BUFFER\" COMP_POINT=\"$CURSOR\" ${getAppBin(context)} --get-completions \"\\\\\\${words[@]}\"))\n IFS=$si\n if [[ \\\\\\${#reply} -gt 0 ]]; then\n _describe 'values' reply\n else\n _default\n fi\n}\n\nif [[ \"\\\\\\${zsh_eval_context[-1]}\" == \"loadautofunc\" ]]; then\n _${getAppBin(context)}_completions \"$@\"\nelse\n compdef _${getAppBin(context)}_completions ${getAppBin(context)}\nfi\ncomplete -o bashdefault -o default -F _${getAppBin(context)}_completions ${getAppBin(context)}\n\n\\${colors.gray(\"###-end-${getAppBin(context)}-completions-###\")}\n\\`);`}\n />\n <Spacing />\n <IfStatement condition={code`options.config`}>\n <VarDeclaration\n let\n name=\"configFilePath\"\n type=\"string\"\n initializer={code`options.config === true ? \"~/.zshrc\" : options.config`}\n />\n <Spacing />\n <IfStatement condition={code`configFilePath.startsWith(\"~\")`}>\n {code`configFilePath = join(os.homedir(), configFilePath.replace(\"~\", \"\")); `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"configFileContent\"\n type=\"string\"\n initializer={code`\"\";`}\n />\n <Spacing />\n {code`try {\n configFileContent = await readFile(configFilePath, \"utf8\");\n } catch (error) {\n if (error.code === \"ENOENT\") {\n // If the file doesn't exist, we can create it later when writing the completion script.\n warn(\\`Configuration file \\${colors.bold(configFilePath)} does not exist. It will be created when the completion script is written.\\`);\n } else {\n return { error };\n }\n }\n\n await writeFile(configFilePath, \\`\\${configFileContent}\\\\n\\\\n\\${stripAnsi(completions)}\\`);\n\n success(\\`${getAppTitle(context)} Zsh completion script has been generated and appended to \\${colors.bold(configFilePath)}. Please restart your terminal or run \\`source \\${configFilePath}\\` to apply the changes.\\`); `}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`options.script`}>\n {code`const outputPath = options.script === true ? \"${getAppBin(context)}-completions.zsh\" : options.script;\n await writeFile(outputPath, stripAnsi(completions));\n\n success(\\`${getAppTitle(context)} Zsh completion script has been generated at \\${colors.bold(outputPath)}.\\`);`}\n </IfStatement>\n <Spacing />\n <IfStatement condition={code`!options.config && !options.script`}>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(completions);\n writeLine(\" ------------------------------------------------- \");`}\n </IfStatement>\n </FunctionDeclaration>\n </EntryFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0CA,SAAgBgB,iCAAiC;CAC/C,MAAMC,UAAUV,eAAyC;AAEzD,QAAAW,gBACGT,WAAS;EAAA,IACRU,OAAI;AAAA,UAAEJ,UAAUE,QAAQG,WAAW,eAAe,OAAO,aAAa;;EACtEC,SAAS;GACP,WAAW,CAAC,KAAK;GACjB,oBAAoB,CAAC,YAAY,YAAW;GAC7C;EACDC,gBAAgB,EACd,uBAAuB;GACrB;GACA;GACA;GACA;GACA;GAAW,EAEd;EAAA,IAAAC,WAAA;AAAA,UAAA;IAAAL,gBACAR,OAAK,EAACc,SAAO,4CAAA,CAAA;IAAAN,gBACbf,sBAAoB;KAAA,UAAA;KAAQsB,MAAI;KAAA,IAAAF,WAAA;AAAA,aAAA;OAAAL,gBAC9BR,OAAK;QAACc,SAAO;QAAA,IAAAD,WAAA;AAAA,gBAAA,CAAAL,gBACXN,cAAY,EAAAW,UAAE,qEAAmE,CAAA,EAAAL,gBACjFP,mBAAiB;UAAA,IAChBe,OAAI;AAAA,kBAAErB,eAAesB;;UAAM,IAC3BC,eAAY;AAAA,kBAAE,GAAGf,UAAUI,QAAQ,CAAA;;UAAkB,CAAA,CAAA;;QAAA,CAAA;OAAAC,gBAGxDV,iBAAe;QAACiB,MAAI;QAAUI,UAAQ;QAACH,MAAI;QAAA,CAAA;OAAAR,gBAC3CZ,SAAO,EAAA,CAAA;OAAAY,gBACPR,OAAK;QAACc,SAAO;QAAA,IAAAD,WAAA;AAAA,gBAAA,CAAAL,gBACXN,cAAY,EAAAW,UAAE,wLAAsL,CAAA,EAAAL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