@shell-shock/plugin-completions 0.2.24 → 0.3.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.
Files changed (117) hide show
  1. package/README.md +1 -1
  2. package/dist/components/bash-config-command.cjs +132 -0
  3. package/dist/components/bash-config-command.d.cts +10 -0
  4. package/dist/components/bash-config-command.d.cts.map +1 -0
  5. package/dist/components/bash-config-command.d.mts +10 -0
  6. package/dist/components/bash-config-command.d.mts.map +1 -0
  7. package/dist/components/bash-config-command.mjs +132 -0
  8. package/dist/components/bash-config-command.mjs.map +1 -0
  9. package/dist/components/bash-script-command.cjs +106 -0
  10. package/dist/components/bash-script-command.d.cts +10 -0
  11. package/dist/components/bash-script-command.d.cts.map +1 -0
  12. package/dist/components/bash-script-command.d.mts +10 -0
  13. package/dist/components/bash-script-command.d.mts.map +1 -0
  14. package/dist/components/bash-script-command.mjs +106 -0
  15. package/dist/components/bash-script-command.mjs.map +1 -0
  16. package/dist/components/bash-shared.cjs +172 -0
  17. package/dist/components/bash-shared.d.cts +10 -0
  18. package/dist/components/bash-shared.d.cts.map +1 -0
  19. package/dist/components/bash-shared.d.mts +10 -0
  20. package/dist/components/bash-shared.d.mts.map +1 -0
  21. package/dist/components/bash-shared.mjs +172 -0
  22. package/dist/components/bash-shared.mjs.map +1 -0
  23. package/dist/components/fish-config-command.cjs +132 -0
  24. package/dist/components/fish-config-command.d.cts +10 -0
  25. package/dist/components/fish-config-command.d.cts.map +1 -0
  26. package/dist/components/fish-config-command.d.mts +10 -0
  27. package/dist/components/fish-config-command.d.mts.map +1 -0
  28. package/dist/components/fish-config-command.mjs +132 -0
  29. package/dist/components/fish-config-command.mjs.map +1 -0
  30. package/dist/components/fish-script-command.cjs +106 -0
  31. package/dist/components/fish-script-command.d.cts +10 -0
  32. package/dist/components/fish-script-command.d.cts.map +1 -0
  33. package/dist/components/fish-script-command.d.mts +10 -0
  34. package/dist/components/fish-script-command.d.mts.map +1 -0
  35. package/dist/components/fish-script-command.mjs +106 -0
  36. package/dist/components/fish-script-command.mjs.map +1 -0
  37. package/dist/components/{fish-command.cjs → fish-shared.cjs} +40 -144
  38. package/dist/components/fish-shared.d.cts +10 -0
  39. package/dist/components/fish-shared.d.cts.map +1 -0
  40. package/dist/components/fish-shared.d.mts +10 -0
  41. package/dist/components/fish-shared.d.mts.map +1 -0
  42. package/dist/components/{fish-command.mjs → fish-shared.mjs} +45 -149
  43. package/dist/components/fish-shared.mjs.map +1 -0
  44. package/dist/components/index.cjs +24 -8
  45. package/dist/components/index.d.cts +13 -5
  46. package/dist/components/index.d.mts +13 -5
  47. package/dist/components/index.mjs +13 -5
  48. package/dist/components/powershell-config-command.cjs +128 -0
  49. package/dist/components/powershell-config-command.d.cts +7 -0
  50. package/dist/components/powershell-config-command.d.cts.map +1 -0
  51. package/dist/components/powershell-config-command.d.mts +7 -0
  52. package/dist/components/powershell-config-command.d.mts.map +1 -0
  53. package/dist/components/powershell-config-command.mjs +128 -0
  54. package/dist/components/powershell-config-command.mjs.map +1 -0
  55. package/dist/components/powershell-script-command.cjs +106 -0
  56. package/dist/components/powershell-script-command.d.cts +10 -0
  57. package/dist/components/powershell-script-command.d.cts.map +1 -0
  58. package/dist/components/powershell-script-command.d.mts +10 -0
  59. package/dist/components/powershell-script-command.d.mts.map +1 -0
  60. package/dist/components/powershell-script-command.mjs +106 -0
  61. package/dist/components/powershell-script-command.mjs.map +1 -0
  62. package/dist/components/{powershell-command.cjs → powershell-shared.cjs} +40 -146
  63. package/dist/components/powershell-shared.d.cts +10 -0
  64. package/dist/components/powershell-shared.d.cts.map +1 -0
  65. package/dist/components/powershell-shared.d.mts +10 -0
  66. package/dist/components/powershell-shared.d.mts.map +1 -0
  67. package/dist/components/{powershell-command.mjs → powershell-shared.mjs} +44 -150
  68. package/dist/components/powershell-shared.mjs.map +1 -0
  69. package/dist/components/zsh-config-command.cjs +132 -0
  70. package/dist/components/zsh-config-command.d.cts +10 -0
  71. package/dist/components/zsh-config-command.d.cts.map +1 -0
  72. package/dist/components/zsh-config-command.d.mts +10 -0
  73. package/dist/components/zsh-config-command.d.mts.map +1 -0
  74. package/dist/components/zsh-config-command.mjs +132 -0
  75. package/dist/components/zsh-config-command.mjs.map +1 -0
  76. package/dist/components/zsh-script-command.cjs +111 -0
  77. package/dist/components/zsh-script-command.d.cts +10 -0
  78. package/dist/components/zsh-script-command.d.cts.map +1 -0
  79. package/dist/components/zsh-script-command.d.mts +10 -0
  80. package/dist/components/zsh-script-command.d.mts.map +1 -0
  81. package/dist/components/zsh-script-command.mjs +111 -0
  82. package/dist/components/zsh-script-command.mjs.map +1 -0
  83. package/dist/components/{zsh-command.cjs → zsh-shared.cjs} +41 -147
  84. package/dist/components/zsh-shared.d.cts +10 -0
  85. package/dist/components/zsh-shared.d.cts.map +1 -0
  86. package/dist/components/zsh-shared.d.mts +10 -0
  87. package/dist/components/zsh-shared.d.mts.map +1 -0
  88. package/dist/components/{zsh-command.mjs → zsh-shared.mjs} +45 -151
  89. package/dist/components/zsh-shared.mjs.map +1 -0
  90. package/dist/index.cjs +232 -68
  91. package/dist/index.d.cts.map +1 -1
  92. package/dist/index.d.mts.map +1 -1
  93. package/dist/index.mjs +232 -68
  94. package/dist/index.mjs.map +1 -1
  95. package/package.json +148 -36
  96. package/dist/components/bash-command.cjs +0 -276
  97. package/dist/components/bash-command.d.cts +0 -10
  98. package/dist/components/bash-command.d.cts.map +0 -1
  99. package/dist/components/bash-command.d.mts +0 -10
  100. package/dist/components/bash-command.d.mts.map +0 -1
  101. package/dist/components/bash-command.mjs +0 -276
  102. package/dist/components/bash-command.mjs.map +0 -1
  103. package/dist/components/fish-command.d.cts +0 -10
  104. package/dist/components/fish-command.d.cts.map +0 -1
  105. package/dist/components/fish-command.d.mts +0 -10
  106. package/dist/components/fish-command.d.mts.map +0 -1
  107. package/dist/components/fish-command.mjs.map +0 -1
  108. package/dist/components/powershell-command.d.cts +0 -10
  109. package/dist/components/powershell-command.d.cts.map +0 -1
  110. package/dist/components/powershell-command.d.mts +0 -10
  111. package/dist/components/powershell-command.d.mts.map +0 -1
  112. package/dist/components/powershell-command.mjs.map +0 -1
  113. package/dist/components/zsh-command.d.cts +0 -10
  114. package/dist/components/zsh-command.d.cts.map +0 -1
  115. package/dist/components/zsh-command.d.mts +0 -10
  116. package/dist/components/zsh-command.d.mts.map +0 -1
  117. package/dist/components/zsh-command.mjs.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/plugin-completions",
