@shell-shock/plugin-completions 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/bash-config-command.cjs +16 -7
- package/dist/components/bash-config-command.mjs +16 -7
- package/dist/components/bash-config-command.mjs.map +1 -1
- package/dist/components/bash-script-command.cjs +14 -4
- package/dist/components/bash-script-command.mjs +14 -4
- package/dist/components/bash-script-command.mjs.map +1 -1
- package/dist/components/fish-config-command.cjs +11 -2
- package/dist/components/fish-config-command.mjs +11 -2
- package/dist/components/fish-config-command.mjs.map +1 -1
- package/dist/components/fish-script-command.cjs +11 -2
- package/dist/components/fish-script-command.mjs +11 -2
- package/dist/components/fish-script-command.mjs.map +1 -1
- package/dist/components/powershell-config-command.cjs +11 -2
- package/dist/components/powershell-config-command.mjs +11 -2
- package/dist/components/powershell-config-command.mjs.map +1 -1
- package/dist/components/powershell-script-command.cjs +11 -2
- package/dist/components/powershell-script-command.mjs +11 -2
- package/dist/components/powershell-script-command.mjs.map +1 -1
- package/dist/components/zsh-config-command.cjs +11 -2
- package/dist/components/zsh-config-command.mjs +11 -2
- package/dist/components/zsh-config-command.mjs.map +1 -1
- package/dist/components/zsh-script-command.cjs +11 -2
- package/dist/components/zsh-script-command.mjs +11 -2
- package/dist/components/zsh-script-command.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -30,7 +30,8 @@ function BashConfigCompletionsCommand() {
|
|
|
30
30
|
"colors",
|
|
31
31
|
"writeLine",
|
|
32
32
|
"success",
|
|
33
|
-
"warn"
|
|
33
|
+
"warn",
|
|
34
|
+
"help"
|
|
34
35
|
] },
|
|
35
36
|
get children() {
|
|
36
37
|
return [
|
|
@@ -114,12 +115,20 @@ function BashConfigCompletionsCommand() {
|
|
|
114
115
|
}
|
|
115
116
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
116
117
|
return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
writeLine("");
|
|
119
|
+
writeLine(\`### Begin - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Bash Completions ###\`);
|
|
120
|
+
writeLine("");
|
|
121
|
+
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
122
|
+
writeLine("");
|
|
123
|
+
writeLine(\`### End - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Bash Completions ###\`);
|
|
124
|
+
writeLine("");
|
|
125
|
+
writeLine(" ------------------------------------------------- ");
|
|
126
|
+
|
|
127
|
+
writeLine("");
|
|
128
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
129
|
+
|
|
130
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.bashrc)
|
|
131
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
123
132
|
} })];
|
|
124
133
|
}
|
|
125
134
|
})
|
|
@@ -29,7 +29,8 @@ function BashConfigCompletionsCommand() {
|
|
|
29
29
|
"colors",
|
|
30
30
|
"writeLine",
|
|
31
31
|
"success",
|
|
32
|
-
"warn"
|
|
32
|
+
"warn",
|
|
33
|
+
"help"
|
|
33
34
|
] },
|
|
34
35
|
get children() {
|
|
35
36
|
return [
|
|
@@ -113,12 +114,20 @@ function BashConfigCompletionsCommand() {
|
|
|
113
114
|
}
|
|
114
115
|
}), createComponent(ElseClause, { get children() {
|
|
115
116
|
return code`writeLine(" ------------------------------------------------- ");
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
writeLine("");
|
|
118
|
+
writeLine(\`### Begin - ${getAppTitle(context)} Bash Completions ###\`);
|
|
119
|
+
writeLine("");
|
|
120
|
+
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
121
|
+
writeLine("");
|
|
122
|
+
writeLine(\`### End - ${getAppTitle(context)} Bash Completions ###\`);
|
|
123
|
+
writeLine("");
|
|
124
|
+
writeLine(" ------------------------------------------------- ");
|
|
125
|
+
|
|
126
|
+
writeLine("");
|
|
127
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
128
|
+
|
|
129
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.bashrc)
|
|
130
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
122
131
|
} })];
|
|
123
132
|
}
|
|
124
133
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash-config-command.mjs","names":[],"sources":["../../src/components/bash-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 Bash Completions - Configuration command's handler wrapper for the Shell Shock project.\n */\nexport function BashConfigCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"bash\",\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_DISPLAY\", \"SHELL_COMPLETIONS\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\"colors\"
|
|
1
|
+
{"version":3,"file":"bash-config-command.mjs","names":[],"sources":["../../src/components/bash-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 Bash Completions - Configuration command's handler wrapper for the Shell Shock project.\n */\nexport function BashConfigCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"bash\",\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_DISPLAY\", \"SHELL_COMPLETIONS\"]\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 Bash Completions - Configuration command.\" />\n <InterfaceDeclaration export name=\"BashConfigCompletionsOptions\">\n <TSDoc heading=\"Should the generated completion script be written to console output instead of an actual file on disk? This is useful for debugging purposes or if you want to manually handle the output.\">\n <TSDocDefaultValue\n type={ReflectionKind.boolean}\n defaultValue={false}\n />\n </TSDoc>\n <InterfaceMember name=\"display\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions bash config\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"BashConfigCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"~/.bashrc\"`\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, \".bashrc\");`}\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 )} Bash Completions ###\\`);\n\n success(\\`${getAppTitle(\n context\n )} shell completions have been applied to Bash 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)} Bash Completions ###\\`);\n writeLine(\"\");\n SHELL_COMPLETIONS_DISPLAY.split(\"\\\\n\").map(line => writeLine(line));\n writeLine(\"\");\n writeLine(\\`### End - ${getAppTitle(context)} Bash 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., ~/.bashrc)\n 2) Save the above script to a file and source it from your shell configuration file \\`); `}\n </ElseClause>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,SAAO,+BAAA;CACL,MAAK,UAAA,eAAA;AACL,QAAA,gBAAA,gBAAA;EACA,IAAM,OAAC;AACH,UAAG,UAAc,QAAO,WAAY,eAAY,QAAM,UAAA,aAAA;;EAE5D,SAAa;;GAEX,aAAA,CAAA,OAAA;GACI,oBAAoB,CAAA,YAAa,YAAW;GAChD,aAAA,CAAA,6BAAA,oBAAA;GACF;EACE,gBAAgB;;;;;;KAEhB;EACE,IAAC,WAAA;AACC,UAAM;IAAA,gBAAS,SAAA,EACb,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;;;;;;SAUF,CAAA,CAAA;;KAEH,CAAC;IAAC;;EAEN,CAAC"}
|
|
@@ -31,7 +31,8 @@ function BashScriptCompletionsCommand() {
|
|
|
31
31
|
"colors",
|
|
32
32
|
"writeLine",
|
|
33
33
|
"success",
|
|
34
|
-
"warn"
|
|
34
|
+
"warn",
|
|
35
|
+
"help"
|
|
35
36
|
] },
|
|
36
37
|
get children() {
|
|
37
38
|
return [
|
|
@@ -84,16 +85,25 @@ function BashScriptCompletionsCommand() {
|
|
|
84
85
|
name: "scriptPath",
|
|
85
86
|
type: "string",
|
|
86
87
|
initializer: _alloy_js_core.code` path.includes(".") ? \`\${path}.bash\` : path;`
|
|
87
|
-
}), (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
88
|
+
}), (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
89
|
+
await writeFile(scriptPath, \`# Bash script to add completions for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)}\\n\\n\${SHELL_COMPLETIONS}\`);
|
|
88
90
|
|
|
89
|
-
|
|
91
|
+
success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Bash completion script has been generated at \${colors.bold(scriptPath)}.\`); `)];
|
|
90
92
|
}
|
|
91
93
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
92
94
|
return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
|
|
95
|
+
writeLine("");
|
|
93
96
|
writeLine(\`# Bash completion for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)}\`);
|
|
94
97
|
writeLine("");
|
|
95
98
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
96
|
-
writeLine("
|
|
99
|
+
writeLine("");
|
|
100
|
+
writeLine(" ------------------------------------------------- ");
|
|
101
|
+
|
|
102
|
+
writeLine("");
|
|
103
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
104
|
+
|
|
105
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.bashrc)
|
|
106
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
97
107
|
} })];
|
|
98
108
|
}
|
|
99
109
|
})
|
|
@@ -30,7 +30,8 @@ function BashScriptCompletionsCommand() {
|
|
|
30
30
|
"colors",
|
|
31
31
|
"writeLine",
|
|
32
32
|
"success",
|
|
33
|
-
"warn"
|
|
33
|
+
"warn",
|
|
34
|
+
"help"
|
|
34
35
|
] },
|
|
35
36
|
get children() {
|
|
36
37
|
return [
|
|
@@ -83,16 +84,25 @@ function BashScriptCompletionsCommand() {
|
|
|
83
84
|
name: "scriptPath",
|
|
84
85
|
type: "string",
|
|
85
86
|
initializer: code` path.includes(".") ? \`\${path}.bash\` : path;`
|
|
86
|
-
}), memo(() => code`
|
|
87
|
+
}), memo(() => code`
|
|
88
|
+
await writeFile(scriptPath, \`# Bash script to add completions for ${getAppTitle(context)}\\n\\n\${SHELL_COMPLETIONS}\`);
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
success(\`${getAppTitle(context)} Bash completion script has been generated at \${colors.bold(scriptPath)}.\`); `)];
|
|
89
91
|
}
|
|
90
92
|
}), createComponent(ElseClause, { get children() {
|
|
91
93
|
return code`writeLine(" ------------------------------------------------- ");
|
|
94
|
+
writeLine("");
|
|
92
95
|
writeLine(\`# Bash completion for ${getAppTitle(context)}\`);
|
|
93
96
|
writeLine("");
|
|
94
97
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
95
|
-
writeLine("
|
|
98
|
+
writeLine("");
|
|
99
|
+
writeLine(" ------------------------------------------------- ");
|
|
100
|
+
|
|
101
|
+
writeLine("");
|
|
102
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
103
|
+
|
|
104
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.bashrc)
|
|
105
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
96
106
|
} })];
|
|
97
107
|
}
|
|
98
108
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash-script-command.mjs","names":[],"sources":["../../src/components/bash-script-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InterfaceMember,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocDefaultValue\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Bash Completions - Script command's handler wrapper for the Shell Shock project.\n */\nexport function BashScriptCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"bash\",\n \"script\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\"colors\"
|
|
1
|
+
{"version":3,"file":"bash-script-command.mjs","names":[],"sources":["../../src/components/bash-script-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InterfaceMember,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocDefaultValue\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Bash Completions - Script command's handler wrapper for the Shell Shock project.\n */\nexport function BashScriptCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"bash\",\n \"script\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"colors\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"help\"\n ]\n }}>\n <TSDoc heading=\"Options for the Bash Completions - Script command.\" />\n <InterfaceDeclaration export name=\"BashScriptCompletionsOptions\">\n <TSDoc heading=\"Should the generated completion script be written to console output instead of an actual file on disk? This is useful for debugging purposes or if you want to manually handle the output.\">\n <TSDocDefaultValue\n type={ReflectionKind.boolean}\n defaultValue={false}\n />\n </TSDoc>\n <InterfaceMember name=\"display\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions bash script\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"BashScriptCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"${bin.value}-completions.bash\"`\n }\n ]}>\n <IfStatement condition={code`options.display !== true`}>\n <VarDeclaration\n const\n name=\"scriptPath\"\n type=\"string\"\n initializer={code` path.includes(\".\") ? \\`\\${path}.bash\\` : path;`}\n />\n {code`\n await writeFile(scriptPath, \\`# Bash script to add completions for ${getAppTitle(context)}\\\\n\\\\n\\${SHELL_COMPLETIONS}\\`);\n\n success(\\`${getAppTitle(\n context\n )} Bash completion script has been generated at \\${colors.bold(scriptPath)}.\\`); `}\n </IfStatement>\n <ElseClause>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(\"\");\n writeLine(\\`# Bash completion for ${getAppTitle(context)}\\`);\n writeLine(\"\");\n SHELL_COMPLETIONS_DISPLAY.split(\"\\\\n\").map(line => writeLine(line));\n writeLine(\"\");\n writeLine(\" ------------------------------------------------- \");\n\n writeLine(\"\");\n help(\\`To enable these completions, perform one of the following actions:\n\n 1) Copy and paste the above script into your shell configuration file (e.g., ~/.bashrc)\n 2) Save the above script to a file and source it from your shell configuration file \\`); `}\n </ElseClause>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,SAAO,+BAAA;CACL,MAAK,UAAA,eAAA;CACL,MAAA,MAAA,eAAA,UAAA,QAAA,CAAA;AACA,QAAO,gBAAkB,gBAAgB;EAC3C,IAAQ,OAAC;AACH,UAAG,UAAY,QAAO,WAAY,eAAA,QAAA,UAAA,aAAA;;;GAGtC,WAAA;GACI,aAAM,CAAA,OAAc;GACxB,oBAAA,CAAA,YAAA,YAAA;GACI,aAAU,CAAA,qBAAA,4BAA+B;GAC7C;oBAEA,uBAA2B;GAAA;GAAU;GAAS;GAAA;GAAA;GAAA;EAE9C,IAAM,WAAC;AACJ,UAAA;IAAA,gBAAA,SAAA,EACC,SAAM,sDACL,CAAC;IAAA,gBAAiB,sBAAA;KACjB,UAAC;KACD,MAAM;KACN,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,gEACN,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;+EACzB,YAAA,QAAA,CAAA;;sBAEW,YAAW,QAAK,CAAA,iFAA0B,CAAA;;OAEpD,CAAC,EAAA,gBAAA,YAAA,EACA,IAAI,WAAE;AACN,cAAM,IAAM;;gDAEb,YAAA,QAAA,CAAA;;;;;;;;;;;SAYA,CAAC,CAAA;;KAEL,CAAC;IAAC"}
|
|
@@ -30,7 +30,8 @@ function FishConfigCompletionsCommand() {
|
|
|
30
30
|
"colors",
|
|
31
31
|
"writeLine",
|
|
32
32
|
"success",
|
|
33
|
-
"warn"
|
|
33
|
+
"warn",
|
|
34
|
+
"help"
|
|
34
35
|
] },
|
|
35
36
|
get children() {
|
|
36
37
|
return [
|
|
@@ -114,12 +115,20 @@ function FishConfigCompletionsCommand() {
|
|
|
114
115
|
}
|
|
115
116
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
116
117
|
return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
|
|
118
|
+
writeLine("");
|
|
117
119
|
writeLine(\`### Begin - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Fish Completions ###\`);
|
|
118
120
|
writeLine("");
|
|
119
121
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
120
122
|
writeLine("");
|
|
121
123
|
writeLine(\`### End - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Fish Completions ###\`);
|
|
122
|
-
writeLine("
|
|
124
|
+
writeLine("");
|
|
125
|
+
writeLine(" ------------------------------------------------- ");
|
|
126
|
+
|
|
127
|
+
writeLine("");
|
|
128
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
129
|
+
|
|
130
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/fish/config.fish)
|
|
131
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
123
132
|
} })];
|
|
124
133
|
}
|
|
125
134
|
})
|
|
@@ -29,7 +29,8 @@ function FishConfigCompletionsCommand() {
|
|
|
29
29
|
"colors",
|
|
30
30
|
"writeLine",
|
|
31
31
|
"success",
|
|
32
|
-
"warn"
|
|
32
|
+
"warn",
|
|
33
|
+
"help"
|
|
33
34
|
] },
|
|
34
35
|
get children() {
|
|
35
36
|
return [
|
|
@@ -113,12 +114,20 @@ function FishConfigCompletionsCommand() {
|
|
|
113
114
|
}
|
|
114
115
|
}), createComponent(ElseClause, { get children() {
|
|
115
116
|
return code`writeLine(" ------------------------------------------------- ");
|
|
117
|
+
writeLine("");
|
|
116
118
|
writeLine(\`### Begin - ${getAppTitle(context)} Fish Completions ###\`);
|
|
117
119
|
writeLine("");
|
|
118
120
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
119
121
|
writeLine("");
|
|
120
122
|
writeLine(\`### End - ${getAppTitle(context)} Fish Completions ###\`);
|
|
121
|
-
writeLine("
|
|
123
|
+
writeLine("");
|
|
124
|
+
writeLine(" ------------------------------------------------- ");
|
|
125
|
+
|
|
126
|
+
writeLine("");
|
|
127
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
128
|
+
|
|
129
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/fish/config.fish)
|
|
130
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
122
131
|
} })];
|
|
123
132
|
}
|
|
124
133
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fish-config-command.mjs","names":[],"sources":["../../src/components/fish-config-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { TSDoc, TSDocDefaultValue } from \"@powerlines/plugin-alloy/typescript\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Fish Completions - Configuration command's handler wrapper for the Shell Shock project.\n */\nexport function FishConfigCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"fish\",\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\": [\"colors\"
|
|
1
|
+
{"version":3,"file":"fish-config-command.mjs","names":[],"sources":["../../src/components/fish-config-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { TSDoc, TSDocDefaultValue } from \"@powerlines/plugin-alloy/typescript\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Fish Completions - Configuration command's handler wrapper for the Shell Shock project.\n */\nexport function FishConfigCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"fish\",\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 Fish Completions - Configuration command.\" />\n <InterfaceDeclaration export name=\"FishConfigCompletionsOptions\">\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 fish config\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"FishConfigCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"~/.config/fish/config.fish\"`\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, \".config\", \"fish\", \"config.fish\");`}\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)} Fish Completions ###\\\\n\\\\n\\${SHELL_COMPLETIONS} \\\\n\\\\n### End - ${getAppTitle(\n context\n )} Fish Completions ###\\`);\n\n success(\\`${getAppTitle(\n context\n )} shell completions have been applied to Fish 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)} Fish Completions ###\\`);\n writeLine(\"\");\n SHELL_COMPLETIONS_DISPLAY.split(\"\\\\n\").map(line => writeLine(line));\n writeLine(\"\");\n writeLine(\\`### End - ${getAppTitle(context)} Fish 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/fish/config.fish)\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,SAAS,+BAA+B;CACxC,MAAO,UAAO,eAA0C;;EAEtD,IAAA,OAAA;AACI,UAAM,UAAW,QAAG,WAAc,eAAiB,QAAQ,UAAS,aAAY;;EAEtF,SAAO;GACL,WAAe;;GAEf,oBAAO,CAAA,YAAA,YAAA;GACJ,aAAA,CAAA,qBAAA,4BAAA;GACA;EACD,gBAAY,EACV,uBAAe;GAAA;GAAA;GAAA;GAAA;GAAA;GAAA,EAChB;EACD,IAAI,WAAQ;AACV,UAAG;IAAA,gBAAU,OAAA,EACZ,SAAA,6DACD,CAAA;IAAA,gBAAS,sBAAA;KACP,UAAU;KACV,MAAM;KACN,IAAC,WAAQ;AACP,aAAE,CAAM,gBAAK,OAAoB;OACpC,SAAA;OACD,IAAA,WAAgB;AACR,eAAO,gBAAU,mBAAA;SACpB,IAAO,OAAA;AACP,iBAAU,eAAA;;SAEL,cAAA;SACD,CAAA;;OAEP,CAAA,EAAA,gBAAA,iBAAA;OACI,MAAC;OACN,UAAA;OACE,MAAM;OACJ,CAAA,CAAA;;KAEJ,CAAC;IAAE,gBAAgB,SAAK,EAAA,CAAA;IAAA,gBAAA,OAAA,EACvB,SAAG,gEACJ,CAAC;IAAE,gBAAK,qBAAA;KACP,UAAC;KACD,WAAA;KACD,OAAQ;KACR,MAAM;KACN,YAAA,CAAA;MACC,MAAA;MACA,MAAA;MACA,SAAA;MACA,EAAA;MACA,MAAA;MACE,MAAA;MACA,SAAS;MACV,CAAC;KACF,IAAI,WAAW;AACb,aAAC,CAAA,gBAAA,aAAA;OACD,WAAA,IAAA;OACE,IAAI,WAAQ;AACZ,eAAO;SAAA,gBAAO,gBAAA;UACd,OAAW;UACb,MAAA;UACA,MAAA;UACD,aAAY,IAAW;UACrB,CAAA;SAAA,gBAAA,SAAA,EAAA,CAAA;SAAA,gBAAA,aAAA;UACC,WAAA,IAAA;UACI,UAAE,IAAU;UAChB,CAAI;SAAE,gBAAM,SAAA,EAAA,CAAA;SAAA,gBAAA,gBAAA;UACZ,OAAW;UACZ,MAAA;UACA,MAAS;UACT,aAAY,IAAU;UACpB,CAAA;SAAK,gBAAkB,SAAG,EAAQ,CAAC;SAAE,WAAW,IAAA;;;;;;;;;;;uEAWL,YAAA,QAAA,CAAA,mEAAA,YAAA,QAAA,CAAA;;sBAElC,YAAY,QAAQ,CAAC,wMAAgE;SAAA;;OAEhG,CAAC,EAAE,gBAAO,YAAsB,EAC/B,IAAE,WAAK;AACL,cAAO,IAAE;;sCAEb,YAAA,QAAA,CAAA;;;;oCAI0B,YAAA,QAAA,CAAA;;;;;;;;;SAUzB,CAAC,CAAA;;KAEL,CAAC;IAAC;;EAEN,CAAC"}
|
|
@@ -31,7 +31,8 @@ function FishScriptCompletionsCommand() {
|
|
|
31
31
|
"colors",
|
|
32
32
|
"writeLine",
|
|
33
33
|
"success",
|
|
34
|
-
"warn"
|
|
34
|
+
"warn",
|
|
35
|
+
"help"
|
|
35
36
|
] },
|
|
36
37
|
get children() {
|
|
37
38
|
return [
|
|
@@ -90,10 +91,18 @@ function FishScriptCompletionsCommand() {
|
|
|
90
91
|
}
|
|
91
92
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
92
93
|
return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
|
|
94
|
+
writeLine("");
|
|
93
95
|
writeLine(\`# Fish completion for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)}\`);
|
|
94
96
|
writeLine("");
|
|
95
97
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
96
|
-
writeLine("
|
|
98
|
+
writeLine("");
|
|
99
|
+
writeLine(" ------------------------------------------------- ");
|
|
100
|
+
|
|
101
|
+
writeLine("");
|
|
102
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
103
|
+
|
|
104
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/fish/config.fish)
|
|
105
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
97
106
|
} })];
|
|
98
107
|
}
|
|
99
108
|
})
|
|
@@ -30,7 +30,8 @@ function FishScriptCompletionsCommand() {
|
|
|
30
30
|
"colors",
|
|
31
31
|
"writeLine",
|
|
32
32
|
"success",
|
|
33
|
-
"warn"
|
|
33
|
+
"warn",
|
|
34
|
+
"help"
|
|
34
35
|
] },
|
|
35
36
|
get children() {
|
|
36
37
|
return [
|
|
@@ -89,10 +90,18 @@ function FishScriptCompletionsCommand() {
|
|
|
89
90
|
}
|
|
90
91
|
}), createComponent(ElseClause, { get children() {
|
|
91
92
|
return code`writeLine(" ------------------------------------------------- ");
|
|
93
|
+
writeLine("");
|
|
92
94
|
writeLine(\`# Fish completion for ${getAppTitle(context)}\`);
|
|
93
95
|
writeLine("");
|
|
94
96
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
95
|
-
writeLine("
|
|
97
|
+
writeLine("");
|
|
98
|
+
writeLine(" ------------------------------------------------- ");
|
|
99
|
+
|
|
100
|
+
writeLine("");
|
|
101
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
102
|
+
|
|
103
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/fish/config.fish)
|
|
104
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
96
105
|
} })];
|
|
97
106
|
}
|
|
98
107
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fish-script-command.mjs","names":[],"sources":["../../src/components/fish-script-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InterfaceMember,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocDefaultValue\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Fish Completions - Script command's handler wrapper for the Shell Shock project.\n */\nexport function FishScriptCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"fish\",\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\": [\"colors\"
|
|
1
|
+
{"version":3,"file":"fish-script-command.mjs","names":[],"sources":["../../src/components/fish-script-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InterfaceMember,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocDefaultValue\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The Fish Completions - Script command's handler wrapper for the Shell Shock project.\n */\nexport function FishScriptCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"fish\",\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 Fish Completions - Script command.\" />\n <InterfaceDeclaration export name=\"FishScriptCompletionsOptions\">\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 fish script\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"FishScriptCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"${bin.value}-completions.fish\"`\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}.fish\\` : path;`}\n />\n {code`await writeFile(scriptPath, \\`# Fish script to add completions for ${getAppTitle(context)}\\\\n\\\\n\\${SHELL_COMPLETIONS}\\`);\n\n success(\\`${getAppTitle(\n context\n )} Fish completion script has been generated at \\${colors.bold(scriptPath)}.\\`);`}\n </IfStatement>\n <ElseClause>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(\"\");\n writeLine(\\`# Fish 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/fish/config.fish)\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,+BAAA;CACL,MAAK,UAAA,eAAA;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,CAAA,EAAA,gBAAA,YAAA,EACC,IAAA,WAAA;AACA,cAAM,IAAA;;gDAE8B,YAAS,QAAW,CAAC;;;;;;;;;;;SAY1D,CAAC,CAAA;;KAEL,CAAC;IAAC"}
|
|
@@ -26,7 +26,8 @@ function PowerShellConfigCompletionsCommand() {
|
|
|
26
26
|
"colors",
|
|
27
27
|
"writeLine",
|
|
28
28
|
"success",
|
|
29
|
-
"warn"
|
|
29
|
+
"warn",
|
|
30
|
+
"help"
|
|
30
31
|
] },
|
|
31
32
|
get children() {
|
|
32
33
|
return [
|
|
@@ -110,12 +111,20 @@ function PowerShellConfigCompletionsCommand() {
|
|
|
110
111
|
}
|
|
111
112
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
112
113
|
return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
|
|
114
|
+
writeLine("");
|
|
113
115
|
writeLine(\`### Begin - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} PowerShell Completions ###\`);
|
|
114
116
|
writeLine("");
|
|
115
117
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
116
118
|
writeLine("");
|
|
117
119
|
writeLine(\`### End - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} PowerShell Completions ###\`);
|
|
118
|
-
writeLine("
|
|
120
|
+
writeLine("");
|
|
121
|
+
writeLine(" ------------------------------------------------- ");
|
|
122
|
+
|
|
123
|
+
writeLine("");
|
|
124
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
125
|
+
|
|
126
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/powershell/Microsoft.PowerShell_profile.ps1)
|
|
127
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
119
128
|
} })];
|
|
120
129
|
}
|
|
121
130
|
})
|
|
@@ -25,7 +25,8 @@ function PowerShellConfigCompletionsCommand() {
|
|
|
25
25
|
"colors",
|
|
26
26
|
"writeLine",
|
|
27
27
|
"success",
|
|
28
|
-
"warn"
|
|
28
|
+
"warn",
|
|
29
|
+
"help"
|
|
29
30
|
] },
|
|
30
31
|
get children() {
|
|
31
32
|
return [
|
|
@@ -109,12 +110,20 @@ function PowerShellConfigCompletionsCommand() {
|
|
|
109
110
|
}
|
|
110
111
|
}), createComponent(ElseClause, { get children() {
|
|
111
112
|
return code`writeLine(" ------------------------------------------------- ");
|
|
113
|
+
writeLine("");
|
|
112
114
|
writeLine(\`### Begin - ${getAppTitle(context)} PowerShell Completions ###\`);
|
|
113
115
|
writeLine("");
|
|
114
116
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
115
117
|
writeLine("");
|
|
116
118
|
writeLine(\`### End - ${getAppTitle(context)} PowerShell Completions ###\`);
|
|
117
|
-
writeLine("
|
|
119
|
+
writeLine("");
|
|
120
|
+
writeLine(" ------------------------------------------------- ");
|
|
121
|
+
|
|
122
|
+
writeLine("");
|
|
123
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
124
|
+
|
|
125
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/powershell/Microsoft.PowerShell_profile.ps1)
|
|
126
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
118
127
|
} })];
|
|
119
128
|
}
|
|
120
129
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powershell-config-command.mjs","names":[],"sources":["../../src/components/powershell-config-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types\";\n\nexport function PowerShellConfigCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"powershell\",\n \"config\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\"colors\"
|
|
1
|
+
{"version":3,"file":"powershell-config-command.mjs","names":[],"sources":["../../src/components/powershell-config-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types\";\n\nexport function PowerShellConfigCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"powershell\",\n \"config\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"colors\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"help\"\n ]\n }}>\n <TSDoc heading=\"Options for the PowerShell Completions - Configuration command.\" />\n <InterfaceDeclaration export name=\"PowerShellConfigCompletionsOptions\">\n <TSDoc heading=\"Should the generated completion script be written to console output instead of an actual file on disk? This is useful for debugging purposes or if you want to manually handle the output.\">\n <TSDocDefaultValue\n type={ReflectionKind.boolean}\n defaultValue={false}\n />\n </TSDoc>\n <InterfaceMember name=\"display\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions powershell config\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"PowerShellConfigCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"~/.config/powershell/Microsoft.PowerShell_profile.ps1\"`\n }\n ]}>\n <IfStatement condition={code`options.display !== true`}>\n <VarDeclaration\n let\n name=\"configPath\"\n type=\"string\"\n initializer={code` path.includes(\".\") ? path : join(path, \"Microsoft.PowerShell_profile.ps1\");`}\n />\n <Spacing />\n <IfStatement condition={code`configPath.startsWith(\"~\")`}>\n {code`configPath = join(os.homedir(), configPath.replace(\"~\", \"\")); `}\n </IfStatement>\n <Spacing />\n <VarDeclaration\n let\n name=\"content\"\n type=\"string\"\n initializer={code`\"\";`}\n />\n <Spacing />\n {code`try {\n content = await readFile(configPath, \"utf8\");\n } catch (error) {\n if (typeof error === \"object\" && error !== null && \"code\" in error && error.code === \"ENOENT\") {\n // If the file doesn't exist, we can create it later when writing the completion script.\n warn(\\`Configuration file \\${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)} PowerShell Completions ###\\\\n\\\\n\\${SHELL_COMPLETIONS} \\\\n\\\\n### End - ${getAppTitle(\n context\n )} PowerShell Completions ###\\`);\n\n success(\\`${getAppTitle(\n context\n )} shell completions have been applied to PowerShell configuration file at \\${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)} PowerShell Completions ###\\`);\n writeLine(\"\");\n SHELL_COMPLETIONS_DISPLAY.split(\"\\\\n\").map(line => writeLine(line));\n writeLine(\"\");\n writeLine(\\`### End - ${getAppTitle(context)} PowerShell Completions ###\\`);\n writeLine(\"\");\n writeLine(\" ------------------------------------------------- \");\n\n writeLine(\"\");\n help(\\`To enable these completions, perform one of the following actions:\n\n 1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/powershell/Microsoft.PowerShell_profile.ps1)\n 2) Save the above script to a file and source it from your shell configuration file \\`); `}\n </ElseClause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,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,yEAAA,YAAA,QAAA,CAAA;;sBAEb,YAAA,QAAA,CAAA,8MAAA;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"}
|
|
@@ -31,7 +31,8 @@ function PowerShellScriptCompletionsCommand() {
|
|
|
31
31
|
"colors",
|
|
32
32
|
"writeLine",
|
|
33
33
|
"success",
|
|
34
|
-
"warn"
|
|
34
|
+
"warn",
|
|
35
|
+
"help"
|
|
35
36
|
] },
|
|
36
37
|
get children() {
|
|
37
38
|
return [
|
|
@@ -90,10 +91,18 @@ function PowerShellScriptCompletionsCommand() {
|
|
|
90
91
|
}
|
|
91
92
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
92
93
|
return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
|
|
94
|
+
writeLine("");
|
|
93
95
|
writeLine(\`# PowerShell completions for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)}\`);
|
|
94
96
|
writeLine("");
|
|
95
97
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
96
|
-
writeLine("
|
|
98
|
+
writeLine("");
|
|
99
|
+
writeLine(" ------------------------------------------------- ");
|
|
100
|
+
|
|
101
|
+
writeLine("");
|
|
102
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
103
|
+
|
|
104
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/powershell/Microsoft.PowerShell_profile.ps1)
|
|
105
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
97
106
|
} })];
|
|
98
107
|
}
|
|
99
108
|
})
|
|
@@ -30,7 +30,8 @@ function PowerShellScriptCompletionsCommand() {
|
|
|
30
30
|
"colors",
|
|
31
31
|
"writeLine",
|
|
32
32
|
"success",
|
|
33
|
-
"warn"
|
|
33
|
+
"warn",
|
|
34
|
+
"help"
|
|
34
35
|
] },
|
|
35
36
|
get children() {
|
|
36
37
|
return [
|
|
@@ -89,10 +90,18 @@ function PowerShellScriptCompletionsCommand() {
|
|
|
89
90
|
}
|
|
90
91
|
}), createComponent(ElseClause, { get children() {
|
|
91
92
|
return code`writeLine(" ------------------------------------------------- ");
|
|
93
|
+
writeLine("");
|
|
92
94
|
writeLine(\`# PowerShell completions for ${getAppTitle(context)}\`);
|
|
93
95
|
writeLine("");
|
|
94
96
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
95
|
-
writeLine("
|
|
97
|
+
writeLine("");
|
|
98
|
+
writeLine(" ------------------------------------------------- ");
|
|
99
|
+
|
|
100
|
+
writeLine("");
|
|
101
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
102
|
+
|
|
103
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/powershell/Microsoft.PowerShell_profile.ps1)
|
|
104
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
96
105
|
} })];
|
|
97
106
|
}
|
|
98
107
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powershell-script-command.mjs","names":[],"sources":["../../src/components/powershell-script-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InterfaceMember,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocDefaultValue\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The PowerShell Completions - Script command's handler wrapper for the Shell Shock project.\n */\nexport function PowerShellScriptCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"powershell\",\n \"script\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\"colors\"
|
|
1
|
+
{"version":3,"file":"powershell-script-command.mjs","names":[],"sources":["../../src/components/powershell-script-command.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed } from \"@alloy-js/core\";\nimport {\n ElseClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n InterfaceMember,\n TypescriptFile\n} from \"@powerlines/plugin-alloy/typescript\";\nimport {\n TSDoc,\n TSDocDefaultValue\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { joinPaths } from \"@stryke/path\";\nimport type { CompletionsPluginContext } from \"../types/plugin\";\n\n/**\n * The PowerShell Completions - Script command's handler wrapper for the Shell Shock project.\n */\nexport function PowerShellScriptCompletionsCommand() {\n const context = usePowerlines<CompletionsPluginContext>();\n\n const bin = computed(() => getAppBin(context));\n\n return (\n <TypescriptFile\n path={joinPaths(\n context.entryPath,\n \"completions\",\n \"powershell\",\n \"script\",\n \"command.ts\"\n )}\n imports={{\n \"node:os\": \"os\",\n \"node:path\": [\"join\"],\n \"node:fs/promises\": [\"readFile\", \"writeFile\"],\n \"../shared\": [\"SHELL_COMPLETIONS\", \"SHELL_COMPLETIONS_DISPLAY\"]\n }}\n builtinImports={{\n \"shell-shock:console\": [\n \"colors\",\n \"writeLine\",\n \"success\",\n \"warn\",\n \"help\"\n ]\n }}>\n <TSDoc heading=\"Options for the PowerShell Completions - Script command.\" />\n <InterfaceDeclaration export name=\"PowerShellScriptCompletionsOptions\">\n <TSDoc heading=\"Should the generated completion script be written to console output instead of an actual file on disk? This is useful for debugging purposes or if you want to manually handle the output.\">\n <TSDocDefaultValue\n type={ReflectionKind.boolean}\n defaultValue={false}\n />\n </TSDoc>\n <InterfaceMember name=\"display\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Handler logic for the \\`completions powershell script\\` command.\"></TSDoc>\n <FunctionDeclaration\n export\n default\n async\n name=\"handler\"\n parameters={[\n {\n name: \"options\",\n type: \"PowerShellScriptCompletionsOptions\",\n default: \"{}\"\n },\n {\n name: \"path\",\n type: \"string\",\n default: `\"${bin.value}-completions.ps1\"`\n }\n ]}>\n <IfStatement condition={code`options.display !== true`}>\n <VarDeclaration\n const\n name=\"scriptPath\"\n type=\"string\"\n initializer={code` path.includes(\".\") ? \\`\\${path}.ps1\\` : path;`}\n />\n {code`await writeFile(scriptPath, \\`# PowerShell script to add completions for ${getAppTitle(context)}\\\\n\\\\n\\${SHELL_COMPLETIONS}\\`);\n\n success(\\`${getAppTitle(\n context\n )} PowerShell completion script has been generated at \\${colors.bold(scriptPath)}.\\`);`}\n </IfStatement>\n <ElseClause>\n {code`writeLine(\" ------------------------------------------------- \");\n writeLine(\"\");\n writeLine(\\`# PowerShell completions for ${getAppTitle(context)}\\`);\n writeLine(\"\");\n SHELL_COMPLETIONS_DISPLAY.split(\"\\\\n\").map(line => writeLine(line));\n writeLine(\"\");\n writeLine(\" ------------------------------------------------- \");\n\n writeLine(\"\");\n help(\\`To enable these completions, perform one of the following actions:\n\n 1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/powershell/Microsoft.PowerShell_profile.ps1)\n 2) Save the above script to a file and source it from your shell configuration file \\`); `}\n </ElseClause>\n </FunctionDeclaration>\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,SAAO,qCAAA;CACL,MAAK,UAAA,eAAA;CACL,MAAA,MAAA,eAAA,UAAA,QAAA,CAAA;AACA,QAAO,gBAAkB,gBAAgB;EAC3C,IAAQ,OAAC;AACH,UAAG,UAAY,QAAO,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,CAAA;;KAEL,CAAC;IAAC"}
|
|
@@ -30,7 +30,8 @@ function ZshConfigCompletionsCommand() {
|
|
|
30
30
|
"colors",
|
|
31
31
|
"writeLine",
|
|
32
32
|
"success",
|
|
33
|
-
"warn"
|
|
33
|
+
"warn",
|
|
34
|
+
"help"
|
|
34
35
|
] },
|
|
35
36
|
get children() {
|
|
36
37
|
return [
|
|
@@ -114,12 +115,20 @@ function ZshConfigCompletionsCommand() {
|
|
|
114
115
|
}
|
|
115
116
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
116
117
|
return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
|
|
118
|
+
writeLine("");
|
|
117
119
|
writeLine(\`### Begin - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Zsh Completions ###\`);
|
|
118
120
|
writeLine("");
|
|
119
121
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
120
122
|
writeLine("");
|
|
121
123
|
writeLine(\`### End - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Zsh Completions ###\`);
|
|
122
|
-
writeLine("
|
|
124
|
+
writeLine("");
|
|
125
|
+
writeLine(" ------------------------------------------------- ");
|
|
126
|
+
|
|
127
|
+
writeLine("");
|
|
128
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
129
|
+
|
|
130
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/zsh/.zshrc)
|
|
131
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
123
132
|
} })];
|
|
124
133
|
}
|
|
125
134
|
})
|
|
@@ -29,7 +29,8 @@ function ZshConfigCompletionsCommand() {
|
|
|
29
29
|
"colors",
|
|
30
30
|
"writeLine",
|
|
31
31
|
"success",
|
|
32
|
-
"warn"
|
|
32
|
+
"warn",
|
|
33
|
+
"help"
|
|
33
34
|
] },
|
|
34
35
|
get children() {
|
|
35
36
|
return [
|
|
@@ -113,12 +114,20 @@ function ZshConfigCompletionsCommand() {
|
|
|
113
114
|
}
|
|
114
115
|
}), createComponent(ElseClause, { get children() {
|
|
115
116
|
return code`writeLine(" ------------------------------------------------- ");
|
|
117
|
+
writeLine("");
|
|
116
118
|
writeLine(\`### Begin - ${getAppTitle(context)} Zsh Completions ###\`);
|
|
117
119
|
writeLine("");
|
|
118
120
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
119
121
|
writeLine("");
|
|
120
122
|
writeLine(\`### End - ${getAppTitle(context)} Zsh Completions ###\`);
|
|
121
|
-
writeLine("
|
|
123
|
+
writeLine("");
|
|
124
|
+
writeLine(" ------------------------------------------------- ");
|
|
125
|
+
|
|
126
|
+
writeLine("");
|
|
127
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
128
|
+
|
|
129
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/zsh/.zshrc)
|
|
130
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
122
131
|
} })];
|
|
123
132
|
}
|
|
124
133
|
})
|
|
@@ -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\": [\"colors\"
|
|
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 );\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AAA,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"}
|
|
@@ -33,7 +33,8 @@ function ZshScriptCompletionsCommand() {
|
|
|
33
33
|
"colors",
|
|
34
34
|
"writeLine",
|
|
35
35
|
"success",
|
|
36
|
-
"warn"
|
|
36
|
+
"warn",
|
|
37
|
+
"help"
|
|
37
38
|
] },
|
|
38
39
|
get children() {
|
|
39
40
|
return [
|
|
@@ -92,13 +93,21 @@ function ZshScriptCompletionsCommand() {
|
|
|
92
93
|
}
|
|
93
94
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
94
95
|
return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
|
|
96
|
+
writeLine("");
|
|
95
97
|
writeLine("#compdef ${bin.value} ");
|
|
96
98
|
writeLine("#compdef _${name.value} ${bin.value}");
|
|
97
99
|
writeLine("");
|
|
98
100
|
writeLine("# Zsh completion for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)}");
|
|
99
101
|
writeLine("");
|
|
100
102
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
101
|
-
writeLine("
|
|
103
|
+
writeLine("");
|
|
104
|
+
writeLine(" ------------------------------------------------- ");
|
|
105
|
+
|
|
106
|
+
writeLine("");
|
|
107
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
108
|
+
|
|
109
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/zsh/.zshrc)
|
|
110
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
102
111
|
} })];
|
|
103
112
|
}
|
|
104
113
|
})
|
|
@@ -32,7 +32,8 @@ function ZshScriptCompletionsCommand() {
|
|
|
32
32
|
"colors",
|
|
33
33
|
"writeLine",
|
|
34
34
|
"success",
|
|
35
|
-
"warn"
|
|
35
|
+
"warn",
|
|
36
|
+
"help"
|
|
36
37
|
] },
|
|
37
38
|
get children() {
|
|
38
39
|
return [
|
|
@@ -91,13 +92,21 @@ function ZshScriptCompletionsCommand() {
|
|
|
91
92
|
}
|
|
92
93
|
}), createComponent(ElseClause, { get children() {
|
|
93
94
|
return code`writeLine(" ------------------------------------------------- ");
|
|
95
|
+
writeLine("");
|
|
94
96
|
writeLine("#compdef ${bin.value} ");
|
|
95
97
|
writeLine("#compdef _${name.value} ${bin.value}");
|
|
96
98
|
writeLine("");
|
|
97
99
|
writeLine("# Zsh completion for ${getAppTitle(context)}");
|
|
98
100
|
writeLine("");
|
|
99
101
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
100
|
-
writeLine("
|
|
102
|
+
writeLine("");
|
|
103
|
+
writeLine(" ------------------------------------------------- ");
|
|
104
|
+
|
|
105
|
+
writeLine("");
|
|
106
|
+
help(\`To enable these completions, perform one of the following actions:
|
|
107
|
+
|
|
108
|
+
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/zsh/.zshrc)
|
|
109
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
101
110
|
} })];
|
|
102
111
|
}
|
|
103
112
|
})
|
|
@@ -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\": [\"colors\"
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/plugin-completions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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,7 +338,7 @@
|
|
|
338
338
|
"@powerlines/deepkit": "^0.6.163",
|
|
339
339
|
"@powerlines/plugin-alloy": "^0.26.0",
|
|
340
340
|
"@powerlines/plugin-plugin": "^0.12.335",
|
|
341
|
-
"@shell-shock/core": "^0.14.
|
|
341
|
+
"@shell-shock/core": "^0.14.5",
|
|
342
342
|
"@stryke/path": "^0.27.3",
|
|
343
343
|
"@stryke/string-format": "^0.17.7",
|
|
344
344
|
"powerlines": "^0.42.25"
|
|
@@ -362,5 +362,5 @@
|
|
|
362
362
|
"./package.json": "./package.json"
|
|
363
363
|
}
|
|
364
364
|
},
|
|
365
|
-
"gitHead": "
|
|
365
|
+
"gitHead": "7c942f2fc1b4f65700076cd29604ce47025cd584"
|
|
366
366
|
}
|