@shell-shock/plugin-completions 0.2.2 → 0.2.6
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/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/components/bash-command.cjs +59 -58
- package/dist/components/bash-command.d.cts +2 -2
- package/dist/components/bash-command.d.cts.map +1 -1
- package/dist/components/bash-command.d.mts +2 -2
- package/dist/components/bash-command.d.mts.map +1 -1
- package/dist/components/bash-command.mjs.map +1 -1
- package/dist/components/fish-command.cjs +124 -123
- package/dist/components/fish-command.d.cts.map +1 -1
- package/dist/components/fish-command.d.mts +2 -2
- package/dist/components/fish-command.d.mts.map +1 -1
- package/dist/components/fish-command.mjs.map +1 -1
- package/dist/components/index.cjs +1 -0
- package/dist/components/powershell-command.cjs +82 -81
- package/dist/components/powershell-command.d.cts +2 -2
- package/dist/components/powershell-command.d.cts.map +1 -1
- package/dist/components/powershell-command.d.mts.map +1 -1
- package/dist/components/powershell-command.mjs +1 -1
- package/dist/components/powershell-command.mjs.map +1 -1
- package/dist/components/zsh-command.cjs +91 -90
- package/dist/components/zsh-command.d.cts.map +1 -1
- package/dist/components/zsh-command.d.mts.map +1 -1
- package/dist/components/zsh-command.mjs.map +1 -1
- package/dist/helpers/complete-command.cjs +1 -0
- package/dist/helpers/complete-command.d.cts.map +1 -1
- package/dist/helpers/complete-command.d.mts.map +1 -1
- package/dist/helpers/complete-command.mjs.map +1 -1
- package/dist/helpers/completion-directive-constants.cjs +1 -0
- package/dist/helpers/completion-directive-constants.d.cts.map +1 -1
- package/dist/helpers/completion-directive-constants.d.mts.map +1 -1
- package/dist/helpers/completion-directive-constants.mjs.map +1 -1
- package/dist/helpers/index.cjs +1 -0
- package/dist/index.cjs +22 -23
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.cjs +1 -0
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/shell-type.cjs +1 -0
- 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.map +1 -1
- package/package.json +12 -12
|
@@ -1,26 +1,27 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
1
2
|
const require_helpers_complete_command = require('../helpers/complete-command.cjs');
|
|
2
3
|
const require_helpers_completion_directive_constants = require('../helpers/completion-directive-constants.cjs');
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let
|
|
11
|
-
let
|
|
12
|
-
let
|
|
13
|
-
let
|
|
4
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
6
|
+
let _stryke_path = require("@stryke/path");
|
|
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_string_format_snake_case = require("@stryke/string-format/snake-case");
|
|
14
15
|
|
|
15
16
|
//#region src/components/fish-command.tsx
|
|
16
17
|
/**
|
|
17
18
|
* The Fish Completions commands' handler wrapper for the Shell Shock project.
|
|
18
19
|
*/
|
|
19
20
|
function FishCompletionsCommand() {
|
|
20
|
-
const context = (0,
|
|
21
|
-
return (0,
|
|
21
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
22
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.TypescriptFile, {
|
|
22
23
|
get path() {
|
|
23
|
-
return (0,
|
|
24
|
+
return (0, _stryke_path.joinPaths)(context.entryPath, "completions", "fish", "command.ts");
|
|
24
25
|
},
|
|
25
26
|
imports: {
|
|
26
27
|
"node:os": ["os"],
|
|
@@ -35,43 +36,43 @@ function FishCompletionsCommand() {
|
|
|
35
36
|
] },
|
|
36
37
|
get children() {
|
|
37
38
|
return [
|
|
38
|
-
(0,
|
|
39
|
-
(0,
|
|
39
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Options for the Fish completions command." }),
|
|
40
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
40
41
|
"export": true,
|
|
41
42
|
name: "FishCompletionsOptions",
|
|
42
43
|
get children() {
|
|
43
44
|
return [
|
|
44
|
-
(0,
|
|
45
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
45
46
|
heading: "The path to write the completion script to.",
|
|
46
47
|
get children() {
|
|
47
|
-
return [(0,
|
|
48
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `If no extension is provided, the \`.fish\` extension will be used.` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
|
|
48
49
|
get type() {
|
|
49
|
-
return
|
|
50
|
+
return _powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
50
51
|
},
|
|
51
52
|
get defaultValue() {
|
|
52
|
-
return `${(0,
|
|
53
|
+
return `${(0, _shell_shock_core_plugin_utils.getAppBin)(context)}-completions.fish`;
|
|
53
54
|
}
|
|
54
55
|
})];
|
|
55
56
|
}
|
|
56
57
|
}),
|
|
57
|
-
(0,
|
|
58
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
58
59
|
name: "script",
|
|
59
60
|
optional: true,
|
|
60
61
|
type: "string | true"
|
|
61
62
|
}),
|
|
62
|
-
(0,
|
|
63
|
-
(0,
|
|
63
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
64
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
64
65
|
heading: "The Fish configuration file to append the completion script to.",
|
|
65
66
|
get children() {
|
|
66
|
-
return [(0,
|
|
67
|
+
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 Fish configuration file include: \\n- \`~/.config/fish/config.fish\`` }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocDefaultValue, {
|
|
67
68
|
get type() {
|
|
68
|
-
return
|
|
69
|
+
return _powerlines_deepkit_vendor_type.ReflectionKind.string;
|
|
69
70
|
},
|
|
70
71
|
defaultValue: "~/.config/fish/config.fish"
|
|
71
72
|
})];
|
|
72
73
|
}
|
|
73
74
|
}),
|
|
74
|
-
(0,
|
|
75
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript.InterfaceMember, {
|
|
75
76
|
name: "config",
|
|
76
77
|
optional: true,
|
|
77
78
|
type: "string | true"
|
|
@@ -79,9 +80,9 @@ function FishCompletionsCommand() {
|
|
|
79
80
|
];
|
|
80
81
|
}
|
|
81
82
|
}),
|
|
82
|
-
(0,
|
|
83
|
-
(0,
|
|
84
|
-
(0,
|
|
83
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
84
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, { heading: "Handler logic for the \\`completions fish\\` command." }),
|
|
85
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
85
86
|
"export": true,
|
|
86
87
|
"default": true,
|
|
87
88
|
async: true,
|
|
@@ -92,35 +93,35 @@ function FishCompletionsCommand() {
|
|
|
92
93
|
}],
|
|
93
94
|
get children() {
|
|
94
95
|
return [
|
|
95
|
-
(0,
|
|
96
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
96
97
|
"const": true,
|
|
97
98
|
name: "completions",
|
|
98
99
|
type: "string",
|
|
99
100
|
get initializer() {
|
|
100
|
-
return
|
|
101
|
+
return _alloy_js_core.code`# fish completion for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} -*- shell-script -*-
|
|
101
102
|
|
|
102
|
-
function __${(0,
|
|
103
|
+
function __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug
|
|
103
104
|
set -l file "$BASH_COMP_DEBUG_FILE"
|
|
104
105
|
if test -n "$file"
|
|
105
106
|
echo "$argv" >> $file
|
|
106
107
|
end
|
|
107
108
|
end
|
|
108
109
|
|
|
109
|
-
function __${(0,
|
|
110
|
-
__${(0,
|
|
110
|
+
function __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion
|
|
111
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Starting __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion"
|
|
111
112
|
|
|
112
113
|
# Extract all args except the last one
|
|
113
114
|
set -l args (commandline -opc)
|
|
114
115
|
# Extract the last arg and escape it in case it is a space or wildcard
|
|
115
116
|
set -l lastArg (string escape -- (commandline -ct))
|
|
116
117
|
|
|
117
|
-
__${(0,
|
|
118
|
-
__${(0,
|
|
118
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "args: $args"
|
|
119
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "last arg: $lastArg"
|
|
119
120
|
|
|
120
121
|
# Build the completion request command
|
|
121
122
|
set -l requestComp "${require_helpers_complete_command.exec} complete -- (string join ' ' -- (string escape -- $args[2..-1])) $lastArg"
|
|
122
123
|
|
|
123
|
-
__${(0,
|
|
124
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Calling $requestComp"
|
|
124
125
|
set -l results (eval $requestComp 2> /dev/null)
|
|
125
126
|
|
|
126
127
|
# Some programs may output extra empty lines after the directive.
|
|
@@ -143,9 +144,9 @@ function __${(0, __stryke_string_format_snake_case.snakeCase)((0, __shell_shock_
|
|
|
143
144
|
# completions must be prefixed with the flag
|
|
144
145
|
set -l flagPrefix (string match -r -- '-.*=' "$lastArg")
|
|
145
146
|
|
|
146
|
-
__${(0,
|
|
147
|
-
__${(0,
|
|
148
|
-
__${(0,
|
|
147
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Comps: $comps"
|
|
148
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "DirectiveLine: $directiveLine"
|
|
149
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "flagPrefix: $flagPrefix"
|
|
149
150
|
|
|
150
151
|
for comp in $comps
|
|
151
152
|
printf "%s%s\\n" "$flagPrefix" "$comp"
|
|
@@ -154,83 +155,83 @@ function __${(0, __stryke_string_format_snake_case.snakeCase)((0, __shell_shock_
|
|
|
154
155
|
printf "%s\\n" "$directiveLine"
|
|
155
156
|
end
|
|
156
157
|
|
|
157
|
-
# This function limits calls to __${(0,
|
|
158
|
-
function __${(0,
|
|
159
|
-
__${(0,
|
|
158
|
+
# This function limits calls to __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion, by caching the result
|
|
159
|
+
function __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once
|
|
160
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Starting __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once"
|
|
160
161
|
|
|
161
|
-
if test -n "$__${(0,
|
|
162
|
-
__${(0,
|
|
162
|
+
if test -n "$__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result"
|
|
163
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Seems like a valid result already exists, skipping __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion"
|
|
163
164
|
return 0
|
|
164
165
|
end
|
|
165
166
|
|
|
166
|
-
set --global __${(0,
|
|
167
|
-
if test -z "$__${(0,
|
|
168
|
-
__${(0,
|
|
167
|
+
set --global __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result (__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion)
|
|
168
|
+
if test -z "$__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result"
|
|
169
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "No completions, probably due to a failure"
|
|
169
170
|
return 1
|
|
170
171
|
end
|
|
171
172
|
|
|
172
|
-
__${(0,
|
|
173
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Performed completions and set __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result"
|
|
173
174
|
return 0
|
|
174
175
|
end
|
|
175
176
|
|
|
176
177
|
# This function is used to clear the cached result after completions are run
|
|
177
|
-
function __${(0,
|
|
178
|
-
__${(0,
|
|
179
|
-
__${(0,
|
|
180
|
-
set --erase __${(0,
|
|
181
|
-
__${(0,
|
|
178
|
+
function __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_clear_perform_completion_once_result
|
|
179
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug ""
|
|
180
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "========= clearing previously set __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result variable =========="
|
|
181
|
+
set --erase __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result
|
|
182
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Successfully erased the variable __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result"
|
|
182
183
|
end
|
|
183
184
|
|
|
184
|
-
function __${(0,
|
|
185
|
-
__${(0,
|
|
186
|
-
__${(0,
|
|
185
|
+
function __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_requires_order_preservation
|
|
186
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug ""
|
|
187
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "========= checking if order preservation is required =========="
|
|
187
188
|
|
|
188
|
-
__${(0,
|
|
189
|
-
if test -z "$__${(0,
|
|
190
|
-
__${(0,
|
|
189
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once
|
|
190
|
+
if test -z "$__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result"
|
|
191
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Error determining if order preservation is required"
|
|
191
192
|
return 1
|
|
192
193
|
end
|
|
193
194
|
|
|
194
|
-
set -l directive (string sub --start 2 $__${(0,
|
|
195
|
-
__${(0,
|
|
195
|
+
set -l directive (string sub --start 2 $__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result[-1])
|
|
196
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Directive is: $directive"
|
|
196
197
|
|
|
197
198
|
set -l shellCompDirectiveKeepOrder ${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveKeepOrder}
|
|
198
199
|
set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) % 2)
|
|
199
|
-
__${(0,
|
|
200
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Keeporder is: $keeporder"
|
|
200
201
|
|
|
201
202
|
if test $keeporder -ne 0
|
|
202
|
-
__${(0,
|
|
203
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "This does require order preservation"
|
|
203
204
|
return 0
|
|
204
205
|
end
|
|
205
206
|
|
|
206
|
-
__${(0,
|
|
207
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "This doesn't require order preservation"
|
|
207
208
|
return 1
|
|
208
209
|
end
|
|
209
210
|
|
|
210
211
|
# This function does two things:
|
|
211
|
-
# - Obtain the completions and store them in the global __${(0,
|
|
212
|
+
# - Obtain the completions and store them in the global __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results
|
|
212
213
|
# - Return false if file completion should be performed
|
|
213
|
-
function __${(0,
|
|
214
|
-
__${(0,
|
|
215
|
-
__${(0,
|
|
214
|
+
function __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_prepare_completions
|
|
215
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug ""
|
|
216
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "========= starting completion logic =========="
|
|
216
217
|
|
|
217
218
|
# Start fresh
|
|
218
|
-
set --erase __${(0,
|
|
219
|
+
set --erase __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results
|
|
219
220
|
|
|
220
|
-
__${(0,
|
|
221
|
-
__${(0,
|
|
221
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once
|
|
222
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Completion results: $__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result"
|
|
222
223
|
|
|
223
|
-
if test -z "$__${(0,
|
|
224
|
-
__${(0,
|
|
224
|
+
if test -z "$__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result"
|
|
225
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "No completion, probably due to a failure"
|
|
225
226
|
# Might as well do file completion, in case it helps
|
|
226
227
|
return 1
|
|
227
228
|
end
|
|
228
229
|
|
|
229
|
-
set -l directive (string sub --start 2 $__${(0,
|
|
230
|
-
set --global __${(0,
|
|
230
|
+
set -l directive (string sub --start 2 $__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result[-1])
|
|
231
|
+
set --global __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results $__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_perform_completion_once_result[1..-2]
|
|
231
232
|
|
|
232
|
-
__${(0,
|
|
233
|
-
__${(0,
|
|
233
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Completions are: $__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results"
|
|
234
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Directive is: $directive"
|
|
234
235
|
|
|
235
236
|
set -l shellCompDirectiveError ${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveError}
|
|
236
237
|
set -l shellCompDirectiveNoSpace ${require_helpers_completion_directive_constants.CompletionDirective.CompletionDirectiveNoSpace}
|
|
@@ -243,7 +244,7 @@ function __${(0, __stryke_string_format_snake_case.snakeCase)((0, __shell_shock_
|
|
|
243
244
|
|
|
244
245
|
set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2)
|
|
245
246
|
if test $compErr -eq 1
|
|
246
|
-
__${(0,
|
|
247
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Received error directive: aborting."
|
|
247
248
|
# Might as well do file completion, in case it helps
|
|
248
249
|
return 1
|
|
249
250
|
end
|
|
@@ -251,7 +252,7 @@ function __${(0, __stryke_string_format_snake_case.snakeCase)((0, __shell_shock_
|
|
|
251
252
|
set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2)
|
|
252
253
|
set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2)
|
|
253
254
|
if test $filefilter -eq 1; or test $dirfilter -eq 1
|
|
254
|
-
__${(0,
|
|
255
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "File extension filtering or directory filtering not supported"
|
|
255
256
|
# Do full file completion instead
|
|
256
257
|
return 1
|
|
257
258
|
end
|
|
@@ -259,7 +260,7 @@ function __${(0, __stryke_string_format_snake_case.snakeCase)((0, __shell_shock_
|
|
|
259
260
|
set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2)
|
|
260
261
|
set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2)
|
|
261
262
|
|
|
262
|
-
__${(0,
|
|
263
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "nospace: $nospace, nofiles: $nofiles"
|
|
263
264
|
|
|
264
265
|
# If we want to prevent a space, or if file completion is NOT disabled,
|
|
265
266
|
# we need to count the number of valid completions.
|
|
@@ -268,22 +269,22 @@ function __${(0, __stryke_string_format_snake_case.snakeCase)((0, __shell_shock_
|
|
|
268
269
|
# criteria than the prefix.
|
|
269
270
|
if test $nospace -ne 0; or test $nofiles -eq 0
|
|
270
271
|
set -l prefix (commandline -t | string escape --style=regex)
|
|
271
|
-
__${(0,
|
|
272
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "prefix: $prefix"
|
|
272
273
|
|
|
273
|
-
set -l completions (string match -r -- "^$prefix.*" $__${(0,
|
|
274
|
-
set --global __${(0,
|
|
275
|
-
__${(0,
|
|
274
|
+
set -l completions (string match -r -- "^$prefix.*" $__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results)
|
|
275
|
+
set --global __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results $completions
|
|
276
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Filtered completions are: $__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results"
|
|
276
277
|
|
|
277
278
|
# Important not to quote the variable for count to work
|
|
278
|
-
set -l numComps (count $__${(0,
|
|
279
|
-
__${(0,
|
|
279
|
+
set -l numComps (count $__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results)
|
|
280
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "numComps: $numComps"
|
|
280
281
|
|
|
281
282
|
if test $numComps -eq 1; and test $nospace -ne 0
|
|
282
283
|
# We must first split on \\t to get rid of the descriptions to be
|
|
283
284
|
# able to check what the actual completion will be.
|
|
284
285
|
# We don't need descriptions anyway since there is only a single
|
|
285
286
|
# real completion which the shell will expand immediately.
|
|
286
|
-
set -l split (string split --max 1 "\\t" $__${(0,
|
|
287
|
+
set -l split (string split --max 1 "\\t" $__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results[1])
|
|
287
288
|
|
|
288
289
|
# Fish won't add a space if the completion ends with any
|
|
289
290
|
# of the following characters: @=/:.,
|
|
@@ -291,16 +292,16 @@ function __${(0, __stryke_string_format_snake_case.snakeCase)((0, __shell_shock_
|
|
|
291
292
|
if not string match -r -q "[@=/:.,]" -- "$lastChar"
|
|
292
293
|
# In other cases, to support the "nospace" directive we trick the shell
|
|
293
294
|
# by outputting an extra, longer completion.
|
|
294
|
-
__${(0,
|
|
295
|
-
set --global __${(0,
|
|
296
|
-
__${(0,
|
|
295
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Adding second completion to perform nospace directive"
|
|
296
|
+
set --global __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results $split[1] $split[1].
|
|
297
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Completions are now: $__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results"
|
|
297
298
|
end
|
|
298
299
|
end
|
|
299
300
|
|
|
300
301
|
if test $numComps -eq 0; and test $nofiles -eq 0
|
|
301
302
|
# To be consistent with bash and zsh, we only trigger file
|
|
302
303
|
# completion when there are no other completions
|
|
303
|
-
__${(0,
|
|
304
|
+
__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_debug "Requesting file completion"
|
|
304
305
|
return 1
|
|
305
306
|
end
|
|
306
307
|
end
|
|
@@ -312,51 +313,51 @@ end
|
|
|
312
313
|
# so we can properly delete any completions provided by another script.
|
|
313
314
|
# Only do this if the program can be found, or else fish may print some errors; besides,
|
|
314
315
|
# the existing completions will only be loaded if the program can be found.
|
|
315
|
-
if type -q "${(0,
|
|
316
|
+
if type -q "${(0, _shell_shock_core_plugin_utils.getAppBin)(context)}"
|
|
316
317
|
# The space after the program name is essential to trigger completion for the program
|
|
317
318
|
# and not completion of the program name itself.
|
|
318
319
|
# Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish.
|
|
319
|
-
complete --do-complete "${(0,
|
|
320
|
+
complete --do-complete "${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} " > /dev/null 2>&1
|
|
320
321
|
end
|
|
321
322
|
|
|
322
323
|
# Remove any pre-existing completions for the program since we will be handling all of them.
|
|
323
|
-
complete -c ${(0,
|
|
324
|
+
complete -c ${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} -e
|
|
324
325
|
# This will get called after the two calls below and clear the cached result
|
|
325
|
-
complete -c ${(0,
|
|
326
|
-
# The call to __${(0,
|
|
326
|
+
complete -c ${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} -n '__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_clear_perform_completion_once_result'
|
|
327
|
+
# The call to __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_prepare_completions will setup __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results
|
|
327
328
|
# which provides the program's completion choices.
|
|
328
329
|
# If this doesn't require order preservation, we don't use the -k flag
|
|
329
|
-
complete -c ${(0,
|
|
330
|
+
complete -c ${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} -n 'not __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_requires_order_preservation && __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_prepare_completions' -f -a '$__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results'
|
|
330
331
|
# Otherwise we use the -k flag
|
|
331
|
-
complete -k -c ${(0,
|
|
332
|
+
complete -k -c ${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} -n '__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_requires_order_preservation && __${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_prepare_completions' -f -a '$__${(0, _stryke_string_format_snake_case.snakeCase)((0, _shell_shock_core_plugin_utils.getAppBin)(context))}_comp_results'
|
|
332
333
|
\`);`;
|
|
333
334
|
}
|
|
334
335
|
}),
|
|
335
|
-
(0,
|
|
336
|
-
(0,
|
|
337
|
-
condition:
|
|
336
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
337
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
338
|
+
condition: _alloy_js_core.code`options.config`,
|
|
338
339
|
get children() {
|
|
339
340
|
return [
|
|
340
|
-
(0,
|
|
341
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
341
342
|
"let": true,
|
|
342
343
|
name: "configFilePath",
|
|
343
344
|
type: "string",
|
|
344
|
-
initializer:
|
|
345
|
+
initializer: _alloy_js_core.code`options.config === true ? "~/.config/fish/config.fish" : options.config`
|
|
345
346
|
}),
|
|
346
|
-
(0,
|
|
347
|
-
(0,
|
|
348
|
-
condition:
|
|
349
|
-
children:
|
|
347
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
348
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
349
|
+
condition: _alloy_js_core.code`configFilePath.startsWith("~")`,
|
|
350
|
+
children: _alloy_js_core.code`configFilePath = join(os.homedir(), configFilePath.replace("~", "")); `
|
|
350
351
|
}),
|
|
351
|
-
(0,
|
|
352
|
-
(0,
|
|
352
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
353
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
353
354
|
"let": true,
|
|
354
355
|
name: "configFileContent",
|
|
355
356
|
type: "string",
|
|
356
|
-
initializer:
|
|
357
|
+
initializer: _alloy_js_core.code`"";`
|
|
357
358
|
}),
|
|
358
|
-
(0,
|
|
359
|
-
(0,
|
|
359
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
360
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`try {
|
|
360
361
|
configFileContent = await readFile(configFilePath, "utf8");
|
|
361
362
|
} catch (error) {
|
|
362
363
|
if (error.code === "ENOENT") {
|
|
@@ -369,24 +370,24 @@ complete -k -c ${(0, __shell_shock_core_plugin_utils.getAppBin)(context)} -n '__
|
|
|
369
370
|
|
|
370
371
|
await writeFile(configFilePath, \`\${configFileContent}\\n\\n\${stripAnsi(completions)}\`);
|
|
371
372
|
|
|
372
|
-
success(\`${(0,
|
|
373
|
+
success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Fish completion script has been generated and appended to \${colors.bold(configFilePath)}. Please restart your terminal or run \`source \${configFilePath}\` to apply the changes.\`); `)
|
|
373
374
|
];
|
|
374
375
|
}
|
|
375
376
|
}),
|
|
376
|
-
(0,
|
|
377
|
-
(0,
|
|
378
|
-
condition:
|
|
377
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
378
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
379
|
+
condition: _alloy_js_core.code`options.script`,
|
|
379
380
|
get children() {
|
|
380
|
-
return
|
|
381
|
+
return _alloy_js_core.code`const outputPath = options.script === true ? "${(0, _shell_shock_core_plugin_utils.getAppBin)(context)}-completions.fish" : options.script;
|
|
381
382
|
await writeFile(outputPath, stripAnsi(completions));
|
|
382
383
|
|
|
383
|
-
success(\`${(0,
|
|
384
|
+
success(\`${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} Fish completion script has been generated at \${colors.bold(outputPath)}.\`);`;
|
|
384
385
|
}
|
|
385
386
|
}),
|
|
386
|
-
(0,
|
|
387
|
-
(0,
|
|
388
|
-
condition:
|
|
389
|
-
children:
|
|
387
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core.Spacing, {}),
|
|
388
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
389
|
+
condition: _alloy_js_core.code`!options.config && !options.script`,
|
|
390
|
+
children: _alloy_js_core.code`writeLine(" ------------------------------------------------- ");
|
|
390
391
|
writeLine(completions);
|
|
391
392
|
writeLine(" ------------------------------------------------- ");`
|
|
392
393
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fish-command.d.cts","names":[],"sources":["../../src/components/fish-command.tsx"],"
|
|
1
|
+
{"version":3,"file":"fish-command.d.cts","names":[],"sources":["../../src/components/fish-command.tsx"],"mappings":";;;;;;iBA+CgB,sBAAA,CAAA,GAAsB,eAAA,CAAA,QAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
2
|
|
|
3
3
|
//#region src/components/fish-command.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* The Fish Completions commands' handler wrapper for the Shell Shock project.
|
|
6
6
|
*/
|
|
7
|
-
declare function FishCompletionsCommand():
|
|
7
|
+
declare function FishCompletionsCommand(): _alloy_js_core0.Children;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { FishCompletionsCommand };
|
|
10
10
|
//# sourceMappingURL=fish-command.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fish-command.d.mts","names":[],"sources":["../../src/components/fish-command.tsx"],"
|
|
1
|
+
{"version":3,"file":"fish-command.d.mts","names":[],"sources":["../../src/components/fish-command.tsx"],"mappings":";;;;;;iBA+CgB,sBAAA,CAAA,GAAsB,eAAA,CAAA,QAAA"}
|