@shell-shock/plugin-completions 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/components/bash-config-command.cjs +5 -4
  2. package/dist/components/bash-config-command.mjs +5 -4
  3. package/dist/components/bash-config-command.mjs.map +1 -1
  4. package/dist/components/bash-script-command.cjs +3 -3
  5. package/dist/components/bash-script-command.mjs +3 -3
  6. package/dist/components/bash-script-command.mjs.map +1 -1
  7. package/dist/components/bash-shared.cjs +27 -14
  8. package/dist/components/bash-shared.mjs +27 -14
  9. package/dist/components/bash-shared.mjs.map +1 -1
  10. package/dist/components/fish-config-command.cjs +5 -4
  11. package/dist/components/fish-config-command.mjs +5 -4
  12. package/dist/components/fish-config-command.mjs.map +1 -1
  13. package/dist/components/fish-script-command.cjs +3 -3
  14. package/dist/components/fish-script-command.mjs +3 -3
  15. package/dist/components/fish-script-command.mjs.map +1 -1
  16. package/dist/components/fish-shared.cjs +27 -14
  17. package/dist/components/fish-shared.mjs +27 -14
  18. package/dist/components/fish-shared.mjs.map +1 -1
  19. package/dist/components/powershell-config-command.cjs +4 -3
  20. package/dist/components/powershell-config-command.mjs +4 -3
  21. package/dist/components/powershell-config-command.mjs.map +1 -1
  22. package/dist/components/powershell-script-command.cjs +3 -3
  23. package/dist/components/powershell-script-command.mjs +3 -3
  24. package/dist/components/powershell-script-command.mjs.map +1 -1
  25. package/dist/components/powershell-shared.cjs +27 -14
  26. package/dist/components/powershell-shared.mjs +27 -14
  27. package/dist/components/powershell-shared.mjs.map +1 -1
  28. package/dist/components/zsh-config-command.cjs +5 -4
  29. package/dist/components/zsh-config-command.mjs +5 -4
  30. package/dist/components/zsh-config-command.mjs.map +1 -1
  31. package/dist/components/zsh-script-command.cjs +3 -3
  32. package/dist/components/zsh-script-command.mjs +3 -3
  33. package/dist/components/zsh-script-command.mjs.map +1 -1
  34. package/dist/components/zsh-shared.cjs +27 -14
  35. package/dist/components/zsh-shared.mjs +27 -14
  36. package/dist/components/zsh-shared.mjs.map +1 -1
  37. package/package.json +4 -4
@@ -26,8 +26,9 @@ function ZshConfigCompletionsCommand() {
26
26
  "node:fs/promises": ["readFile", "writeFile"],
27
27
  "../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
28
28
  },
