@shell-shock/plugin-completions 0.4.16 → 0.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/bash-config-command.cjs +116 -6
- package/dist/components/bash-config-command.d.cts +1 -3
- package/dist/components/bash-config-command.d.cts.map +1 -1
- package/dist/components/bash-config-command.d.mts +1 -3
- package/dist/components/bash-config-command.d.mts.map +1 -1
- package/dist/components/bash-config-command.mjs +115 -6
- package/dist/components/bash-config-command.mjs.map +1 -1
- package/dist/components/bash-script-command.cjs +101 -5
- package/dist/components/bash-script-command.d.cts +1 -3
- package/dist/components/bash-script-command.d.cts.map +1 -1
- package/dist/components/bash-script-command.d.mts +1 -3
- package/dist/components/bash-script-command.d.mts.map +1 -1
- package/dist/components/bash-script-command.mjs +100 -5
- package/dist/components/bash-script-command.mjs.map +1 -1
- package/dist/components/bash-shared.cjs +77 -13
- package/dist/components/bash-shared.d.cts +1 -3
- package/dist/components/bash-shared.d.cts.map +1 -1
- package/dist/components/bash-shared.d.mts +1 -3
- package/dist/components/bash-shared.d.mts.map +1 -1
- package/dist/components/bash-shared.mjs +76 -13
- package/dist/components/bash-shared.mjs.map +1 -1
- package/dist/components/fish-config-command.cjs +116 -6
- package/dist/components/fish-config-command.d.cts +1 -3
- package/dist/components/fish-config-command.d.cts.map +1 -1
- package/dist/components/fish-config-command.d.mts +1 -3
- package/dist/components/fish-config-command.d.mts.map +1 -1
- package/dist/components/fish-config-command.mjs +115 -6
- package/dist/components/fish-config-command.mjs.map +1 -1
- package/dist/components/fish-script-command.cjs +100 -4
- package/dist/components/fish-script-command.d.cts +1 -3
- package/dist/components/fish-script-command.d.cts.map +1 -1
- package/dist/components/fish-script-command.d.mts +1 -3
- package/dist/components/fish-script-command.d.mts.map +1 -1
- package/dist/components/fish-script-command.mjs +99 -4
- package/dist/components/fish-script-command.mjs.map +1 -1
- package/dist/components/fish-shared.cjs +141 -77
- package/dist/components/fish-shared.d.cts +1 -3
- package/dist/components/fish-shared.d.cts.map +1 -1
- package/dist/components/fish-shared.d.mts +1 -3
- package/dist/components/fish-shared.d.mts.map +1 -1
- package/dist/components/fish-shared.mjs +140 -77
- package/dist/components/fish-shared.mjs.map +1 -1
- package/dist/components/index.cjs +26 -1
- package/dist/components/index.mjs +14 -1
- package/dist/components/powershell-config-command.cjs +112 -6
- package/dist/components/powershell-config-command.d.cts +1 -3
- package/dist/components/powershell-config-command.d.cts.map +1 -1
- package/dist/components/powershell-config-command.d.mts +1 -3
- package/dist/components/powershell-config-command.d.mts.map +1 -1
- package/dist/components/powershell-config-command.mjs +111 -6
- package/dist/components/powershell-config-command.mjs.map +1 -1
- package/dist/components/powershell-script-command.cjs +100 -4
- package/dist/components/powershell-script-command.d.cts +1 -3
- package/dist/components/powershell-script-command.d.cts.map +1 -1
- package/dist/components/powershell-script-command.d.mts +1 -3
- package/dist/components/powershell-script-command.d.mts.map +1 -1
- package/dist/components/powershell-script-command.mjs +99 -4
- package/dist/components/powershell-script-command.mjs.map +1 -1
- package/dist/components/powershell-shared.cjs +101 -37
- package/dist/components/powershell-shared.d.cts +1 -3
- package/dist/components/powershell-shared.d.cts.map +1 -1
- package/dist/components/powershell-shared.d.mts +1 -3
- package/dist/components/powershell-shared.d.mts.map +1 -1
- package/dist/components/powershell-shared.mjs +100 -37
- package/dist/components/powershell-shared.mjs.map +1 -1
- package/dist/components/zsh-config-command.cjs +116 -6
- package/dist/components/zsh-config-command.d.cts +1 -3
- package/dist/components/zsh-config-command.d.cts.map +1 -1
- package/dist/components/zsh-config-command.d.mts +1 -3
- package/dist/components/zsh-config-command.d.mts.map +1 -1
- package/dist/components/zsh-config-command.mjs +115 -6
- package/dist/components/zsh-config-command.mjs.map +1 -1
- package/dist/components/zsh-script-command.cjs +104 -6
- package/dist/components/zsh-script-command.d.cts +1 -3
- package/dist/components/zsh-script-command.d.cts.map +1 -1
- package/dist/components/zsh-script-command.d.mts +1 -3
- package/dist/components/zsh-script-command.d.mts.map +1 -1
- package/dist/components/zsh-script-command.mjs +103 -6
- package/dist/components/zsh-script-command.mjs.map +1 -1
- package/dist/components/zsh-shared.cjs +106 -42
- package/dist/components/zsh-shared.d.cts +1 -3
- package/dist/components/zsh-shared.d.cts.map +1 -1
- package/dist/components/zsh-shared.d.mts +1 -3
- package/dist/components/zsh-shared.d.mts.map +1 -1
- package/dist/components/zsh-shared.mjs +105 -42
- package/dist/components/zsh-shared.mjs.map +1 -1
- package/dist/helpers/complete-command.cjs +10 -1
- package/dist/helpers/complete-command.d.mts.map +1 -1
- package/dist/helpers/complete-command.mjs +8 -1
- package/dist/helpers/complete-command.mjs.map +1 -1
- package/dist/helpers/completion-directive-constants.cjs +16 -1
- package/dist/helpers/completion-directive-constants.d.mts.map +1 -1
- package/dist/helpers/completion-directive-constants.mjs +14 -1
- package/dist/helpers/completion-directive-constants.mjs.map +1 -1
- package/dist/helpers/index.cjs +6 -1
- package/dist/helpers/index.mjs +4 -1
- package/dist/index.cjs +290 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +288 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.cjs +4 -1
- package/dist/types/index.mjs +3 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/dist/types/shell-type.cjs +12 -1
- package/dist/types/shell-type.d.cts.map +1 -1
- package/dist/types/shell-type.d.mts.map +1 -1
- package/dist/types/shell-type.mjs +10 -1
- package/dist/types/shell-type.mjs.map +1 -1
- package/package.json +13 -13
|
@@ -1,4 +1,100 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
4
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
5
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
|
+
let _powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
|
|
7
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
8
|
+
let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
|
|
9
|
+
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
10
|
+
let _stryke_path = require("@stryke/path");
|
|
11
|
+
|
|
12
|
+
//#region src/components/zsh-config-command.tsx
|
|
13
|
+
/**
|
|
14
|
+
* The Zsh Completions - Configuration command's handler wrapper for the Shell Shock project.
|
|
15
|
+
*/
|
|
16
|
+
function ZshConfigCompletionsCommand() {
|
|
17
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
18
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
|
|
19
|
+
get path() {
|
|
20
|
+
return (0, _stryke_path.joinPaths)(context.entryPath, "completions", "zsh", "config", "command.ts");
|
|
21
|
+
},
|
|
22
|
+
imports: {
|
|
23
|
+
"node:os": "os",
|
|
24
|
+
"node:path": ["join"],
|
|
25
|
+
"node:fs/promises": ["readFile", "writeFile"],
|
|
26
|
+
"../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
|
|
27
|
+
},
|
|
28
|
+
builtinImports: { console: [
|
|
29
|
+
"bold",
|
|
30
|
+
"inlineCode",
|
|
31
|
+
"writeLine",
|
|
32
|
+
"success",
|
|
33
|
+
"warn",
|
|
34
|
+
"help"
|
|
35
|
+
] },
|
|
36
|
+
get children() {
|
|
37
|
+
return [
|
|
38
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Options for the Zsh Completions - Configuration command." }),
|
|
39
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceDeclaration, {
|
|
40
|
+
"export": true,
|
|
41
|
+
name: "ZshConfigCompletionsOptions",
|
|
42
|
+
get children() {
|
|
43
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
44
|
+
heading: "Should the generated completion script be written to console output instead of an actual file on disk? This is useful for debugging purposes or if you want to manually handle the output.",
|
|
45
|
+
get children() {
|
|
46
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
|
|
47
|
+
type: "boolean",
|
|
48
|
+
defaultValue: false
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
52
|
+
name: "display",
|
|
53
|
+
type: "boolean"
|
|
54
|
+
})];
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
58
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Handler logic for the \\`completions zsh config\\` command." }),
|
|
59
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
60
|
+
"export": true,
|
|
61
|
+
"default": true,
|
|
62
|
+
async: true,
|
|
63
|
+
name: "handler",
|
|
64
|
+
parameters: [{
|
|
65
|
+
name: "options",
|
|
66
|
+
type: "ZshConfigCompletionsOptions",
|
|
67
|
+
default: "{}"
|
|
68
|
+
}, {
|
|
69
|
+
name: "path",
|
|
70
|
+
type: "string",
|
|
71
|
+
default: `"~/.zshrc"`
|
|
72
|
+
}],
|
|
73
|
+
get children() {
|
|
74
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
75
|
+
condition: _alloy_js_core.code`options.display !== true`,
|
|
76
|
+
get children() {
|
|
77
|
+
return [
|
|
78
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
79
|
+
"let": true,
|
|
80
|
+
name: "configPath",
|
|
81
|
+
type: "string",
|
|
82
|
+
initializer: _alloy_js_core.code` path.includes(".") ? path : join(path, ".zshrc");`
|
|
83
|
+
}),
|
|
84
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
85
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
86
|
+
condition: _alloy_js_core.code`configPath.startsWith("~")`,
|
|
87
|
+
children: _alloy_js_core.code`configPath = join(os.homedir(), configPath.replace("~", "")); `
|
|
88
|
+
}),
|
|
89
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
90
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
91
|
+
"let": true,
|
|
92
|
+
name: "content",
|
|
93
|
+
type: "string",
|
|
94
|
+
initializer: _alloy_js_core.code`"";`
|
|
95
|
+
}),
|
|
96
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
97
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`try {
|
|
2
98
|
content = await readFile(configPath, "utf8");
|
|
3
99
|
} catch (error) {
|
|
4
100
|
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
|
|
@@ -9,15 +105,19 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
|
|
|
9
105
|
}
|
|
10
106
|
}
|
|
11
107
|
|
|
12
|
-
await writeFile(configPath, \`\${content}\\n\\n### Begin - ${(0,
|
|
108
|
+
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 ###\`);
|
|
13
109
|
|
|
14
|
-
success(\`${(0,
|
|
110
|
+
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.\`); `)
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
114
|
+
return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
|
|
15
115
|
writeLine("");
|
|
16
|
-
writeLine(\`### Begin - ${(0,
|
|
116
|
+
writeLine(\`### Begin - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Zsh Completions ###\`);
|
|
17
117
|
writeLine("");
|
|
18
118
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
19
119
|
writeLine("");
|
|
20
|
-
writeLine(\`### End - ${(0,
|
|
120
|
+
writeLine(\`### End - ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Zsh Completions ###\`);
|
|
21
121
|
writeLine("");
|
|
22
122
|
writeLine(" ------------------------------------------------- ");
|
|
23
123
|
|
|
@@ -25,4 +125,14 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
|
|
|
25
125
|
help(\`To enable these completions, perform one of the following actions:
|
|
26
126
|
|
|
27
127
|
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/zsh/.zshrc)
|
|
28
|
-
2) Save the above script to a file and source it from your shell configuration file \`);
|
|
128
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
129
|
+
} })];
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
//#endregion
|
|
138
|
+
exports.ZshConfigCompletionsCommand = ZshConfigCompletionsCommand;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
1
|
//#region src/components/zsh-config-command.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* The Zsh Completions - Configuration command's handler wrapper for the Shell Shock project.
|
|
6
4
|
*/
|
|
7
|
-
declare function ZshConfigCompletionsCommand():
|
|
5
|
+
declare function ZshConfigCompletionsCommand(): import("@alloy-js/core").Children;
|
|
8
6
|
//#endregion
|
|
9
7
|
export { ZshConfigCompletionsCommand };
|
|
10
8
|
//# sourceMappingURL=zsh-config-command.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zsh-config-command.d.cts","names":[],"sources":["../../src/components/zsh-config-command.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"zsh-config-command.d.cts","names":[],"sources":["../../src/components/zsh-config-command.tsx"],"mappings":";;AA2CA;;iBAAgB,2BAAA,6BAA2B,QAAA"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
1
|
//#region src/components/zsh-config-command.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* The Zsh Completions - Configuration command's handler wrapper for the Shell Shock project.
|
|
6
4
|
*/
|
|
7
|
-
declare function ZshConfigCompletionsCommand():
|
|
5
|
+
declare function ZshConfigCompletionsCommand(): import("@alloy-js/core").Children;
|
|
8
6
|
//#endregion
|
|
9
7
|
export { ZshConfigCompletionsCommand };
|
|
10
8
|
//# sourceMappingURL=zsh-config-command.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zsh-config-command.d.mts","names":[],"sources":["../../src/components/zsh-config-command.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"zsh-config-command.d.mts","names":[],"sources":["../../src/components/zsh-config-command.tsx"],"mappings":""}
|
|
@@ -1,4 +1,99 @@
|
|
|
1
|
-
import{createComponent
|
|
1
|
+
import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
3
|
+
import { code } from "@alloy-js/core";
|
|
4
|
+
import { ElseClause, FunctionDeclaration, IfStatement, VarDeclaration } from "@alloy-js/typescript";
|
|
5
|
+
import { Spacing } from "@powerlines/plugin-alloy/core";
|
|
6
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
|
+
import { InterfaceDeclaration as InterfaceDeclaration$1, InterfaceMember, TypescriptFile } from "@powerlines/plugin-alloy/typescript";
|
|
8
|
+
import { TSDoc as TSDoc$1, TSDocDefaultValue as TSDocDefaultValue$1 } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
9
|
+
import { joinPaths } from "@stryke/path";
|
|
10
|
+
|
|
11
|
+
//#region src/components/zsh-config-command.tsx
|
|
12
|
+
/**
|
|
13
|
+
* The Zsh Completions - Configuration command's handler wrapper for the Shell Shock project.
|
|
14
|
+
*/
|
|
15
|
+
function ZshConfigCompletionsCommand() {
|
|
16
|
+
const context = usePowerlines();
|
|
17
|
+
return createComponent(TypescriptFile, {
|
|
18
|
+
get path() {
|
|
19
|
+
return joinPaths(context.entryPath, "completions", "zsh", "config", "command.ts");
|
|
20
|
+
},
|
|
21
|
+
imports: {
|
|
22
|
+
"node:os": "os",
|
|
23
|
+
"node:path": ["join"],
|
|
24
|
+
"node:fs/promises": ["readFile", "writeFile"],
|
|
25
|
+
"../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
|
|
26
|
+
},
|
|
27
|
+
builtinImports: { console: [
|
|
28
|
+
"bold",
|
|
29
|
+
"inlineCode",
|
|
30
|
+
"writeLine",
|
|
31
|
+
"success",
|
|
32
|
+
"warn",
|
|
33
|
+
"help"
|
|
34
|
+
] },
|
|
35
|
+
get children() {
|
|
36
|
+
return [
|
|
37
|
+
createComponent(TSDoc$1, { heading: "Options for the Zsh Completions - Configuration command." }),
|
|
38
|
+
createComponent(InterfaceDeclaration$1, {
|
|
39
|
+
"export": true,
|
|
40
|
+
name: "ZshConfigCompletionsOptions",
|
|
41
|
+
get children() {
|
|
42
|
+
return [createComponent(TSDoc$1, {
|
|
43
|
+
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.",
|
|
44
|
+
get children() {
|
|
45
|
+
return createComponent(TSDocDefaultValue$1, {
|
|
46
|
+
type: "boolean",
|
|
47
|
+
defaultValue: false
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}), createComponent(InterfaceMember, {
|
|
51
|
+
name: "display",
|
|
52
|
+
type: "boolean"
|
|
53
|
+
})];
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
createComponent(Spacing, {}),
|
|
57
|
+
createComponent(TSDoc$1, { heading: "Handler logic for the \\`completions zsh config\\` command." }),
|
|
58
|
+
createComponent(FunctionDeclaration, {
|
|
59
|
+
"export": true,
|
|
60
|
+
"default": true,
|
|
61
|
+
async: true,
|
|
62
|
+
name: "handler",
|
|
63
|
+
parameters: [{
|
|
64
|
+
name: "options",
|
|
65
|
+
type: "ZshConfigCompletionsOptions",
|
|
66
|
+
default: "{}"
|
|
67
|
+
}, {
|
|
68
|
+
name: "path",
|
|
69
|
+
type: "string",
|
|
70
|
+
default: `"~/.zshrc"`
|
|
71
|
+
}],
|
|
72
|
+
get children() {
|
|
73
|
+
return [createComponent(IfStatement, {
|
|
74
|
+
condition: code`options.display !== true`,
|
|
75
|
+
get children() {
|
|
76
|
+
return [
|
|
77
|
+
createComponent(VarDeclaration, {
|
|
78
|
+
"let": true,
|
|
79
|
+
name: "configPath",
|
|
80
|
+
type: "string",
|
|
81
|
+
initializer: code` path.includes(".") ? path : join(path, ".zshrc");`
|
|
82
|
+
}),
|
|
83
|
+
createComponent(Spacing, {}),
|
|
84
|
+
createComponent(IfStatement, {
|
|
85
|
+
condition: code`configPath.startsWith("~")`,
|
|
86
|
+
children: code`configPath = join(os.homedir(), configPath.replace("~", "")); `
|
|
87
|
+
}),
|
|
88
|
+
createComponent(Spacing, {}),
|
|
89
|
+
createComponent(VarDeclaration, {
|
|
90
|
+
"let": true,
|
|
91
|
+
name: "content",
|
|
92
|
+
type: "string",
|
|
93
|
+
initializer: code`"";`
|
|
94
|
+
}),
|
|
95
|
+
createComponent(Spacing, {}),
|
|
96
|
+
memo(() => code`try {
|
|
2
97
|
content = await readFile(configPath, "utf8");
|
|
3
98
|
} catch (error) {
|
|
4
99
|
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
|
|
@@ -9,15 +104,19 @@ import{createComponent as e,memo as t}from"@alloy-js/core/jsx-runtime";import{ge
|
|
|
9
104
|
}
|
|
10
105
|
}
|
|
11
106
|
|
|
12
|
-
await writeFile(configPath, \`\${content}\\n\\n### Begin - ${
|
|
107
|
+
await writeFile(configPath, \`\${content}\\n\\n### Begin - ${getAppTitle(context)} Shell Completions ###\\n\\n\${SHELL_COMPLETIONS} \\n\\n### End - ${getAppTitle(context)} Zsh Completions ###\`);
|
|
13
108
|
|
|
14
|
-
success(\`${
|
|
109
|
+
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.\`); `)
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
}), createComponent(ElseClause, { get children() {
|
|
113
|
+
return code`writeLine(" ------------------------------------------------- ");
|
|
15
114
|
writeLine("");
|
|
16
|
-
writeLine(\`### Begin - ${
|
|
115
|
+
writeLine(\`### Begin - ${getAppTitle(context)} Zsh Completions ###\`);
|
|
17
116
|
writeLine("");
|
|
18
117
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
19
118
|
writeLine("");
|
|
20
|
-
writeLine(\`### End - ${
|
|
119
|
+
writeLine(\`### End - ${getAppTitle(context)} Zsh Completions ###\`);
|
|
21
120
|
writeLine("");
|
|
22
121
|
writeLine(" ------------------------------------------------- ");
|
|
23
122
|
|
|
@@ -25,5 +124,15 @@ import{createComponent as e,memo as t}from"@alloy-js/core/jsx-runtime";import{ge
|
|
|
25
124
|
help(\`To enable these completions, perform one of the following actions:
|
|
26
125
|
|
|
27
126
|
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/zsh/.zshrc)
|
|
28
|
-
2) Save the above script to a file and source it from your shell configuration file \`);
|
|
127
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
128
|
+
} })];
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
];
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
//#endregion
|
|
137
|
+
export { ZshConfigCompletionsCommand };
|
|
29
138
|
//# sourceMappingURL=zsh-config-command.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zsh-config-command.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"zsh-config-command.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1,11 +1,99 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
4
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
5
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
|
+
let _powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
|
|
7
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
8
|
+
let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
|
|
9
|
+
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
10
|
+
let _stryke_path = require("@stryke/path");
|
|
11
|
+
let _stryke_string_format_snake_case = require("@stryke/string-format/snake-case");
|
|
2
12
|
|
|
3
|
-
|
|
13
|
+
//#region src/components/zsh-script-command.tsx
|
|
14
|
+
/**
|
|
15
|
+
* The Zsh Completions - Script command's handler wrapper for the Shell Shock project.
|
|
16
|
+
*/
|
|
17
|
+
function ZshScriptCompletionsCommand() {
|
|
18
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
19
|
+
const bin = (0, _alloy_js_core.computed)(() => (0, _shell_shock_core_plugin_utils.getAppBin)(context));
|
|
20
|
+
const name = (0, _alloy_js_core.computed)(() => (0, _stryke_string_format_snake_case.snakeCase)(bin.value));
|
|
21
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
|
|
22
|
+
get path() {
|
|
23
|
+
return (0, _stryke_path.joinPaths)(context.entryPath, "completions", "zsh", "script", "command.ts");
|
|
24
|
+
},
|
|
25
|
+
imports: {
|
|
26
|
+
"node:os": "os",
|
|
27
|
+
"node:path": ["join"],
|
|
28
|
+
"node:fs/promises": ["readFile", "writeFile"],
|
|
29
|
+
"../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
|
|
30
|
+
},
|
|
31
|
+
builtinImports: { console: [
|
|
32
|
+
"bold",
|
|
33
|
+
"writeLine",
|
|
34
|
+
"success",
|
|
35
|
+
"warn",
|
|
36
|
+
"help"
|
|
37
|
+
] },
|
|
38
|
+
get children() {
|
|
39
|
+
return [
|
|
40
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Options for the Zsh Completions - Script command." }),
|
|
41
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceDeclaration, {
|
|
42
|
+
"export": true,
|
|
43
|
+
name: "ZshScriptCompletionsOptions",
|
|
44
|
+
get children() {
|
|
45
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
46
|
+
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.",
|
|
47
|
+
get children() {
|
|
48
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
|
|
49
|
+
type: "boolean",
|
|
50
|
+
defaultValue: false
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
54
|
+
name: "display",
|
|
55
|
+
type: "boolean"
|
|
56
|
+
})];
|
|
57
|
+
}
|
|
58
|
+
}),
|
|
59
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
60
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Handler logic for the \\`completions zsh script\\` command." }),
|
|
61
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
62
|
+
"export": true,
|
|
63
|
+
"default": true,
|
|
64
|
+
async: true,
|
|
65
|
+
name: "handler",
|
|
66
|
+
get parameters() {
|
|
67
|
+
return [{
|
|
68
|
+
name: "options",
|
|
69
|
+
type: "ZshScriptCompletionsOptions",
|
|
70
|
+
default: "{}"
|
|
71
|
+
}, {
|
|
72
|
+
name: "path",
|
|
73
|
+
type: "string",
|
|
74
|
+
default: `"${bin.value}-completions.zsh"`
|
|
75
|
+
}];
|
|
76
|
+
},
|
|
77
|
+
get children() {
|
|
78
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
79
|
+
condition: _alloy_js_core.code`options.display !== true`,
|
|
80
|
+
get children() {
|
|
81
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
82
|
+
"const": true,
|
|
83
|
+
name: "scriptPath",
|
|
84
|
+
type: "string",
|
|
85
|
+
initializer: _alloy_js_core.code` path.includes(".") ? \`\${path}.zsh\` : path;`
|
|
86
|
+
}), (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}\`);
|
|
87
|
+
|
|
88
|
+
success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Zsh completion script has been generated at \${bold(scriptPath)}.\`);`)];
|
|
89
|
+
}
|
|
90
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
91
|
+
return _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
|
|
4
92
|
writeLine("");
|
|
5
|
-
writeLine("#compdef ${
|
|
6
|
-
writeLine("#compdef _${
|
|
93
|
+
writeLine("#compdef ${bin.value} ");
|
|
94
|
+
writeLine("#compdef _${name.value} ${bin.value}");
|
|
7
95
|
writeLine("");
|
|
8
|
-
writeLine("# Zsh completion for ${(0,
|
|
96
|
+
writeLine("# Zsh completion for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)}");
|
|
9
97
|
writeLine("");
|
|
10
98
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
11
99
|
writeLine("");
|
|
@@ -15,4 +103,14 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
|
|
|
15
103
|
help(\`To enable these completions, perform one of the following actions:
|
|
16
104
|
|
|
17
105
|
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/zsh/.zshrc)
|
|
18
|
-
2) Save the above script to a file and source it from your shell configuration file \`);
|
|
106
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
107
|
+
} })];
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
//#endregion
|
|
116
|
+
exports.ZshScriptCompletionsCommand = ZshScriptCompletionsCommand;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
1
|
//#region src/components/zsh-script-command.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* The Zsh Completions - Script command's handler wrapper for the Shell Shock project.
|
|
6
4
|
*/
|
|
7
|
-
declare function ZshScriptCompletionsCommand():
|
|
5
|
+
declare function ZshScriptCompletionsCommand(): import("@alloy-js/core").Children;
|
|
8
6
|
//#endregion
|
|
9
7
|
export { ZshScriptCompletionsCommand };
|
|
10
8
|
//# sourceMappingURL=zsh-script-command.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zsh-script-command.d.cts","names":[],"sources":["../../src/components/zsh-script-command.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"zsh-script-command.d.cts","names":[],"sources":["../../src/components/zsh-script-command.tsx"],"mappings":";;AA4CA;;iBAAgB,2BAAA,6BAA2B,QAAA"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
1
|
//#region src/components/zsh-script-command.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* The Zsh Completions - Script command's handler wrapper for the Shell Shock project.
|
|
6
4
|
*/
|
|
7
|
-
declare function ZshScriptCompletionsCommand():
|
|
5
|
+
declare function ZshScriptCompletionsCommand(): import("@alloy-js/core").Children;
|
|
8
6
|
//#endregion
|
|
9
7
|
export { ZshScriptCompletionsCommand };
|
|
10
8
|
//# sourceMappingURL=zsh-script-command.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zsh-script-command.d.mts","names":[],"sources":["../../src/components/zsh-script-command.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"zsh-script-command.d.mts","names":[],"sources":["../../src/components/zsh-script-command.tsx"],"mappings":""}
|
|
@@ -1,11 +1,98 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { getAppBin, getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
3
|
+
import { code, computed } from "@alloy-js/core";
|
|
4
|
+
import { ElseClause, FunctionDeclaration, IfStatement, VarDeclaration } from "@alloy-js/typescript";
|
|
5
|
+
import { Spacing } from "@powerlines/plugin-alloy/core";
|
|
6
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
|
+
import { InterfaceDeclaration as InterfaceDeclaration$1, InterfaceMember, TypescriptFile } from "@powerlines/plugin-alloy/typescript";
|
|
8
|
+
import { TSDoc as TSDoc$1, TSDocDefaultValue as TSDocDefaultValue$1 } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
9
|
+
import { joinPaths } from "@stryke/path";
|
|
10
|
+
import { snakeCase } from "@stryke/string-format/snake-case";
|
|
2
11
|
|
|
3
|
-
|
|
12
|
+
//#region src/components/zsh-script-command.tsx
|
|
13
|
+
/**
|
|
14
|
+
* The Zsh Completions - Script command's handler wrapper for the Shell Shock project.
|
|
15
|
+
*/
|
|
16
|
+
function ZshScriptCompletionsCommand() {
|
|
17
|
+
const context = usePowerlines();
|
|
18
|
+
const bin = computed(() => getAppBin(context));
|
|
19
|
+
const name = computed(() => snakeCase(bin.value));
|
|
20
|
+
return createComponent(TypescriptFile, {
|
|
21
|
+
get path() {
|
|
22
|
+
return joinPaths(context.entryPath, "completions", "zsh", "script", "command.ts");
|
|
23
|
+
},
|
|
24
|
+
imports: {
|
|
25
|
+
"node:os": "os",
|
|
26
|
+
"node:path": ["join"],
|
|
27
|
+
"node:fs/promises": ["readFile", "writeFile"],
|
|
28
|
+
"../shared": ["SHELL_COMPLETIONS", "SHELL_COMPLETIONS_DISPLAY"]
|
|
29
|
+
},
|
|
30
|
+
builtinImports: { console: [
|
|
31
|
+
"bold",
|
|
32
|
+
"writeLine",
|
|
33
|
+
"success",
|
|
34
|
+
"warn",
|
|
35
|
+
"help"
|
|
36
|
+
] },
|
|
37
|
+
get children() {
|
|
38
|
+
return [
|
|
39
|
+
createComponent(TSDoc$1, { heading: "Options for the Zsh Completions - Script command." }),
|
|
40
|
+
createComponent(InterfaceDeclaration$1, {
|
|
41
|
+
"export": true,
|
|
42
|
+
name: "ZshScriptCompletionsOptions",
|
|
43
|
+
get children() {
|
|
44
|
+
return [createComponent(TSDoc$1, {
|
|
45
|
+
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.",
|
|
46
|
+
get children() {
|
|
47
|
+
return createComponent(TSDocDefaultValue$1, {
|
|
48
|
+
type: "boolean",
|
|
49
|
+
defaultValue: false
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}), createComponent(InterfaceMember, {
|
|
53
|
+
name: "display",
|
|
54
|
+
type: "boolean"
|
|
55
|
+
})];
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
createComponent(Spacing, {}),
|
|
59
|
+
createComponent(TSDoc$1, { heading: "Handler logic for the \\`completions zsh script\\` command." }),
|
|
60
|
+
createComponent(FunctionDeclaration, {
|
|
61
|
+
"export": true,
|
|
62
|
+
"default": true,
|
|
63
|
+
async: true,
|
|
64
|
+
name: "handler",
|
|
65
|
+
get parameters() {
|
|
66
|
+
return [{
|
|
67
|
+
name: "options",
|
|
68
|
+
type: "ZshScriptCompletionsOptions",
|
|
69
|
+
default: "{}"
|
|
70
|
+
}, {
|
|
71
|
+
name: "path",
|
|
72
|
+
type: "string",
|
|
73
|
+
default: `"${bin.value}-completions.zsh"`
|
|
74
|
+
}];
|
|
75
|
+
},
|
|
76
|
+
get children() {
|
|
77
|
+
return [createComponent(IfStatement, {
|
|
78
|
+
condition: code`options.display !== true`,
|
|
79
|
+
get children() {
|
|
80
|
+
return [createComponent(VarDeclaration, {
|
|
81
|
+
"const": true,
|
|
82
|
+
name: "scriptPath",
|
|
83
|
+
type: "string",
|
|
84
|
+
initializer: code` path.includes(".") ? \`\${path}.zsh\` : path;`
|
|
85
|
+
}), memo(() => code`await writeFile(scriptPath, \`# Zsh script to add completions for ${getAppTitle(context)}\\n\\n\${SHELL_COMPLETIONS}\`);
|
|
86
|
+
|
|
87
|
+
success(\`${getAppTitle(context)} Zsh completion script has been generated at \${bold(scriptPath)}.\`);`)];
|
|
88
|
+
}
|
|
89
|
+
}), createComponent(ElseClause, { get children() {
|
|
90
|
+
return code`writeLine(" ------------------------------------------------- ");
|
|
4
91
|
writeLine("");
|
|
5
|
-
writeLine("#compdef ${
|
|
6
|
-
writeLine("#compdef _${
|
|
92
|
+
writeLine("#compdef ${bin.value} ");
|
|
93
|
+
writeLine("#compdef _${name.value} ${bin.value}");
|
|
7
94
|
writeLine("");
|
|
8
|
-
writeLine("# Zsh completion for ${
|
|
95
|
+
writeLine("# Zsh completion for ${getAppTitle(context)}");
|
|
9
96
|
writeLine("");
|
|
10
97
|
SHELL_COMPLETIONS_DISPLAY.split("\\n").map(line => writeLine(line));
|
|
11
98
|
writeLine("");
|
|
@@ -15,5 +102,15 @@ import{createComponent as e,memo as t}from"@alloy-js/core/jsx-runtime";import{ge
|
|
|
15
102
|
help(\`To enable these completions, perform one of the following actions:
|
|
16
103
|
|
|
17
104
|
1) Copy and paste the above script into your shell configuration file (e.g., ~/.config/zsh/.zshrc)
|
|
18
|
-
2) Save the above script to a file and source it from your shell configuration file \`);
|
|
105
|
+
2) Save the above script to a file and source it from your shell configuration file \`); `;
|
|
106
|
+
} })];
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
export { ZshScriptCompletionsCommand };
|
|
19
116
|
//# sourceMappingURL=zsh-script-command.mjs.map
|