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