29
- builtinImports: { "shell-shock:console": [
30
- "colors",
29
+ builtinImports: { console: [
30
+ "bold",
31
+ "inlineCode",
31
32
  "writeLine",
32
33
  "success",
33
34
  "warn",
@@ -102,7 +103,7 @@ function ZshConfigCompletionsCommand() {
102
103
  } catch (error) {
103
104
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
104
105
  // If the file doesn't exist, we can create it later when writing the completion script.
105
- warn(\`Configuration file \${colors.bold(configPath)} does not exist. It will be created when the completion script is written.\`);
106
+ warn(\`Configuration file \${bold(configPath)} does not exist. It will be created when the completion script is written.\`);
106
107
  } else {
107
108
  return { error };
108
109
  }
@@ -110,7 +111,7 @@ function ZshConfigCompletionsCommand() {
110
111
 
111
112
  await writeFile(configPath, \`\${content}\\n\\n### Begin - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Shell Completions ###\\n\\n\${SHELL_COMPLETIONS} \\n\\n### End - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Zsh Completions ###\`);
112
113
 
113
- success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} shell completions have been applied to Zsh configuration file at \${colors.bold(configPath)}. Please restart your terminal or run \\\`source \${configPath}\\\` for the changes to take effect.\`); `)
114
+ success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} shell completions have been applied to Zsh configuration file at \${bold(configPath)}. Please restart your terminal or run \${inlineCode(\`source \${configPath}\`)} for the changes to take effect.\`); `)
114
115
  ];
115
116
  }
116
117
  }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
@@ -25,8 +25,9 @@ function ZshConfigCompletionsCommand() {
25
25
  "node:fs/promises": ["readFile", "writeFile"],
26
26
  "../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
27
27
  },
28
- builtinImports: { "shell-shock:console": [
29
- "colors",
28
+ builtinImports: { console: [
29
+ "bold",
30
+ "inlineCode",
30
31
  "writeLine",
31
32
  "success",
32
33
  "warn",
@@ -101,7 +102,7 @@ function ZshConfigCompletionsCommand() {
101
102
  } catch (error) {
102
103
  if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
103
104
  // If the file doesn't exist, we can create it later when writing the completion script.
104
- warn(\`Configuration file \${colors.bold(configPath)} does not exist. It will be created when the completion script is written.\`);
105
+ warn(\`Configuration file \${bold(configPath)} does not exist. It will be created when the completion script is written.\`);
105
106
  } else {
106
107
  return { error };
107
108
  }
@@ -109,7 +110,7 @@ function ZshConfigCompletionsCommand() {
109
110
 
110
111
  await writeFile(configPath, \`\${content}\\n\\n### Begin - ${getAppTitle(context)} Shell Completions ###\\n\\n\${SHELL_COMPLETIONS} \\n\\n### End - ${getAppTitle(context)} Zsh Completions ###\`);
111
112
 
112
- success(\`${getAppTitle(context)} shell completions have been applied to Zsh configuration file at \${colors.bold(configPath)}. Please restart your terminal or run \\\`source \${configPath}\\\` for the changes to take effect.\`); `)
113
+ success(\`${getAppTitle(context)} shell completions have been applied to Zsh configuration file at \${bold(configPath)}. Please restart your terminal or run \${inlineCode(\`source \${configPath}\`)} for the changes to take effect.\`); `)
113
114
  ];
114
115
  }
115
116
  }), createComponent(ElseClause, { get children() {
@@ -1 +1 @@
1
- {"version":3,"file":"zsh-config-command.mjs","names":[],"sources":["../../src/components/zsh-config-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n 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 { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Zsh Completions - Configuration command's handler wrapper for the Shell Shock project.\n */\nexport function ZshConfigCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"zsh\",\n \"config\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"colors\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"help\"\n ]\n }}>\n <TSDoc heading=\"Options for the Zsh Completions - Configuration command.\" />\n <InterfaceDeclaration export name=\"ZshConfigCompletionsOptions\">\n <TSDoc heading=\"Should the generated completion script be written to console output instead of an actual file on disk? This is useful for debugging purposes or if you want to manually handle the output.\">\n <TSDocDefaultValue\n type={ReflectionKind.boolean}\n defaultValue={false}\n />\n </TSDoc>\n <InterfaceMember name=\"display\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions zsh config\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"ZshConfigCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"~/.zshrc\"`\n }\n ]}>\n <IfStatement condition={code`options.display !== true`}>\n <VarDeclaration\n let\n name=\"configPath\"\n type=\"string\"\n initializer={code` path.includes(\".\") ? path : join(path, \".zshrc\");`}\n />\n <Spacing />\n <IfStatement condition={code`configPath.startsWith(\"~\")`}>\n {code`configPath = join(os.homedir(), configPath.replace(\"~\", \"\")); `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"content\"\n type=\"string\"\n initializer={code`\"\";`}\n />\n <Spacing />\n {code`try {\n content = await readFile(configPath, \"utf8\");\n } catch (error) {\n if (typeof error === \"object\" && error !== null && \"code\" in error && error.code === \"ENOENT\") {\n // If the file doesn't exist, we can create it later when writing the completion script.\n warn(\\`Configuration file \\${colors.bold(configPath)} does not exist. It will be created when the completion script is written.\\`);\n } else {\n return { error };\n }\n }\n\n await writeFile(configPath, \\`\\${content}\\\\n\\\\n### Begin - ${getAppTitle(context)} Shell Completions ###\\\\n\\\\n\\${SHELL_COMPLETIONS} \\\\n\\\\n### End - ${getAppTitle(\n context\n )} Zsh Completions ###\\`);\n\n success(\\`${getAppTitle(\n context\n )} shell completions have been applied to Zsh configuration file at \\${colors.bold(configPath)}. Please restart your terminal or run \\\\\\`source \\${configPath}\\\\\\` for the changes to take effect.\\`); `}\n </IfStatement>\n <ElseClause>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(\"\");\n writeLine(\\`### Begin - ${getAppTitle(context)} Zsh Completions ###\\`);\n writeLine(\"\");\n SHELL_COMPLETIONS_DISPLAY.split(\"\\\\n\").map(line => writeLine(line));\n writeLine(\"\");\n writeLine(\\`### End - ${getAppTitle(context)} Zsh Completions ###\\`);\n writeLine(\"\");\n writeLine(\" ------------------------------------------------- \");\n\n writeLine(\"\");\n help(\\`To enable these completions, perform one of the following actions:\n\n 1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/zsh/.zshrc)\n 2) Save the above script to a file and source it from your shell configuration file \\`); `}\n </ElseClause>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,SAAO,8BAAA;CACL,MAAK,UAAA,eAAA;AACL,QAAA,gBAAA,gBAAA;EACA,IAAM,OAAC;AACH,UAAG,UAAc,QAAO,WAAY,eAAY,OAAM,UAAA,aAAA;;EAE5D,SAAa;;GAEX,aAAA,CAAA,OAAA;GACI,oBAAmB,CAAA,YAAc,YAAU;GAC/C,aAAA,CAAA,qBAAA,4BAAA;GACF;EACE,gBAAgB;;;;;;KAEhB;EACE,IAAC,WAAA;AACC,UAAM;IAAA,gBAAS,SAAA,EACb,SAAQ,4DACT,CAAC;IAAC,gBAAY,sBAAA;KACb,UAAK;KACL,MAAC;KACD,IAAC,WAAU;AACZ,aAAA,CAAA,gBAAA,SAAA;OACD,SAAS;OACN,IAAO,WAAO;AACT,eAAO,gBAAQ,qBAAA;SACb,IAAC,OAAU;AACT,iBAAK,eAAiB;;SAElC,cAAgB;SACP,CAAA;;OAEJ,CAAA,EAAA,gBAAU,mBAAA;OACV,MAAO;OACP,UAAK;OACL,MAAI;OACP,CAAA,CAAA;;KAED,CAAA;IAAA,gBAAe,SAAe,EAAC,CAAA;IAAI,gBAAc,SAAA,EACjD,SAAA,+DACA,CAAC;IAAC,gBAAe,qBAAqB;KACrC,UAAG;KACH,WAAU;KACV,OAAI;KACJ,MAAG;KACH,YAAO,CAAA;MACN,MAAA;MACD,MAAA;MACD,SAAS;MACT,EAAA;MACA,MAAA;MACC,MAAA;MACA,SAAA;MACA,CAAA;KACA,IAAI,WAAS;AACb,aAAA,CAAU,gBAAE,aAAA;OACV,WAAA,IAAA;OACE,IAAI,WAAW;AACf,eAAO;SAAA,gBAAA,gBAA4B;UACnC,OAAW;UACZ,MAAA;UACD,MAAA;UACM,aAAQ,IAAA;UACZ,CAAI;SAAE,gBAAQ,SAAA,EAAA,CAAA;SAAA,gBAAA,aAAA;UACd,WAAc,IAAK;UACrB,UAAA,IAAA;UACA,CAAA;SAAA,gBAAA,SAAA,EAAA,CAAA;SAAA,gBAAA,gBAAA;UACD,OAAY;UACV,MAAA;UACC,MAAA;UACI,aAAY,IAAA;UAChB,CAAI;SAAE,gBAAM,SAAA,EAAA,CAAA;SAAA,WAAA,IAAA;;;;;;;;;;;uEAWA,YAAA,QAAA,CAAA,oEAAA,YAAA,QAAA,CAAA;;sBAEb,YAAA,QAAA,CAAA,uMAAA;SAAA;;OAEA,CAAA,EAAA,gBAAS,YAAA,EACR,IAAA,WAAe;AACf,cAAO,IAAM;;sCAEY,YAAa,QAAQ,CAAA;;;;oCAI9C,YAAA,QAAA,CAAA;;;;;;;;;SAUF,CAAA,CAAA;;KAEH,CAAC;IAAC;;EAEN,CAAC"}
1
+ {"version":3,"file":"zsh-config-command.mjs","names":[],"sources":["../../src/components/zsh-config-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n 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 { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Zsh Completions - Configuration command's handler wrapper for the Shell Shock project.\n */\nexport function ZshConfigCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"zsh\",\n \"config\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n console: [\"bold\", \"inlineCode\", \"writeLine\", \"success\", \"warn\", \"help\"]\n }}>\n <TSDoc heading=\"Options for the Zsh Completions - Configuration command.\" />\n <InterfaceDeclaration export name=\"ZshConfigCompletionsOptions\">\n <TSDoc heading=\"Should the generated completion script be written to console output instead of an actual file on disk? This is useful for debugging purposes or if you want to manually handle the output.\">\n <TSDocDefaultValue\n type={ReflectionKind.boolean}\n defaultValue={false}\n />\n </TSDoc>\n <InterfaceMember name=\"display\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions zsh config\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"ZshConfigCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"~/.zshrc\"`\n }\n ]}>\n <IfStatement condition={code`options.display !== true`}>\n <VarDeclaration\n let\n name=\"configPath\"\n type=\"string\"\n initializer={code` path.includes(\".\") ? path : join(path, \".zshrc\");`}\n />\n <Spacing />\n <IfStatement condition={code`configPath.startsWith(\"~\")`}>\n {code`configPath = join(os.homedir(), configPath.replace(\"~\", \"\")); `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"content\"\n type=\"string\"\n initializer={code`\"\";`}\n />\n <Spacing />\n {code`try {\n content = await readFile(configPath, \"utf8\");\n } catch (error) {\n if (typeof error === \"object\" && error !== null && \"code\" in error && error.code === \"ENOENT\") {\n // If the file doesn't exist, we can create it later when writing the completion script.\n warn(\\`Configuration file \\${bold(configPath)} does not exist. It will be created when the completion script is written.\\`);\n } else {\n return { error };\n }\n }\n\n await writeFile(configPath, \\`\\${content}\\\\n\\\\n### Begin - ${getAppTitle(context)} Shell Completions ###\\\\n\\\\n\\${SHELL_COMPLETIONS} \\\\n\\\\n### End - ${getAppTitle(\n context\n )} Zsh Completions ###\\`);\n\n success(\\`${getAppTitle(\n context\n )} shell completions have been applied to Zsh configuration file at \\${bold(configPath)}. Please restart your terminal or run \\${inlineCode(\\`source \\${configPath}\\`)} for the changes to take effect.\\`); `}\n </IfStatement>\n <ElseClause>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(\"\");\n writeLine(\\`### Begin - ${getAppTitle(context)} Zsh Completions ###\\`);\n writeLine(\"\");\n SHELL_COMPLETIONS_DISPLAY.split(\"\\\\n\").map(line => writeLine(line));\n writeLine(\"\");\n writeLine(\\`### End - ${getAppTitle(context)} Zsh Completions ###\\`);\n writeLine(\"\");\n writeLine(\" ------------------------------------------------- \");\n\n writeLine(\"\");\n help(\\`To enable these completions, perform one of the following actions:\n\n 1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/zsh/.zshrc)\n 2) Save the above script to a file and source it from your shell configuration file \\`); `}\n </ElseClause>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,SAAO,8BAAA;CACL,MAAK,UAAA,eAAA;AACL,QAAA,gBAAA,gBAAA;EACA,IAAM,OAAC;AACH,UAAG,UAAc,QAAO,WAAY,eAAY,OAAM,UAAA,aAAA;;EAE5D,SAAa;;GAEX,aAAA,CAAA,OAAA;GACI,oBAAmB,CAAA,YAAc,YAAU;GAC/C,aAAA,CAAA,qBAAA,4BAAA;GACF;EACE,gBAAgB;;;;;;;KAEhB;EACE,IAAC,WAAA;AACC,UAAM;IAAA,gBAAS,SAAA,EACb,SAAQ,4DACT,CAAC;IAAC,gBAAY,sBAAA;KACb,UAAK;KACL,MAAC;KACD,IAAC,WAAU;AACZ,aAAA,CAAA,gBAAA,SAAA;OACD,SAAS;OACN,IAAO,WAAO;AACT,eAAO,gBAAQ,qBAAA;SACb,IAAC,OAAU;AACT,iBAAK,eAAiB;;SAElC,cAAgB;SACP,CAAC;;OAET,CAAK,EAAC,gBAAiB,mBAAY;OACnC,MAAA;OACE,UAAa;OACX,MAAA;OACA,CAAC,CAAA;;KAEL,CAAC;IAAE,gBAAC,SAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EACH,SAAO,+DACR,CAAC;IAAC,gBAAgB,qBAAwB;KACzC,UAAA;KACD,WAAS;KACT,OAAM;KACN,MAAA;KACC,YAAA,CAAA;MACA,MAAA;MACA,MAAA;MACA,SAAM;MACN,EAAA;MACE,MAAA;MACA,MAAM;MACN,SAAS;MACV,CAAC;KACF,IAAG,WAAA;AACD,aAAA,CAAA,gBAAA,aAAA;OACE,WAAW,IAAC;OACZ,IAAI,WAAU;AACd,eAAS;SAAC,gBAAU,gBAAA;UACtB,OAAA;UACA,MAAA;UACD,MAAY;UACV,aAAA,IAAA;UACC,CAAA;SAAA,gBAAA,SAAA,EAAA,CAAA;SAAA,gBAAA,aAAA;UACI,WAAE,IAAU;UACZ,UAAQ,IAAA;UACZ,CAAA;SAAA,gBAAwB,SAAS,EAAE,CAAC;SAAE,gBAAkB,gBAAa;UACtE,OAAA;UACA,MAAS;UACT,MAAW;UACT,aAAgB,IAAE;UACnB,CAAA;SAAA,gBAAW,SAAA,EAAA,CAAA;SAAA,WAAA,IAAA;;;;;;;;;;;uEAWG,YAAA,QAAA,CAAA,oEAAA,YAAA,QAAA,CAAA;;sBAEN,YAAc,QAAQ,CAAC,4MAA0D;SAAA;;OAE1F,CAAC,EAAE,gBAAK,YAAA,EACP,IAAE,WAAS;AACX,cAAA,IAAA;;;;;;;;;;;;;;;SAgBD,CAAC,CAAA;;KAEL,CAAC;IAAC;;EAEN,CAAC"}
@@ -29,8 +29,8 @@ function ZshScriptCompletionsCommand() {
29
29
  "node:fs/promises": ["readFile", "writeFile"],
30
30
  "../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
31
31
  },
32
- builtinImports: { "shell-shock:console": [
33
- "colors",
32
+ builtinImports: { console: [
33
+ "bold",
34
34
  "writeLine",
35
35
  "success",
36
36
  "warn",
@@ -89,7 +89,7 @@ function ZshScriptCompletionsCommand() {
89
89
  initializer: _alloy_js_core.code` path.includes(".") ? \`\${path}.zsh\` : path;`
90
90
  }), (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`await writeFile(scriptPath, \`# Zsh script to add completions for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)}\\n\\n\${SHELL_COMPLETIONS}\`);
91
91
 
92
- success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Zsh completion script has been generated at \${colors.bold(scriptPath)}.\`);`)];
92
+ success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Zsh completion script has been generated at \${bold(scriptPath)}.\`);`)];
93
93
  }
94
94
  }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
95
95
  return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
@@ -28,8 +28,8 @@ function ZshScriptCompletionsCommand() {
28
28
  "node:fs/promises": ["readFile", "writeFile"],
29
29
  "../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
30
30
  },
31
- builtinImports: { "shell-shock:console": [
32
- "colors",
31
+ builtinImports: { console: [
32
+ "bold",
33
33
  "writeLine",
34
34
  "success",
35
35
  "warn",
@@ -88,7 +88,7 @@ function ZshScriptCompletionsCommand() {
88
88
  initializer: code` path.includes(".") ? \`\${path}.zsh\` : path;`
89
89
  }), memo(() => code`await writeFile(scriptPath, \`# Zsh script to add completions for ${getAppTitle(context)}\\n\\n\${SHELL_COMPLETIONS}\`);
90
90
 
91
- success(\`${getAppTitle(context)} Zsh completion script has been generated at \${colors.bold(scriptPath)}.\`);`)];
91
+ success(\`${getAppTitle(context)} Zsh completion script has been generated at \${bold(scriptPath)}.\`);`)];
92
92
  }
93
93
  }), createComponent(ElseClause, { get children() {
94
94
  return code`writeLine(" ------------------------------------------------- ");
@@ -1 +1 @@
1
- {"version":3,"file":"zsh-script-command.mjs","names":[],"sources":["../../src/components/zsh-script-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InterfaceMember,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocDefaultValue\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Zsh Completions - Script command's handler wrapper for the Shell Shock project.\n */\nexport function ZshScriptCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n const name = computed(() => snakeCase(bin.value));\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"zsh\",\n \"script\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"colors\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"help\"\n ]\n }}>\n <TSDoc heading=\"Options for the Zsh Completions - Script command.\" />\n <InterfaceDeclaration export name=\"ZshScriptCompletionsOptions\">\n <TSDoc heading=\"Should the generated completion script be written to console output instead of an actual file on disk? This is useful for debugging purposes or if you want to manually handle the output.\">\n <TSDocDefaultValue\n type={ReflectionKind.boolean}\n defaultValue={false}\n />\n </TSDoc>\n <InterfaceMember name=\"display\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions zsh script\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"ZshScriptCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"${bin.value}-completions.zsh\"`\n }\n ]}>\n <IfStatement condition={code`options.display !== true`}>\n <VarDeclaration\n const\n name=\"scriptPath\"\n type=\"string\"\n initializer={code` path.includes(\".\") ? \\`\\${path}.zsh\\` : path;`}\n />\n {code`await writeFile(scriptPath, \\`# Zsh script to add completions for ${getAppTitle(context)}\\\\n\\\\n\\${SHELL_COMPLETIONS}\\`);\n\n success(\\`${getAppTitle(\n context\n )} Zsh completion script has been generated at \\${colors.bold(scriptPath)}.\\`);`}\n </IfStatement>\n <ElseClause>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(\"\");\n writeLine(\"#compdef ${bin.value} \");\n writeLine(\"#compdef _${name.value} ${bin.value}\");\n writeLine(\"\");\n writeLine(\"# Zsh completion for ${getAppTitle(context)}\");\n writeLine(\"\");\n SHELL_COMPLETIONS_DISPLAY.split(\"\\\\n\").map(line => writeLine(line));\n writeLine(\"\");\n writeLine(\" ------------------------------------------------- \");\n\n writeLine(\"\");\n help(\\`To enable these completions, perform one of the following actions:\n\n 1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/zsh/.zshrc)\n 2) Save the above script to a file and source it from your shell configuration file \\`); `}\n </ElseClause>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,SAAO,8BAAA;CACL,MAAA,UAAA,eAAA;CACA,MAAM,MAAC,eAAkB,UAAM,QAAW,CAAA;CAC5C,MAAQ,OAAC,eAAW,UAAoB,IAAC,MAAM,CAAA;AAC/C,QAAS,gBAAkB,gBAAa;EACxC,IAAQ,OAAC;AACH,UAAO,UAAC,QAAA,WAA2B,eAAe,OAAO,UAAA,aAAA;;EAE7D,SAAA;GACI,WAAK;GACT,aAAA,CAAA,OAAA;GACI,oBAAU,CAAA,YAAA,YAA8B;GAC5C,aAAgB,CAAA,qBAAc,4BAA2B;;EAEzD,gBAAY,EACZ,uBAA2B;GAAC;GAAU;GAAW;GAAA;GAAA;GAAA;EAEjD,IAAM,WAAC;AACJ,UAAA;IAAA,gBAAA,SAAA,EACC,SAAM,qDACL,CAAC;IAAA,gBAAiB,sBAAA;KACjB,UAAC;KACD,MAAK;KACL,IAAC,WAAO;AACP,aAAQ,CAAA,gBAAE,SAAA;OACZ,SAAA;OACD,IAAS,WAAA;AACD,eAAM,gBAAG,qBAAA;SACT,IAAM,OAAO;AACV,iBAAQ,eAAe;;SAEjC,cAAA;SACD,CAAA;;OAEK,CAAA,EAAA,gBAAO,mBAAA;OACP,MAAA;OACA,UAAQ;OACR,MAAK;OACL,CAAA,CAAA;;KAEJ,CAAC;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EACD,SAAM,+DACN,CAAA;IAAA,gBAAqB,qBAAa;KACjC,UAAO;KACP,WAAG;KACH,OAAI;KACJ,MAAI;KACJ,IAAG,aAAA;AACD,aAAK,CAAA;OACN,MAAA;OACD,MAAA;OACD,SAAS;OACT,EAAM;OACN,MAAA;OACC,MAAA;OACA,SAAA,IAAA,IAAA,MAAA;OACA,CAAA;;KAEA,IAAA,WAAY;AACV,aAAA,CAAA,gBAAA,aAAA;OACE,WAAO,IAAQ;OACf,IAAI,WAAG;AACP,eAAS,CAAC,gBAAE,gBAAA;SACb,SAAA;SACD,MAAA;SACM,MAAG;SACH,aAAU,IAAA;SACd,CAAA,EAAA,WAAiB,IAAM,qEAAiB,YAAA,QAAA,CAAA;;wBAE1C,YAAA,QAAA,CAAA,+EAAA,CAAA;;OAEC,CAAA,EAAA,gBAAA,YAAA,EACC,IAAA,WAAA;AACA,cAAM,IAAA;;kCAEa,IAAK,MAAQ;mCACjC,KAAA,MAAA,GAAA,IAAA,MAAA;;;;;;;;;;;;;SAcA,CAAC,CAAA;;KAEL,CAAC;IAAC"}
1
+ {"version":3,"file":"zsh-script-command.mjs","names":[],"sources":["../../src/components/zsh-script-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InterfaceMember,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocDefaultValue\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Zsh Completions - Script command's handler wrapper for the Shell Shock project.\n */\nexport function ZshScriptCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n const name = computed(() => snakeCase(bin.value));\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"zsh\",\n \"script\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n console: [\"bold\", \"writeLine\", \"success\", \"warn\", \"help\"]\n }}>\n <TSDoc heading=\"Options for the Zsh Completions - Script command.\" />\n <InterfaceDeclaration export name=\"ZshScriptCompletionsOptions\">\n <TSDoc heading=\"Should the generated completion script be written to console output instead of an actual file on disk? This is useful for debugging purposes or if you want to manually handle the output.\">\n <TSDocDefaultValue\n type={ReflectionKind.boolean}\n defaultValue={false}\n />\n </TSDoc>\n <InterfaceMember name=\"display\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions zsh script\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"ZshScriptCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"${bin.value}-completions.zsh\"`\n }\n ]}>\n <IfStatement condition={code`options.display !== true`}>\n <VarDeclaration\n const\n name=\"scriptPath\"\n type=\"string\"\n initializer={code` path.includes(\".\") ? \\`\\${path}.zsh\\` : path;`}\n />\n {code`await writeFile(scriptPath, \\`# Zsh script to add completions for ${getAppTitle(context)}\\\\n\\\\n\\${SHELL_COMPLETIONS}\\`);\n\n success(\\`${getAppTitle(\n context\n )} Zsh completion script has been generated at \\${bold(scriptPath)}.\\`);`}\n </IfStatement>\n <ElseClause>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(\"\");\n writeLine(\"#compdef ${bin.value} \");\n writeLine(\"#compdef _${name.value} ${bin.value}\");\n writeLine(\"\");\n writeLine(\"# Zsh completion for ${getAppTitle(context)}\");\n writeLine(\"\");\n SHELL_COMPLETIONS_DISPLAY.split(\"\\\\n\").map(line => writeLine(line));\n writeLine(\"\");\n writeLine(\" ------------------------------------------------- \");\n\n writeLine(\"\");\n help(\\`To enable these completions, perform one of the following actions:\n\n 1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/zsh/.zshrc)\n 2) Save the above script to a file and source it from your shell configuration file \\`); `}\n </ElseClause>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,SAAO,8BAAA;CACL,MAAA,UAAA,eAAA;CACA,MAAM,MAAC,eAAkB,UAAM,QAAW,CAAA;CAC5C,MAAQ,OAAC,eAAW,UAAoB,IAAC,MAAM,CAAA;AAC/C,QAAS,gBAAkB,gBAAa;EACxC,IAAQ,OAAC;AACH,UAAO,UAAC,QAAA,WAA2B,eAAe,OAAO,UAAA,aAAA;;EAE7D,SAAA;GACI,WAAK;GACT,aAAA,CAAA,OAAA;GACI,oBAAU,CAAA,YAAA,YAA8B;GAC5C,aAAgB,CAAA,qBAAc,4BAA2B;;EAEzD,gBAAY,EACZ,SAAa;GAAA;GAAS;GAAM;GAAc;GAAO;GAAA;EAEjD,IAAM,WAAC;AACJ,UAAA;IAAA,gBAAA,SAAA,EACC,SAAM,qDACL,CAAC;IAAA,gBAAiB,sBAAA;KACjB,UAAC;KACD,MAAK;KACL,IAAC,WAAO;AACP,aAAQ,CAAA,gBAAE,SAAA;OACZ,SAAA;OACD,IAAS,WAAA;AACD,eAAM,gBAAG,qBAAA;SACT,IAAM,OAAO;AACV,iBAAQ,eAAe;;SAEjC,cAAA;SACD,CAAA;;OAEE,CAAA,EAAA,gBAAA,mBAAA;OACI,MAAC;OACN,UAAA;OACE,MAAM;OACJ,CAAA,CAAA;;KAEJ,CAAC;IAAE,gBAAgB,SAAK,EAAA,CAAA;IAAA,gBAAA,SAAA,EACvB,SAAG,+DACJ,CAAC;IAAE,gBAAK,qBAAA;KACP,UAAC;KACD,WAAA;KACD,OAAQ;KACR,MAAM;KACN,IAAA,aAAA;AACC,aAAA,CAAA;OACA,MAAA;OACA,MAAA;OACI,SAAS;OACb,EAAA;OACE,MAAA;OACE,MAAM;OACN,SAAO,IAAA,IAAA,MAAA;OACR,CAAC;;KAEJ,IAAE,WAAA;AACA,aAAO,CAAC,gBAAM,aAAA;OACZ,WAAO,IAAO;OACd,IAAA,WAAa;AACf,eAAA,CAAA,gBAAA,gBAAA;SACA,SAAA;SACD,MAAY;SACV,MAAA;SACC,aAAA,IAAA;SACA,CAAI,EAAE,WAAU,IAAA,qEAAA,YAAA,QAAA,CAAA;;wBAEJ,YAAY,QAAQ,CAAC,wEAAgC,CAAA;;OAElE,CAAA,EAAA,gBAAqB,YAAY;AAEhC,cAAS,IAAG;;kCAEM,IAAO,MAAI;mCACpB,KAAA,MAAA,GAAA,IAAA,MAAA;;8CAEyB,YAAY,QAAQ,CAAC;;;;;;;;;;;SAYxD,CAAC,CAAA;;KAEL,CAAC;IAAC;;EAEN,CAAC"}
@@ -24,7 +24,20 @@ function ZshCompletionsShared() {
24
24
  get path() {
25
25
  return (0, _stryke_path.joinPaths)(context.entryPath, "completions", "zsh", "shared.ts");
26
26
  },
27
- builtinImports: { console: ["colors"] },
27
+ builtinImports: { console: [
28
+ "white",
29
+ "green",
30
+ "red",
31
+ "bold",
32
+ "cyan",
33
+ "gray",
34
+ "magenta",
35
+ "magentaBright",
36
+ "greenBright",
37
+ "redBright",
38
+ "cyanBright",
39
+ "dim"
40
+ ] },
28
41
  get children() {
29
42
  return [
30
43
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
@@ -254,21 +267,21 @@ fi
254
267
  return "";
255
268
  }
256
269
  if (line.trim().startsWith("#")) {
257
- return \`\${colors.dim(line)}\`;
270
+ return \`\${dim(line)}\`;
258
271
  }
259
272
 
260
- return colors.white(line).replaceAll(/(?<=\\\$(\\{|\\()).*(?=(\\}\\)))/g, colors.green("$&"))
261
- .replaceAll(/\\".*\\"/g, colors.cyan("$&"))
262
- .replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|:)/g, colors.bold(colors.gray("$&")))
263
- .replaceAll(/(readonly|complete)\\s+/g, colors.green("$&"))
264
- .replaceAll(/(?<=(readonly|complete)\\s+)\\w/g, colors.bold(colors.greenBright("$&")))
265
- .replaceAll(/local\\s+/g, colors.red("$&"))
266
- .replaceAll(/(?<=local\\s+)\\w/g, colors.bold(colors.redBright("$&")))
267
- .replaceAll(/(for|while)\\s+/g, colors.cyan("$&"))
268
- .replaceAll(/(?<=for|while\\s+)\\w/g, colors.bold(colors.cyanBright("$&")))
269
- .replaceAll(/(return|if|fi|else|elif|then|done)\\s+/g, colors.green("$&"))
270
- .replaceAll(/__\\w/g, colors.bold(colors.magentaBright("$&")))
271
- .replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, colors.bold(colors.magenta("$&")));
273
+ return white(line).replaceAll(/(?<=\\\$(\\{|\\()).*(?=(\\}\\)))/g, green("$&"))
274
+ .replaceAll(/\\".*\\"/g, cyan("$&"))
275
+ .replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|:)/g, bold(gray("$&")))
276
+ .replaceAll(/(readonly|complete)\\s+/g, green("$&"))
277
+ .replaceAll(/(?<=(readonly|complete)\\s+)\\w/g, bold(greenBright("$&")))
278
+ .replaceAll(/local\\s+/g, red("$&"))
279
+ .replaceAll(/(?<=local\\s+)\\w/g, bold(redBright("$&")))
280
+ .replaceAll(/(for|while)\\s+/g, cyan("$&"))
281
+ .replaceAll(/(?<=for|while\\s+)\\w/g, bold(cyanBright("$&")))
282
+ .replaceAll(/(return|if|fi|else|elif|then|done)\\s+/g, green("$&"))
283
+ .replaceAll(/__\\w/g, bold(magentaBright("$&")))
284
+ .replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, bold(magenta("$&")));
272
285
 
273
286
  }).join("\\n"); `
274
287
  })
@@ -23,7 +23,20 @@ function ZshCompletionsShared() {
23
23
  get path() {
24
24
  return joinPaths(context.entryPath, "completions", "zsh", "shared.ts");
25
25
  },
26
- builtinImports: { console: ["colors"] },
26
+ builtinImports: { console: [
27
+ "white",
28
+ "green",
29
+ "red",
30
+ "bold",
31
+ "cyan",
32
+ "gray",
33
+ "magenta",
34
+ "magentaBright",
35
+ "greenBright",
36
+ "redBright",
37
+ "cyanBright",
38
+ "dim"
39
+ ] },
27
40
  get children() {
28
41
  return [
29
42
  createComponent(Spacing, {}),
@@ -253,21 +266,21 @@ fi
253
266
  return "";
254
267
  }
255
268
  if (line.trim().startsWith("#")) {
256
- return \`\${colors.dim(line)}\`;
269
+ return \`\${dim(line)}\`;
257
270
  }
258
271
 
259
- return colors.white(line).replaceAll(/(?<=\\\$(\\{|\\()).*(?=(\\}\\)))/g, colors.green("$&"))
260
- .replaceAll(/\\".*\\"/g, colors.cyan("$&"))
261
- .replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|:)/g, colors.bold(colors.gray("$&")))
262
- .replaceAll(/(readonly|complete)\\s+/g, colors.green("$&"))
263
- .replaceAll(/(?<=(readonly|complete)\\s+)\\w/g, colors.bold(colors.greenBright("$&")))
264
- .replaceAll(/local\\s+/g, colors.red("$&"))
265
- .replaceAll(/(?<=local\\s+)\\w/g, colors.bold(colors.redBright("$&")))
266
- .replaceAll(/(for|while)\\s+/g, colors.cyan("$&"))
267
- .replaceAll(/(?<=for|while\\s+)\\w/g, colors.bold(colors.cyanBright("$&")))
268
- .replaceAll(/(return|if|fi|else|elif|then|done)\\s+/g, colors.green("$&"))
269
- .replaceAll(/__\\w/g, colors.bold(colors.magentaBright("$&")))
270
- .replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, colors.bold(colors.magenta("$&")));
272
+ return white(line).replaceAll(/(?<=\\\$(\\{|\\()).*(?=(\\}\\)))/g, green("$&"))
273
+ .replaceAll(/\\".*\\"/g, cyan("$&"))
274
+ .replaceAll(/(\\[|\\]|\\(|\\)|\\||<|>|\\$\\(|\\$?\\{|\\}|\\+|=|;|:)/g, bold(gray("$&")))
275
+ .replaceAll(/(readonly|complete)\\s+/g, green("$&"))
276
+ .replaceAll(/(?<=(readonly|complete)\\s+)\\w/g, bold(greenBright("$&")))
277
+ .replaceAll(/local\\s+/g, red("$&"))
278
+ .replaceAll(/(?<=local\\s+)\\w/g, bold(redBright("$&")))
279
+ .replaceAll(/(for|while)\\s+/g, cyan("$&"))
280
+ .replaceAll(/(?<=for|while\\s+)\\w/g, bold(cyanBright("$&")))
281
+ .replaceAll(/(return|if|fi|else|elif|then|done)\\s+/g, green("$&"))
282
+ .replaceAll(/__\\w/g, bold(magentaBright("$&")))
283
+ .replaceAll(/(?<=\\s)(-\\w|--\\w[\\w-]*)(?=\\s|$)/g, bold(magenta("$&")));
271
284
 
272
285
  }).join("\\n"); `
273
286
  })
@@ -1 +1 @@
1
- {"version":3,"file":"zsh-shared.mjs","names":[],"sources":["../../src/components/zsh-shared.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript\";\nimport { getAppBin } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { CompletionDirective } from \"../helpers\";\nimport { EXEC_COMMAND } from \"../helpers/complete-command\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Zsh Completions generation for the Shell Shock project.\n */\nexport function ZshCompletionsShared() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n const name = computed(() => snakeCase(bin.value));\n\n return (\n <TypescriptFile\n path={joinPaths(context.entryPath, \"completions\", \"zsh\", \"shared.ts\")}\n builtinImports={{\n console: [\"colors\"]\n }}>\n <Spacing />\n <VarDeclaration\n const\n export\n name=\"SHELL_COMPLETIONS\"\n initializer={code` \\`__${name.value}_debug() {\n local file=\"$BASH_COMP_DEBUG_FILE\"\n if [[ -n \\\\\\${file} ]]; then\n echo \"$*\" >> \"\\\\\\${file}\"\n fi\n}\n\n_${name.value}() {\n local shellCompDirectiveError=${\n CompletionDirective.CompletionDirectiveError\n }\n local shellCompDirectiveNoSpace=${\n CompletionDirective.CompletionDirectiveNoSpace\n }\n local shellCompDirectiveNoFileComp=${\n CompletionDirective.CompletionDirectiveNoFileComp\n }\n local shellCompDirectiveFilterFileExt=${\n CompletionDirective.CompletionDirectiveFilterFileExt\n }\n local shellCompDirectiveFilterDirs=${\n CompletionDirective.CompletionDirectiveFilterDirs\n }\n local shellCompDirectiveKeepOrder=${\n CompletionDirective.CompletionDirectiveKeepOrder\n }\n\n local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder\n local -a completions\n\n __${name.value}_debug \"\\\\n========= starting completion logic ==========\"\n __${name.value}_debug \"CURRENT: \\\\\\${CURRENT}, words[*]: \\\\\\${words[*]}\"\n\n # The user could have moved the cursor backwards on the command-line.\n # We need to trigger completion from the $CURRENT location, so we need\n # to truncate the command-line ($words) up to the $CURRENT location.\n # (We cannot use $CURSOR as its value does not work when a command is an alias.)\n words=( \"\\\\\\${=words[1,CURRENT]}\" )\n __${name.value}_debug \"Truncated words[*]: \\\\\\${words[*]},\"\n\n lastParam=\\\\\\${words[-1]}\n lastChar=\\\\\\${lastParam[-1]}\n __${name.value}_debug \"lastParam: \\\\\\${lastParam}, lastChar: \\\\\\${lastChar}\"\n # For zsh, when completing a flag with an = (e.g., ${bin.value} -n=<TAB>)\n # completions must be prefixed with the flag\n setopt local_options BASH_REMATCH\n if [[ \"\\\\\\${lastParam}\" =~ '-.*=' ]]; then\n # We are dealing with a flag with an =\n flagPrefix=\"-P \\\\\\${BASH_REMATCH}\"\n fi\n\n # Prepare the command to obtain completions, ensuring arguments are quoted for eval\n local -a args_to_quote=(\"\\\\\\${(@)words[2,-1]}\")\n if [ \"\\\\\\${lastChar}\" = \"\" ]; then\n # If the last parameter is complete (there is a space following it)\n # We add an extra empty parameter so we can indicate this to the go completion code.\n __${name.value}_debug \"Adding extra empty parameter\"\n args_to_quote+=(\"\")\n fi\n\n # Use Zsh's (q) flag to quote each argument safely for eval\n local quoted_args=(\"\\\\\\${(@q)args_to_quote}\")\n\n # Join the main command and the quoted arguments into a single string for eval\n requestComp=\"${EXEC_COMMAND} complete -- \\\\\\${quoted_args[*]}\"\n\n __${name.value}_debug \"About to call: eval \\\\\\${requestComp}\"\n\n # Use eval to handle any environment variables and such\n out=$(eval \\\\\\${requestComp} 2>/dev/null)\n __${name.value}_debug \"completion output: \\\\\\${out}\"\n\n # Extract the directive integer following a : from the last line\n local lastLine\n while IFS='\\n' read -r line; do\n lastLine=\\\\\\${line}\n done < <(printf \"%s\\n\" \"\\\\\\${out[@]}\")\n __${name.value}_debug \"last line: \\\\\\${lastLine}\"\n\n if [ \"\\\\\\${lastLine[1]}\" = : ]; then\n directive=\\\\\\${lastLine[2,-1]}\n # Remove the directive including the : and the newline\n local suffix\n (( suffix=\\\\\\${#lastLine}+2))\n out=\\\\\\${out[1,-$suffix]}\n else\n # There is no directive specified. Leave $out as is.\n __${name.value}_debug \"No directive found. Setting to default\"\n directive=0\n fi\n\n __${name.value}_debug \"directive: \\\\\\${directive}\"\n __${name.value}_debug \"completions: \\\\\\${out}\"\n __${name.value}_debug \"flagPrefix: \\\\\\${flagPrefix}\"\n\n if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then\n __${name.value}_debug \"Completion received error. Ignoring completions.\"\n return\n fi\n\n local activeHelpMarker=\"%\"\n local endIndex=\\\\\\${#activeHelpMarker}\n local startIndex=$((\\\\\\${#activeHelpMarker}+1))\n local hasActiveHelp=0\n while IFS='\\n' read -r comp; do\n # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)\n if [ \"\\\\\\${comp[1,$endIndex]}\" = \"$activeHelpMarker\" ];then\n __${name.value}_debug \"ActiveHelp found: $comp\"\n comp=\"\\\\\\${comp[$startIndex,-1]}\"\n if [ -n \"$comp\" ]; then\n compadd -x \"\\\\\\${comp}\"\n __${name.value}_debug \"ActiveHelp will need delimiter\"\n hasActiveHelp=1\n fi\n continue\n fi\n\n if [ -n \"$comp\" ]; then\n # If requested, completions are returned with a description.\n # The description is preceded by a TAB character.\n # For zsh's _describe, we need to use a : instead of a TAB.\n # We first need to escape any : as part of the completion itself.\n comp=\\\\\\${comp//:/\\\\:}\n\n local tab=\"$(printf '\\\\t')\"\n comp=\\\\\\${comp//$tab/:}\n\n __${name.value}_debug \"Adding completion: \\\\\\${comp}\"\n completions+=\\\\\\${comp}\n lastComp=$comp\n fi\n done < <(printf \"%s\\n\" \"\\\\\\${out[@]}\")\n\n # Add a delimiter after the activeHelp statements, but only if:\n # - there are completions following the activeHelp statements, or\n # - file completion will be performed (so there will be choices after the activeHelp)\n if [ $hasActiveHelp -eq 1 ]; then\n if [ \\\\\\${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then\n __${name.value}_debug \"Adding activeHelp delimiter\"\n compadd -x \"--\"\n hasActiveHelp=0\n fi\n fi\n\n if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then\n __${name.value}_debug \"Activating nospace.\"\n noSpace=\"-S ''\"\n fi\n\n if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then\n __${name.value}_debug \"Activating keep order.\"\n keepOrder=\"-V\"\n fi\n\n if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then\n # File extension filtering\n local filteringCmd\n filteringCmd='_files'\n for filter in \\\\\\${completions[@]}; do\n if [ \\\\\\${filter[1]} != '*' ]; then\n # zsh requires a glob pattern to do file filtering\n filter=\"\\\\*.$filter\"\n fi\n filteringCmd+=\" -g $filter\"\n done\n filteringCmd+=\" \\\\\\${flagPrefix}\"\n\n __${name.value}_debug \"File filtering command: $filteringCmd\"\n _arguments '*:filename:'\"$filteringCmd\"\n elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then\n # File completion for directories only\n local subdir\n subdir=\"\\\\\\${completions[1]}\"\n if [ -n \"$subdir\" ]; then\n __${name.value}_debug \"Listing directories in $subdir\"\n pushd \"\\\\\\${subdir}\" >/dev/null 2>&1\n else\n __${name.value}_debug \"Listing directories in .\"\n fi\n\n local result\n _arguments '*:dirname:_files -/'\" \\\\\\${flagPrefix}\"\n result=$?\n if [ -n \"$subdir\" ]; then\n popd >/dev/null 2>&1\n fi\n return $result\n else\n __${name.value}_debug \"Calling _describe\"\n if eval _describe $keepOrder \"completions\" completions -Q \\\\\\${flagPrefix} \\\\\\${noSpace}; then\n __${name.value}_debug \"_describe found some completions\"\n\n # Return the success of having called _describe\n return 0\n else\n __${name.value}_debug \"_describe did not find completions.\"\n __${name.value}_debug \"Checking if we should do file completion.\"\n if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then\n __${name.value}_debug \"deactivating file completion\"\n\n # Return 0 to indicate completion is finished and prevent zsh from\n # trying other completion algorithms (which could cause hanging).\n # We use NoFileComp directive to explicitly disable file completion.\n return 0\n else\n # Perform file completion\n __${name.value}_debug \"Activating file completion\"\n\n # We must return the result of this command, so it must be the\n # last command, or else we must store its result to return it.\n _arguments '*:filename:_files'\" \\\\\\${flagPrefix}\"\n fi\n fi\n fi\n}\n\n# don't run the completion function when being sourced or eval-ed\nif [ \"\\\\\\${funcstack[1]}\" = \"_${name.value}\" ]; then\n _${name.value}\nfi\n\\`; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"SHELL_COMPLETIONS_DISPLAY\"\n initializer={code` SHELL_COMPLETIONS.split(\"\\\\n\").map(line => {\n if (!line.trim()) {\n return \"\";\n }\n if (line.trim().startsWith(\"#\")) {\n return \\`\\${colors.dim(line)}\\`;\n }\n\n return colors.white(line).replaceAll(/(?<=\\\\\\$(\\\\{|\\\\()).*(?=(\\\\}\\\\)))/g, colors.green(\"$&\"))\n .replaceAll(/\\\\\".*\\\\\"/g, colors.cyan(\"$&\"))\n .replaceAll(/(\\\\[|\\\\]|\\\\(|\\\\)|\\\\||<|>|\\\\$\\\\(|\\\\$?\\\\{|\\\\}|\\\\+|=|;|:)/g, colors.bold(colors.gray(\"$&\")))\n .replaceAll(/(readonly|complete)\\\\s+/g, colors.green(\"$&\"))\n .replaceAll(/(?<=(readonly|complete)\\\\s+)\\\\w/g, colors.bold(colors.greenBright(\"$&\")))\n .replaceAll(/local\\\\s+/g, colors.red(\"$&\"))\n .replaceAll(/(?<=local\\\\s+)\\\\w/g, colors.bold(colors.redBright(\"$&\")))\n .replaceAll(/(for|while)\\\\s+/g, colors.cyan(\"$&\"))\n .replaceAll(/(?<=for|while\\\\s+)\\\\w/g, colors.bold(colors.cyanBright(\"$&\")))\n .replaceAll(/(return|if|fi|else|elif|then|done)\\\\s+/g, colors.green(\"$&\"))\n .replaceAll(/__\\\\w/g, colors.bold(colors.magentaBright(\"$&\")))\n .replaceAll(/(?<=\\\\s)(-\\\\w|--\\\\w[\\\\w-]*)(?=\\\\s|$)/g, colors.bold(colors.magenta(\"$&\")));\n\n }).join(\"\\\\n\"); `}\n />\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkCA,SAAgB,uBAAgB;;CAE9B,MAAM,MAAM,eAAe,UAAU,QAAQ,CAAC;CAC9C,MAAM,OAAO,eAAe,UAAU,IAAI,MAAM,CAAC;;EAEjD,IAAM,OAAC;AACJ,UAAA,UAAA,QAAA,WAAA,eAAA,OAAA,YAAA;;EAED,gBAAgB,EACd,SAAS,CAAC,SAAS,EACpB;EACD,IAAG,WAAS;AACV,UAAC;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACC,SAAA;KACA,UAAA;KACA,MAAM;KACN,IAAA,cAAkB;AAChB,aAAO,IAAA,QAAA,KAAA,MAAoB;;;;;;;GAOlC,KAAC,MAAM;oCACgB,oBAAA,yBAAA;sCACtB,oBAAA,2BAAA;yCACiC,oBAAA,8BAAA;4CACX,oBAAA,iCAAA;yCACtB,oBAAA,8BAAA;wCACoC,oBAAA,6BAAA;;;;;QAKpC,KAAA,MAAA;QACA,KAAM,MAAA;;;;;;;QAON,KAAM,MAAS;;;;QAIX,KAAK,MAAM;;;;;;;;;;;;;;YAcR,KAAA,MAAA;;;;;;;;mBAQI,aAAiB;;QAExB,KAAK,MAAM;;;;;;;;;;;QAWX,KAAK,MAAM;;;;;;;;;;YAUP,KAAC,MAAU;;;;QAIf,KAAA,MAAW;QACX,KAAE,MAAO;QACT,KAAK,MAAC;;;YAGV,KAAA,MAAA;;;;;;;;;;;gBAWY,KAAC,MAAM;;;;oBAIb,KAAA,MAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA2Bb,KAAK,MAAM;;;;;;;YAOnB,KAAS,MAAC;;;;;YAKN,KAAA,MAAW;;;;;;;;;;;;;;;;;YAiBf,KAAM,MAAA;;;;;;;gBAOF,KAAA,MAAe;;;;;;;;;;;;;;YAcf,KAAI,MAAK;;;;;;;gBAOL,KAAG,MAAQ;gBACnB,KAAA,MAAA;;oBAEJ,KAAA,MAAA;;;;;;;;oBAQgB,KAAC,MAAM;;;;;;;;;;;gCAWI,KAAM,MAAE;;;;;KAKhC,CAAC;IAAE,gBAAE,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACJ,UAAA;KACJ,SAAA;KACJ,MAAA;;;;;;;;;;;;;;;;;;;;;;;KAuBO,CAAC;IAAC;;EAEN,CAAC"}
1
+ {"version":3,"file":"zsh-shared.mjs","names":[],"sources":["../../src/components/zsh-shared.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript\";\nimport { getAppBin } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport { CompletionDirective } from \"../helpers\";\nimport { EXEC_COMMAND } from \"../helpers/complete-command\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Zsh Completions generation for the Shell Shock project.\n */\nexport function ZshCompletionsShared() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n const name = computed(() => snakeCase(bin.value));\n\n return (\n <TypescriptFile\n path={joinPaths(context.entryPath, \"completions\", \"zsh\", \"shared.ts\")}\n builtinImports={{\n console: [\n \"white\",\n \"green\",\n \"red\",\n \"bold\",\n \"cyan\",\n \"gray\",\n \"magenta\",\n \"magentaBright\",\n \"greenBright\",\n \"redBright\",\n \"cyanBright\",\n \"dim\"\n ]\n }}>\n <Spacing />\n <VarDeclaration\n const\n export\n name=\"SHELL_COMPLETIONS\"\n initializer={code` \\`__${name.value}_debug() {\n local file=\"$BASH_COMP_DEBUG_FILE\"\n if [[ -n \\\\\\${file} ]]; then\n echo \"$*\" >> \"\\\\\\${file}\"\n fi\n}\n\n_${name.value}() {\n local shellCompDirectiveError=${\n CompletionDirective.CompletionDirectiveError\n }\n local shellCompDirectiveNoSpace=${\n CompletionDirective.CompletionDirectiveNoSpace\n }\n local shellCompDirectiveNoFileComp=${\n CompletionDirective.CompletionDirectiveNoFileComp\n }\n local shellCompDirectiveFilterFileExt=${\n CompletionDirective.CompletionDirectiveFilterFileExt\n }\n local shellCompDirectiveFilterDirs=${\n CompletionDirective.CompletionDirectiveFilterDirs\n }\n local shellCompDirectiveKeepOrder=${\n CompletionDirective.CompletionDirectiveKeepOrder\n }\n\n local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder\n local -a completions\n\n __${name.value}_debug \"\\\\n========= starting completion logic ==========\"\n __${name.value}_debug \"CURRENT: \\\\\\${CURRENT}, words[*]: \\\\\\${words[*]}\"\n\n # The user could have moved the cursor backwards on the command-line.\n # We need to trigger completion from the $CURRENT location, so we need\n # to truncate the command-line ($words) up to the $CURRENT location.\n # (We cannot use $CURSOR as its value does not work when a command is an alias.)\n words=( \"\\\\\\${=words[1,CURRENT]}\" )\n __${name.value}_debug \"Truncated words[*]: \\\\\\${words[*]},\"\n\n lastParam=\\\\\\${words[-1]}\n lastChar=\\\\\\${lastParam[-1]}\n __${name.value}_debug \"lastParam: \\\\\\${lastParam}, lastChar: \\\\\\${lastChar}\"\n # For zsh, when completing a flag with an = (e.g., ${bin.value} -n=<TAB>)\n # completions must be prefixed with the flag\n setopt local_options BASH_REMATCH\n if [[ \"\\\\\\${lastParam}\" =~ '-.*=' ]]; then\n # We are dealing with a flag with an =\n flagPrefix=\"-P \\\\\\${BASH_REMATCH}\"\n fi\n\n # Prepare the command to obtain completions, ensuring arguments are quoted for eval\n local -a args_to_quote=(\"\\\\\\${(@)words[2,-1]}\")\n if [ \"\\\\\\${lastChar}\" = \"\" ]; then\n # If the last parameter is complete (there is a space following it)\n # We add an extra empty parameter so we can indicate this to the go completion code.\n __${name.value}_debug \"Adding extra empty parameter\"\n args_to_quote+=(\"\")\n fi\n\n # Use Zsh's (q) flag to quote each argument safely for eval\n local quoted_args=(\"\\\\\\${(@q)args_to_quote}\")\n\n # Join the main command and the quoted arguments into a single string for eval\n requestComp=\"${EXEC_COMMAND} complete -- \\\\\\${quoted_args[*]}\"\n\n __${name.value}_debug \"About to call: eval \\\\\\${requestComp}\"\n\n # Use eval to handle any environment variables and such\n out=$(eval \\\\\\${requestComp} 2>/dev/null)\n __${name.value}_debug \"completion output: \\\\\\${out}\"\n\n # Extract the directive integer following a : from the last line\n local lastLine\n while IFS='\\n' read -r line; do\n lastLine=\\\\\\${line}\n done < <(printf \"%s\\n\" \"\\\\\\${out[@]}\")\n __${name.value}_debug \"last line: \\\\\\${lastLine}\"\n\n if [ \"\\\\\\${lastLine[1]}\" = : ]; then\n directive=\\\\\\${lastLine[2,-1]}\n # Remove the directive including the : and the newline\n local suffix\n (( suffix=\\\\\\${#lastLine}+2))\n out=\\\\\\${out[1,-$suffix]}\n else\n # There is no directive specified. Leave $out as is.\n __${name.value}_debug \"No directive found. Setting to default\"\n directive=0\n fi\n\n __${name.value}_debug \"directive: \\\\\\${directive}\"\n __${name.value}_debug \"completions: \\\\\\${out}\"\n __${name.value}_debug \"flagPrefix: \\\\\\${flagPrefix}\"\n\n if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then\n __${name.value}_debug \"Completion received error. Ignoring completions.\"\n return\n fi\n\n local activeHelpMarker=\"%\"\n local endIndex=\\\\\\${#activeHelpMarker}\n local startIndex=$((\\\\\\${#activeHelpMarker}+1))\n local hasActiveHelp=0\n while IFS='\\n' read -r comp; do\n # Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)\n if [ \"\\\\\\${comp[1,$endIndex]}\" = \"$activeHelpMarker\" ];then\n __${name.value}_debug \"ActiveHelp found: $comp\"\n comp=\"\\\\\\${comp[$startIndex,-1]}\"\n if [ -n \"$comp\" ]; then\n compadd -x \"\\\\\\${comp}\"\n __${name.value}_debug \"ActiveHelp will need delimiter\"\n hasActiveHelp=1\n fi\n continue\n fi\n\n if [ -n \"$comp\" ]; then\n # If requested, completions are returned with a description.\n # The description is preceded by a TAB character.\n # For zsh's _describe, we need to use a : instead of a TAB.\n # We first need to escape any : as part of the completion itself.\n comp=\\\\\\${comp//:/\\\\:}\n\n local tab=\"$(printf '\\\\t')\"\n comp=\\\\\\${comp//$tab/:}\n\n __${name.value}_debug \"Adding completion: \\\\\\${comp}\"\n completions+=\\\\\\${comp}\n lastComp=$comp\n fi\n done < <(printf \"%s\\n\" \"\\\\\\${out[@]}\")\n\n # Add a delimiter after the activeHelp statements, but only if:\n # - there are completions following the activeHelp statements, or\n # - file completion will be performed (so there will be choices after the activeHelp)\n if [ $hasActiveHelp -eq 1 ]; then\n if [ \\\\\\${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then\n __${name.value}_debug \"Adding activeHelp delimiter\"\n compadd -x \"--\"\n hasActiveHelp=0\n fi\n fi\n\n if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then\n __${name.value}_debug \"Activating nospace.\"\n noSpace=\"-S ''\"\n fi\n\n if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then\n __${name.value}_debug \"Activating keep order.\"\n keepOrder=\"-V\"\n fi\n\n if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then\n # File extension filtering\n local filteringCmd\n filteringCmd='_files'\n for filter in \\\\\\${completions[@]}; do\n if [ \\\\\\${filter[1]} != '*' ]; then\n # zsh requires a glob pattern to do file filtering\n filter=\"\\\\*.$filter\"\n fi\n filteringCmd+=\" -g $filter\"\n done\n filteringCmd+=\" \\\\\\${flagPrefix}\"\n\n __${name.value}_debug \"File filtering command: $filteringCmd\"\n _arguments '*:filename:'\"$filteringCmd\"\n elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then\n # File completion for directories only\n local subdir\n subdir=\"\\\\\\${completions[1]}\"\n if [ -n \"$subdir\" ]; then\n __${name.value}_debug \"Listing directories in $subdir\"\n pushd \"\\\\\\${subdir}\" >/dev/null 2>&1\n else\n __${name.value}_debug \"Listing directories in .\"\n fi\n\n local result\n _arguments '*:dirname:_files -/'\" \\\\\\${flagPrefix}\"\n result=$?\n if [ -n \"$subdir\" ]; then\n popd >/dev/null 2>&1\n fi\n return $result\n else\n __${name.value}_debug \"Calling _describe\"\n if eval _describe $keepOrder \"completions\" completions -Q \\\\\\${flagPrefix} \\\\\\${noSpace}; then\n __${name.value}_debug \"_describe found some completions\"\n\n # Return the success of having called _describe\n return 0\n else\n __${name.value}_debug \"_describe did not find completions.\"\n __${name.value}_debug \"Checking if we should do file completion.\"\n if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then\n __${name.value}_debug \"deactivating file completion\"\n\n # Return 0 to indicate completion is finished and prevent zsh from\n # trying other completion algorithms (which could cause hanging).\n # We use NoFileComp directive to explicitly disable file completion.\n return 0\n else\n # Perform file completion\n __${name.value}_debug \"Activating file completion\"\n\n # We must return the result of this command, so it must be the\n # last command, or else we must store its result to return it.\n _arguments '*:filename:_files'\" \\\\\\${flagPrefix}\"\n fi\n fi\n fi\n}\n\n# don't run the completion function when being sourced or eval-ed\nif [ \"\\\\\\${funcstack[1]}\" = \"_${name.value}\" ]; then\n _${name.value}\nfi\n\\`; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"SHELL_COMPLETIONS_DISPLAY\"\n initializer={code` SHELL_COMPLETIONS.split(\"\\\\n\").map(line => {\n if (!line.trim()) {\n return \"\";\n }\n if (line.trim().startsWith(\"#\")) {\n return \\`\\${dim(line)}\\`;\n }\n\n return white(line).replaceAll(/(?<=\\\\\\$(\\\\{|\\\\()).*(?=(\\\\}\\\\)))/g, green(\"$&\"))\n .replaceAll(/\\\\\".*\\\\\"/g, cyan(\"$&\"))\n .replaceAll(/(\\\\[|\\\\]|\\\\(|\\\\)|\\\\||<|>|\\\\$\\\\(|\\\\$?\\\\{|\\\\}|\\\\+|=|;|:)/g, bold(gray(\"$&\")))\n .replaceAll(/(readonly|complete)\\\\s+/g, green(\"$&\"))\n .replaceAll(/(?<=(readonly|complete)\\\\s+)\\\\w/g, bold(greenBright(\"$&\")))\n .replaceAll(/local\\\\s+/g, red(\"$&\"))\n .replaceAll(/(?<=local\\\\s+)\\\\w/g, bold(redBright(\"$&\")))\n .replaceAll(/(for|while)\\\\s+/g, cyan(\"$&\"))\n .replaceAll(/(?<=for|while\\\\s+)\\\\w/g, bold(cyanBright(\"$&\")))\n .replaceAll(/(return|if|fi|else|elif|then|done)\\\\s+/g, green(\"$&\"))\n .replaceAll(/__\\\\w/g, bold(magentaBright(\"$&\")))\n .replaceAll(/(?<=\\\\s)(-\\\\w|--\\\\w[\\\\w-]*)(?=\\\\s|$)/g, bold(magenta(\"$&\")));\n\n }).join(\"\\\\n\"); `}\n />\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkCA,SAAgB,uBAAgB;;CAE9B,MAAM,MAAM,eAAe,UAAU,QAAQ,CAAC;CAC9C,MAAM,OAAO,eAAe,UAAU,IAAI,MAAM,CAAC;;EAEjD,IAAM,OAAC;AACJ,UAAA,UAAA,QAAA,WAAA,eAAA,OAAA,YAAA;;EAED,gBAAgB,EACd,SAAS;GAAC;GAAC;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA,EACZ;EACD,IAAI,WAAS;AACX,UAAK;IAAG,gBAAC,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACP,SAAQ;KACR,UAAQ;KACR,MAAG;KACH,IAAG,cAAQ;AACT,aAAC,IAAA,QAAc,KAAA,MAAA;;;;;;;GAOtB,KAAI,MAAO;oCACP,oBAAA,yBAAA;sCACC,oBAAA,2BAAA;yCACA,oBAAA,8BAAA;4CACuB,oBAAA,iCAAA;yCACO,oBAAe,8BAAA;wCAChB,oBAAA,6BAAA;;;;;;QAM7B,KAAK,MAAI;;;;;;;QAOb,KAAM,MAAA;;;;QAIJ,KAAA,MAAA;yDACF,IAAA,MAAA;;;;;;;;;;;;;;;;;;;;;mBAqBe,aAAS;;QAEpB,KAAK,MAAM;;;;QAIX,KAAK,MAAG;;;;;;;QAOR,KAAK,MAAE;;;;;;;;;;YAUJ,KAAI,MAAK;;;;;QAKd,KAAI,MAAQ;QACV,KAAE,MAAS;;;YAGb,KAAW,MAAC;;;;;;;;;;;gBAWP,KAAU,MAAG;;;;oBAIP,KAAM,MAAQ;;;;;;;;;;;;;;;;gBAgBrB,KAAA,MAAc;;;;;;;;;;;gBAWZ,KAAA,MAAA;;;;;;;YAOA,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA6BP,KAAC,MAAM;;;;;;;;;;;;;;YAcf,KAAA,MAAA;;;;;;;gBAOM,KAAA,MAAA;gBACE,KAAK,MAAA;;oBAED,KAAC,MAAM;;;;;;;;oBAQX,KAAA,MAAA;;;;;;;;;;;gCAWG,KAAA,MAAA;OACZ,KAAC,MAAA;;;;KAID,CAAC;IAAE,gBAAe,SAAY,EAAE,CAAA;IAAA,gBAAkB,gBAAU;;KAE3D,SAAS;KACT,MAAM;KACN,aAAa,IAAI;;;;;;;;;;;;;;;;;;;;;;KAsBlB,CAAC;IAAA;;EAEL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/plugin-completions",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
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": {
@@ -338,14 +338,14 @@
338
338
  "@powerlines/deepkit": "^0.6.165",
339
339
  "@powerlines/plugin-alloy": "^0.26.2",
340
340
  "@powerlines/plugin-plugin": "^0.12.337",
341
- "@shell-shock/core": "^0.15.1",
341
+ "@shell-shock/core": "^0.15.2",
342
342
  "@stryke/path": "^0.27.3",
343
343
  "@stryke/string-format": "^0.17.7",
344
344
  "powerlines": "^0.42.27"
345
345
  },
346
346
  "devDependencies": {
347
347
  "@powerlines/plugin-deepkit": "^0.11.265",
348
- "@types/node": "^25.5.0"
348
+ "@types/node": "^25.5.1"
349
349
  },
350
350
  "publishConfig": {
351
351
  "access": "public",
@@ -362,5 +362,5 @@
362
362
  "./package.json": "./package.json"
363
363
  }
364
364
  },
365
- "gitHead": "b39233bcc3bed352f050a2b43ca0fa432a4175a4"
365
+ "gitHead": "ba74aaa8aaa2c911ce54df1fae944951af53a3ad"
366
366
  }