3
- "version": "0.2.24",
3
+ "version": "0.3.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": {
@@ -69,60 +69,172 @@
69
69
  "default": "./dist/components/index.mjs"
70
70
  }
71
71
  },
72
- "./components/bash-command": {
72
+ "./components/bash-config-command": {
73
73
  "require": {
74
- "types": "./dist/components/bash-command.d.cts",
75
- "default": "./dist/components/bash-command.cjs"
74
+ "types": "./dist/components/bash-config-command.d.cts",
75
+ "default": "./dist/components/bash-config-command.cjs"
76
76
  },
77
77
  "import": {
78
- "types": "./dist/components/bash-command.d.mts",
79
- "default": "./dist/components/bash-command.mjs"
78
+ "types": "./dist/components/bash-config-command.d.mts",
79
+ "default": "./dist/components/bash-config-command.mjs"
80
80
  },
81
81
  "default": {
82
- "types": "./dist/components/bash-command.d.mts",
83
- "default": "./dist/components/bash-command.mjs"
82
+ "types": "./dist/components/bash-config-command.d.mts",
83
+ "default": "./dist/components/bash-config-command.mjs"
84
84
  }
85
85
  },
86
- "./components/fish-command": {
86
+ "./components/bash-script-command": {
87
87
  "require": {
88
- "types": "./dist/components/fish-command.d.cts",
89
- "default": "./dist/components/fish-command.cjs"
88
+ "types": "./dist/components/bash-script-command.d.cts",
89
+ "default": "./dist/components/bash-script-command.cjs"
90
90
  },
91
91
  "import": {
92
- "types": "./dist/components/fish-command.d.mts",
93
- "default": "./dist/components/fish-command.mjs"
92
+ "types": "./dist/components/bash-script-command.d.mts",
93
+ "default": "./dist/components/bash-script-command.mjs"
94
94
  },
95
95
  "default": {
96
- "types": "./dist/components/fish-command.d.mts",
97
- "default": "./dist/components/fish-command.mjs"
96
+ "types": "./dist/components/bash-script-command.d.mts",
97
+ "default": "./dist/components/bash-script-command.mjs"
98
98
  }
99
99
  },
100
- "./components/powershell-command": {
100
+ "./components/bash-shared": {
101
101
  "require": {
102
- "types": "./dist/components/powershell-command.d.cts",
103
- "default": "./dist/components/powershell-command.cjs"
102
+ "types": "./dist/components/bash-shared.d.cts",
103
+ "default": "./dist/components/bash-shared.cjs"
104
104
  },
105
105
  "import": {
106
- "types": "./dist/components/powershell-command.d.mts",
107
- "default": "./dist/components/powershell-command.mjs"
106
+ "types": "./dist/components/bash-shared.d.mts",
107
+ "default": "./dist/components/bash-shared.mjs"
108
108
  },
109
109
  "default": {
110
- "types": "./dist/components/powershell-command.d.mts",
111
- "default": "./dist/components/powershell-command.mjs"
110
+ "types": "./dist/components/bash-shared.d.mts",
111
+ "default": "./dist/components/bash-shared.mjs"
112
112
  }
113
113
  },
114
- "./components/zsh-command": {
114
+ "./components/fish-config-command": {
115
115
  "require": {
116
- "types": "./dist/components/zsh-command.d.cts",
117
- "default": "./dist/components/zsh-command.cjs"
116
+ "types": "./dist/components/fish-config-command.d.cts",
117
+ "default": "./dist/components/fish-config-command.cjs"
118
118
  },
119
119
  "import": {
120
- "types": "./dist/components/zsh-command.d.mts",
121
- "default": "./dist/components/zsh-command.mjs"
120
+ "types": "./dist/components/fish-config-command.d.mts",
121
+ "default": "./dist/components/fish-config-command.mjs"
122
122
  },
123
123
  "default": {
124
- "types": "./dist/components/zsh-command.d.mts",
125
- "default": "./dist/components/zsh-command.mjs"
124
+ "types": "./dist/components/fish-config-command.d.mts",
125
+ "default": "./dist/components/fish-config-command.mjs"
126
+ }
127
+ },
128
+ "./components/fish-script-command": {
129
+ "require": {
130
+ "types": "./dist/components/fish-script-command.d.cts",
131
+ "default": "./dist/components/fish-script-command.cjs"
132
+ },
133
+ "import": {
134
+ "types": "./dist/components/fish-script-command.d.mts",
135
+ "default": "./dist/components/fish-script-command.mjs"
136
+ },
137
+ "default": {
138
+ "types": "./dist/components/fish-script-command.d.mts",
139
+ "default": "./dist/components/fish-script-command.mjs"
140
+ }
141
+ },
142
+ "./components/fish-shared": {
143
+ "require": {
144
+ "types": "./dist/components/fish-shared.d.cts",
145
+ "default": "./dist/components/fish-shared.cjs"
146
+ },
147
+ "import": {
148
+ "types": "./dist/components/fish-shared.d.mts",
149
+ "default": "./dist/components/fish-shared.mjs"
150
+ },
151
+ "default": {
152
+ "types": "./dist/components/fish-shared.d.mts",
153
+ "default": "./dist/components/fish-shared.mjs"
154
+ }
155
+ },
156
+ "./components/powershell-config-command": {
157
+ "require": {
158
+ "types": "./dist/components/powershell-config-command.d.cts",
159
+ "default": "./dist/components/powershell-config-command.cjs"
160
+ },
161
+ "import": {
162
+ "types": "./dist/components/powershell-config-command.d.mts",
163
+ "default": "./dist/components/powershell-config-command.mjs"
164
+ },
165
+ "default": {
166
+ "types": "./dist/components/powershell-config-command.d.mts",
167
+ "default": "./dist/components/powershell-config-command.mjs"
168
+ }
169
+ },
170
+ "./components/powershell-script-command": {
171
+ "require": {
172
+ "types": "./dist/components/powershell-script-command.d.cts",
173
+ "default": "./dist/components/powershell-script-command.cjs"
174
+ },
175
+ "import": {
176
+ "types": "./dist/components/powershell-script-command.d.mts",
177
+ "default": "./dist/components/powershell-script-command.mjs"
178
+ },
179
+ "default": {
180
+ "types": "./dist/components/powershell-script-command.d.mts",
181
+ "default": "./dist/components/powershell-script-command.mjs"
182
+ }
183
+ },
184
+ "./components/powershell-shared": {
185
+ "require": {
186
+ "types": "./dist/components/powershell-shared.d.cts",
187
+ "default": "./dist/components/powershell-shared.cjs"
188
+ },
189
+ "import": {
190
+ "types": "./dist/components/powershell-shared.d.mts",
191
+ "default": "./dist/components/powershell-shared.mjs"
192
+ },
193
+ "default": {
194
+ "types": "./dist/components/powershell-shared.d.mts",
195
+ "default": "./dist/components/powershell-shared.mjs"
196
+ }
197
+ },
198
+ "./components/zsh-config-command": {
199
+ "require": {
200
+ "types": "./dist/components/zsh-config-command.d.cts",
201
+ "default": "./dist/components/zsh-config-command.cjs"
202
+ },
203
+ "import": {
204
+ "types": "./dist/components/zsh-config-command.d.mts",
205
+ "default": "./dist/components/zsh-config-command.mjs"
206
+ },
207
+ "default": {
208
+ "types": "./dist/components/zsh-config-command.d.mts",
209
+ "default": "./dist/components/zsh-config-command.mjs"
210
+ }
211
+ },
212
+ "./components/zsh-script-command": {
213
+ "require": {
214
+ "types": "./dist/components/zsh-script-command.d.cts",
215
+ "default": "./dist/components/zsh-script-command.cjs"
216
+ },
217
+ "import": {
218
+ "types": "./dist/components/zsh-script-command.d.mts",
219
+ "default": "./dist/components/zsh-script-command.mjs"
220
+ },
221
+ "default": {
222
+ "types": "./dist/components/zsh-script-command.d.mts",
223
+ "default": "./dist/components/zsh-script-command.mjs"
224
+ }
225
+ },
226
+ "./components/zsh-shared": {
227
+ "require": {
228
+ "types": "./dist/components/zsh-shared.d.cts",
229
+ "default": "./dist/components/zsh-shared.cjs"
230
+ },
231
+ "import": {
232
+ "types": "./dist/components/zsh-shared.d.mts",
233
+ "default": "./dist/components/zsh-shared.mjs"
234
+ },
235
+ "default": {
236
+ "types": "./dist/components/zsh-shared.d.mts",
237
+ "default": "./dist/components/zsh-shared.mjs"
126
238
  }
127
239
  },
128
240
  "./helpers": {
@@ -223,16 +335,16 @@
223
335
  "dependencies": {
224
336
  "@alloy-js/core": "0.23.0-dev.8",
225
337
  "@alloy-js/typescript": "0.23.0-dev.4",
226
- "@powerlines/deepkit": "^0.6.162",
227
- "@powerlines/plugin-alloy": "^0.25.70",
228
- "@powerlines/plugin-plugin": "^0.12.334",
229
- "@shell-shock/core": "^0.14.3",
338
+ "@powerlines/deepkit": "^0.6.163",
339
+ "@powerlines/plugin-alloy": "^0.26.0",
340
+ "@powerlines/plugin-plugin": "^0.12.335",
341
+ "@shell-shock/core": "^0.14.4",
230
342
  "@stryke/path": "^0.27.3",
231
343
  "@stryke/string-format": "^0.17.7",
232
- "powerlines": "^0.42.24"
344
+ "powerlines": "^0.42.25"
233
345
  },
234
346
  "devDependencies": {
235
- "@powerlines/plugin-deepkit": "^0.11.262",
347
+ "@powerlines/plugin-deepkit": "^0.11.263",
236
348
  "@types/node": "^25.5.0"
237
349
  },
238
350
  "publishConfig": {
@@ -250,5 +362,5 @@
250
362
  "./package.json": "./package.json"
251
363
  }
252
364
  },
253
- "gitHead": "27a9e457bd50dd3576a1edf1882f43d82a402743"
365
+ "gitHead": "d123fb843b98e07d65b61f69f3f6a74b68ddc3b0"
254
366
  }
@@ -1,276 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_helpers_complete_command = require('../helpers/complete-command.cjs');
3
- const require_helpers_completion_directive_constants = require('../helpers/completion-directive-constants.cjs');
4
- require('../helpers/index.cjs');
5
- let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
- let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
7
- let _alloy_js_core = require("@alloy-js/core");
8
- let _alloy_js_typescript = require("@alloy-js/typescript");
9
- let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
10
- let _powerlines_plugin_alloy_core = require("@powerlines/plugin-alloy/core");
11
- let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
12
- let _powerlines_plugin_alloy_typescript = require("@powerlines/plugin-alloy/typescript");
13
- let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
14
- let _stryke_path = require("@stryke/path");
15
- let _stryke_string_format_snake_case = require("@stryke/string-format/snake-case");
16
-
17
- //#region src/components/bash-command.tsx
18
- /**
19
- * The Bash Completions commands' handler wrapper for the Shell Shock project.
20
- */
21
- function BashCompletionsCommand() {
22
- const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
23
- const bin = (0, _alloy_js_core.computed)(() => (0, _shell_shock_core_plugin_utils.getAppBin)(context));
24
- const name = (0, _alloy_js_core.computed)(() => (0, _stryke_string_format_snake_case.snakeCase)(bin.value));
25
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
26
- get path() {
27
- return (0, _stryke_path.joinPaths)(context.entryPath, "completions", "bash", "command.ts");
28
- },
29
- imports: {
30
- "node:os": "os",
31
- "node:path": ["join"],
32
- "node:fs/promises": ["readFile", "writeFile"]
33
- },
34
- builtinImports: { "shell-shock:console": [
35
- "colors",
36
- "writeLine",
37
- "success",
38
- "warn",
39
- "stripAnsi"
40
- ] },
41
- get children() {
42
- return [
43
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Options for the Bash completions command." }),
44
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
45
- "export": true,
46
- name: "BashCompletionsOptions",
47
- get children() {
48
- return [
49
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
50
- heading: "The path to write the completion script to.",
51
- get children() {
52
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `If no extension is provided, the \`.bash\` extension will be used.` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
53
- get type() {
54
- return _powerlines_deepkit_vendor_type.ReflectionKind.string;
55
- },
56
- get defaultValue() {
57
- return `${bin.value}-completions.bash`;
58
- }
59
- })];
60
- }
61
- }),
62
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
63
- name: "script",
64
- optional: true,
65
- type: "string | true"
66
- }),
67
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
68
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
69
- heading: "The Bash configuration file to append the completion script to.",
70
- get children() {
71
- return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The generated completion script will be appended to the specified configuration file. Possible values for the Bash configuration file include: \\n- \`~/.bashrc\` \\n- \`~/.bash_profile\`` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
72
- get type() {
73
- return _powerlines_deepkit_vendor_type.ReflectionKind.string;
74
- },
75
- defaultValue: "~/.bashrc"
76
- })];
77
- }
78
- }),
79
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
80
- name: "config",
81
- optional: true,
82
- type: "string | true"
83
- })
84
- ];
85
- }
86
- }),
87
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
88
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Handler logic for the \\`completions bash\\` command." }),
89
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
90
- "export": true,
91
- "default": true,
92
- async: true,
93
- name: "handler",
94
- parameters: [{
95
- name: "options",
96
- type: "BashCompletionsOptions"
97
- }],
98
- get children() {
99
- return [
100
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
101
- "const": true,
102
- name: "completions",
103
- type: "string",
104
- get initializer() {
105
- return _alloy_js_core.code` \`# bash completion for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)}
106
-
107
- # Define shell completion directives
108
- readonly ShellCompDirectiveError=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveError}
109
- readonly ShellCompDirectiveNoSpace=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveNoSpace}
110
- readonly ShellCompDirectiveNoFileComp=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveNoFileComp}
111
- readonly ShellCompDirectiveFilterFileExt=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveFilterFileExt}
112
- readonly ShellCompDirectiveFilterDirs=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveFilterDirs}
113
- readonly ShellCompDirectiveKeepOrder=${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveKeepOrder}
114
-
115
- # Function to debug completion
116
- __${name.value}_debug() {
117
- if [[ -n \\\${BASH_COMP_DEBUG_FILE:-} ]]; then
118
- echo "$*" >> "\\\${BASH_COMP_DEBUG_FILE}"
119
- fi
120
- }
121
-
122
- # Function to handle completions
123
- __${name.value}_complete() {
124
- local cur prev words cword
125
- _get_comp_words_by_ref -n "=:" cur prev words cword
126
-
127
- local requestComp out directive
128
-
129
- # Build the command to get completions
130
- requestComp="${require_helpers_complete_command.EXEC_COMMAND} complete -- \\\${words[@]:1}"
131
-
132
- # Add an empty parameter if the last parameter is complete
133
- if [[ -z "$cur" ]]; then
134
- requestComp="$requestComp ''"
135
- fi
136
-
137
- # Get completions from the program
138
- out=$(eval "$requestComp" 2>/dev/null)
139
-
140
- # Extract directive if present
141
- directive=0
142
- if [[ "$out" == *:* ]]; then
143
- directive=\\\${out##*:}
144
- out=\\\${out%:*}
145
- fi
146
-
147
- # Process completions based on directive
148
- if [[ $((directive & $ShellCompDirectiveError)) -ne 0 ]]; then
149
- # Error, no completion
150
- return
151
- fi
152
-
153
- # Apply directives
154
- if [[ $((directive & $ShellCompDirectiveNoSpace)) -ne 0 ]]; then
155
- compopt -o nospace
156
- fi
157
- if [[ $((directive & $ShellCompDirectiveKeepOrder)) -ne 0 ]]; then
158
- compopt -o nosort
159
- fi
160
- if [[ $((directive & $ShellCompDirectiveNoFileComp)) -ne 0 ]]; then
161
- compopt +o default
162
- fi
163
-
164
- # Handle file extension filtering
165
- if [[ $((directive & $ShellCompDirectiveFilterFileExt)) -ne 0 ]]; then
166
- local filter=""
167
- for ext in $out; do
168
- filter="$filter|$ext"
169
- done
170
- filter="\\.($filter)"
171
- compopt -o filenames
172
- COMPREPLY=( $(compgen -f -X "!$filter" -- "$cur") )
173
- return
174
- fi
175
-
176
- # Handle directory filtering
177
- if [[ $((directive & $ShellCompDirectiveFilterDirs)) -ne 0 ]]; then
178
- compopt -o dirnames
179
- COMPREPLY=( $(compgen -d -- "$cur") )
180
- return
181
- fi
182
-
183
- # Process completions
184
- local IFS=$'\\n'
185
- local tab=$(printf '\\t')
186
-
187
- # Parse completions with descriptions
188
- local completions=()
189
- while read -r comp; do
190
- if [[ "$comp" == *$tab* ]]; then
191
- # Split completion and description
192
- local value=\\\${comp%%$tab*}
193
- local desc=\\\${comp#*$tab}
194
- completions+=("$value")
195
- else
196
- completions+=("$comp")
197
- fi
198
- done <<< "$out"
199
-
200
- # Return completions
201
- COMPREPLY=( $(compgen -W "\\\${completions[*]}" -- "$cur") )
202
- }
203
-
204
- # Register completion function
205
- complete -F __${name.value}_complete ${bin.value}
206
- \`; `;
207
- }
208
- }),
209
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
210
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
211
- condition: _alloy_js_core.code`options.config`,
212
- get children() {
213
- return [
214
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
215
- "let": true,
216
- name: "configFilePath",
217
- type: "string",
218
- initializer: _alloy_js_core.code`options.config === true ? "~/.bashrc" : options.config`
219
- }),
220
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
221
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
222
- condition: _alloy_js_core.code`configFilePath.startsWith("~")`,
223
- children: _alloy_js_core.code`configFilePath = join(os.homedir(), configFilePath.replace("~", "")); `
224
- }),
225
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
226
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
227
- "let": true,
228
- name: "configFileContent",
229
- type: "string",
230
- initializer: _alloy_js_core.code`"";`
231
- }),
232
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
233
- (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`try {
234
- configFileContent = await readFile(configFilePath, "utf8");
235
- } catch (error) {
236
- if (Error.isError(error) && error.code === "ENOENT") {
237
- // If the file doesn't exist, we can create it later when writing the completion script.
238
- warn(\`Configuration file \${colors.bold(configFilePath)} does not exist. It will be created when the completion script is written.\`);
239
- } else {
240
- return { error };
241
- }
242
- }
243
-
244
- await writeFile(configFilePath, \`\${configFileContent}\\n\\n\${stripAnsi(completions)}\`);
245
-
246
- success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Bash completion script has been generated and appended to \${colors.bold(configFilePath)}. Please restart your terminal or run \`source \${configFilePath}\` to apply the changes.\`); `)
247
- ];
248
- }
249
- }),
250
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
251
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
252
- condition: _alloy_js_core.code`options.script`,
253
- get children() {
254
- return _alloy_js_core.code`const outputPath = options.script === true ? "${bin.value}-completions.bash" : options.script;
255
- await writeFile(outputPath, stripAnsi(completions));
256
-
257
- success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Bash completion script has been generated at \${colors.bold(outputPath)}.\`);`;
258
- }
259
- }),
260
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
261
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
262
- condition: _alloy_js_core.code`!options.config && !options.script`,
263
- children: _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
264
- writeLine(completions);
265
- writeLine(" ------------------------------------------------- ");`
266
- })
267
- ];
268
- }
269
- })
270
- ];
271
- }
272
- });
273
- }
274
-
275
- //#endregion
276
- exports.BashCompletionsCommand = BashCompletionsCommand;
@@ -1,10 +0,0 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
-
3
- //#region src/components/bash-command.d.ts
4
- /**
5
- * The Bash Completions commands' handler wrapper for the Shell Shock project.
6
- */
7
- declare function BashCompletionsCommand(): _$_alloy_js_core0.Children;
8
- //#endregion
9
- export { BashCompletionsCommand };
10
- //# sourceMappingURL=bash-command.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bash-command.d.cts","names":[],"sources":["../../src/components/bash-command.tsx"],"mappings":";;;;;;iBA+CgB,sBAAA,CAAA,GAAsB,iBAAA,CAAA,QAAA"}
@@ -1,10 +0,0 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
-
3
- //#region src/components/bash-command.d.ts
4
- /**
5
- * The Bash Completions commands' handler wrapper for the Shell Shock project.
6
- */
7
- declare function BashCompletionsCommand(): _$_alloy_js_core0.Children;
8
- //#endregion
9
- export { BashCompletionsCommand };
10
- //# sourceMappingURL=bash-command.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bash-command.d.mts","names":[],"sources":["../../src/components/bash-command.tsx"],"mappings":";;;;;;iBA+CgB,sBAAA,CAAA,GAAsB,iBAAA,CAAA,QAAA"}