powerlines 0.47.126 → 0.47.128
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/bin/bin.mjs +7 -7
- package/bin/build-BIaIu9Y5.mjs +1 -0
- package/bin/build.mjs +2 -5
- package/bin/changelog-E-js0BZb.mjs +1 -0
- package/bin/changelog.mjs +243 -246
- package/bin/clean-BiN7vXZE.mjs +1 -0
- package/bin/clean.mjs +2 -5
- package/bin/completions-bash-config.mjs +5 -7
- package/bin/completions-bash-script.mjs +5 -7
- package/bin/completions-fish-config.mjs +5 -7
- package/bin/completions-fish-script.mjs +5 -7
- package/bin/completions-powershell-config.mjs +5 -7
- package/bin/completions-powershell-script.mjs +5 -7
- package/bin/completions-zsh-config.mjs +5 -7
- package/bin/completions-zsh-script.mjs +5 -7
- package/bin/config-8bmAaNQ2.mjs +1 -0
- package/bin/config-BYunqLZD.mjs +1 -0
- package/bin/config-Dlyzcim5.mjs +1 -0
- package/bin/config-RZsaJtzu.mjs +1 -0
- package/bin/create-BoPKM4sQ.mjs +1 -0
- package/bin/create.mjs +3 -5
- package/bin/deploy-Dpv_gBUF.mjs +1 -0
- package/bin/deploy.mjs +2 -5
- package/bin/docs-B3Vy9nmT.mjs +1 -0
- package/bin/docs.mjs +2 -5
- package/bin/gc-yhl6Wc1U.mjs +1 -0
- package/bin/gc.mjs +3 -7
- package/bin/help.mjs +3 -5
- package/bin/lint-C82qnP4x.mjs +1 -0
- package/bin/lint.mjs +2 -5
- package/bin/prepare-x9Bix5FR.mjs +1 -0
- package/bin/prepare.mjs +2 -5
- package/bin/prompts-DEjU8qNL.mjs +26 -0
- package/bin/script-Bx-gKDHc.mjs +1 -0
- package/bin/script-CXB3vetH.mjs +1 -0
- package/bin/script-CYWDQkcZ.mjs +1 -0
- package/bin/script-l5WTGeVn.mjs +1 -0
- package/bin/{shared-D6Uc3liR.mjs → shared-C3VdzOJx.mjs} +5 -5
- package/bin/{shared-BiFPKQIb.mjs → shared-D6KGuDvi.mjs} +69 -69
- package/bin/{shared-CLQvIZ7z.mjs → shared-R0IeF6M6.mjs} +34 -34
- package/bin/{shared-ClfTGQiY.mjs → shared-rXffwFNh.mjs} +29 -29
- package/bin/types-BnaNJFgJ.mjs +1 -0
- package/bin/types.mjs +2 -5
- package/bin/update-275UZsT_.mjs +1 -0
- package/bin/update-DcBNIEnv.mjs +1 -0
- package/bin/update.mjs +2 -0
- package/bin/zsh-Bf6VX2tW.mjs +1 -0
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/package.json +8 -8
- package/bin/build-CJIAgNA5.mjs +0 -1
- package/bin/changelog-d-cmenYB.mjs +0 -1
- package/bin/clean-dutxbMO3.mjs +0 -1
- package/bin/config-B0hTZO6E.mjs +0 -1
- package/bin/config-BJFVoVkf.mjs +0 -1
- package/bin/config-BaNVYrnl.mjs +0 -1
- package/bin/config-Bf2LnULJ.mjs +0 -1
- package/bin/create-DYKxyvzg.mjs +0 -1
- package/bin/deploy-BMhOgvx4.mjs +0 -1
- package/bin/docs-CAUeTrLz.mjs +0 -1
- package/bin/gc-DZjHvUuc.mjs +0 -1
- package/bin/lint-DdDmoyDN.mjs +0 -1
- package/bin/prepare-Yz_6EWzB.mjs +0 -1
- package/bin/prompts-BnlPjHFR.mjs +0 -26
- package/bin/script-B97oHT_M.mjs +0 -1
- package/bin/script-Bn4yCHJR.mjs +0 -1
- package/bin/script-DGDOPq0P.mjs +0 -1
- package/bin/script-Di-8LIT0.mjs +0 -1
- package/bin/types-BhiTsmcq.mjs +0 -1
- package/bin/upgrade-aCJAI3aA.mjs +0 -1
- package/bin/upgrade-yP6Jdrm0.mjs +0 -1
- package/bin/upgrade.mjs +0 -5
- package/bin/zsh-Cve0Syog.mjs +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,
|
|
1
|
+
import{C as e,P as t,S as n,T as r,a as i,c as a,d as o,h as s,l as c,m as l,p as u,w as d}from"./prompts-DEjU8qNL.mjs";const f=`# Define shell completion directives
|
|
2
2
|
readonly ShellCompDirectiveError=1
|
|
3
3
|
readonly ShellCompDirectiveNoSpace=2
|
|
4
4
|
readonly ShellCompDirectiveNoFileComp=4
|
|
@@ -7,14 +7,14 @@ readonly ShellCompDirectiveFilterDirs=16
|
|
|
7
7
|
readonly ShellCompDirectiveKeepOrder=32
|
|
8
8
|
|
|
9
9
|
# Function to debug completion
|
|
10
|
-
|
|
10
|
+
__powerlines_debug() {
|
|
11
11
|
if [[ -n \${BASH_COMP_DEBUG_FILE:-} ]]; then
|
|
12
12
|
echo "$*" >> "\${BASH_COMP_DEBUG_FILE}"
|
|
13
13
|
fi
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
# Function to handle completions
|
|
17
|
-
|
|
17
|
+
__powerlines_complete() {
|
|
18
18
|
local cur prev words cword
|
|
19
19
|
_get_comp_words_by_ref -n "=:" cur prev words cword
|
|
20
20
|
|
|
@@ -97,7 +97,7 @@ COMPREPLY=( $(compgen -W "\${completions[*]}" -- "$cur") )
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
# Register completion function
|
|
100
|
-
complete -F
|
|
100
|
+
complete -F __powerlines_complete powerlines
|
|
101
101
|
`,p=f.split(`
|
|
102
|
-
`).map(f=>f.trim()?f.trim().startsWith(`#`)?`${
|
|
102
|
+
`).map(f=>f.trim()?f.trim().startsWith(`#`)?`${o(f)}`:t(f).replaceAll(/(?<=\$(\{|\()).*(?=(\}\)))/g,l(`$&`)).replaceAll(/\".*\"/g,a(`$&`)).replaceAll(/(\[|\]|\(|\)|\||<|>|\$\(|\$?\{|\}|\+|=|;|:)/g,i(u(`$&`))).replaceAll(/(readonly|complete)\s+/g,l(`$&`)).replaceAll(/(?<=(readonly|complete)\s+)\w/g,i(s(`$&`))).replaceAll(/local\s+/g,d(`$&`)).replaceAll(/(?<=local\s+)\w/g,i(r(`$&`))).replaceAll(/while\s+/g,a(`$&`)).replaceAll(/(?<=while\s+)\w/g,i(c(`$&`))).replaceAll(/(if|fi|else|elif|then|done)\s+/g,l(`$&`)).replaceAll(/__\w/g,i(e(`$&`))).replaceAll(/(?<=\s)(-\w|--\w[\w-]*)(?=\s|$)/g,i(n(`$&`))):``).join(`
|
|
103
103
|
`);export{p as n,f as t};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import{C as e,
|
|
1
|
+
import{C as e,P as t,S as n,T as r,a as i,c as a,d as o,h as s,l as c,m as l,p as u,w as d}from"./prompts-DEjU8qNL.mjs";const f=`function __powerlines_debug
|
|
2
2
|
set -l file "$BASH_COMP_DEBUG_FILE"
|
|
3
3
|
if test -n "$file"
|
|
4
4
|
echo "$argv" >> $file
|
|
5
5
|
end
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
function
|
|
9
|
-
|
|
8
|
+
function __powerlines_perform_completion
|
|
9
|
+
__powerlines_debug "Starting __powerlines_perform_completion"
|
|
10
10
|
|
|
11
11
|
# Extract all args except the last one
|
|
12
12
|
set -l args (commandline -opc)
|
|
13
13
|
# Extract the last arg and escape it in case it is a space or wildcard
|
|
14
14
|
set -l lastArg (string escape -- (commandline -ct))
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
__powerlines_debug "args: $args"
|
|
17
|
+
__powerlines_debug "last arg: $lastArg"
|
|
18
18
|
|
|
19
19
|
# Build the completion request command
|
|
20
20
|
set -l requestComp "/nix/store/8spcnffxayf4h9v8w075j01bxxgv5c8j-nodejs-slim-26.3.0/bin/node /home/runner/work/powerlines/powerlines/node_modules/.pnpm/nx@22.7.5_@swc-node+register@1.11.1_@swc+core@1.15.40_@swc+helpers@0.5.23__@swc+types@0_559e3db9ab82faa3b71ca2061041f3f6/node_modules/nx/dist/bin/run-executor.js complete -- (string join ' ' -- (string escape -- $args[2..-1])) $lastArg"
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
__powerlines_debug "Calling $requestComp"
|
|
23
23
|
set -l results (eval $requestComp 2> /dev/null)
|
|
24
24
|
|
|
25
25
|
# Some programs may output extra empty lines after the directive.
|
|
@@ -42,9 +42,9 @@ set -l directiveLine $results[-1]
|
|
|
42
42
|
# completions must be prefixed with the flag
|
|
43
43
|
set -l flagPrefix (string match -r -- '-.*=' "$lastArg")
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
__powerlines_debug "Comps: $comps"
|
|
46
|
+
__powerlines_debug "DirectiveLine: $directiveLine"
|
|
47
|
+
__powerlines_debug "flagPrefix: $flagPrefix"
|
|
48
48
|
|
|
49
49
|
for comp in $comps
|
|
50
50
|
printf "%s%s
|
|
@@ -55,83 +55,83 @@ printf "%s
|
|
|
55
55
|
" "$directiveLine"
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
# This function limits calls to
|
|
59
|
-
function
|
|
60
|
-
|
|
58
|
+
# This function limits calls to __powerlines_perform_completion, by caching the result
|
|
59
|
+
function __powerlines_perform_completion_once
|
|
60
|
+
__powerlines_debug "Starting __powerlines_perform_completion_once"
|
|
61
61
|
|
|
62
|
-
if test -n "$
|
|
63
|
-
|
|
62
|
+
if test -n "$__powerlines_perform_completion_once_result"
|
|
63
|
+
__powerlines_debug "Seems like a valid result already exists, skipping __powerlines_perform_completion"
|
|
64
64
|
return 0
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
set --global
|
|
68
|
-
if test -z "$
|
|
69
|
-
|
|
67
|
+
set --global __powerlines_perform_completion_once_result (__powerlines_perform_completion)
|
|
68
|
+
if test -z "$__powerlines_perform_completion_once_result"
|
|
69
|
+
__powerlines_debug "No completions, probably due to a failure"
|
|
70
70
|
return 1
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
__powerlines_debug "Performed completions and set __powerlines_perform_completion_once_result"
|
|
74
74
|
return 0
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
# This function is used to clear the cached result after completions are run
|
|
78
|
-
function
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
set --erase
|
|
82
|
-
|
|
78
|
+
function __powerlines_clear_perform_completion_once_result
|
|
79
|
+
__powerlines_debug ""
|
|
80
|
+
__powerlines_debug "========= clearing previously set __powerlines_perform_completion_once_result variable =========="
|
|
81
|
+
set --erase __powerlines_perform_completion_once_result
|
|
82
|
+
__powerlines_debug "Successfully erased the variable __powerlines_perform_completion_once_result"
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
-
function
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
function __powerlines_requires_order_preservation
|
|
86
|
+
__powerlines_debug ""
|
|
87
|
+
__powerlines_debug "========= checking if order preservation is required =========="
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
if test -z "$
|
|
91
|
-
|
|
89
|
+
__powerlines_perform_completion_once
|
|
90
|
+
if test -z "$__powerlines_perform_completion_once_result"
|
|
91
|
+
__powerlines_debug "Error determining if order preservation is required"
|
|
92
92
|
return 1
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
set -l directive (string sub --start 2 $
|
|
96
|
-
|
|
95
|
+
set -l directive (string sub --start 2 $__powerlines_perform_completion_once_result[-1])
|
|
96
|
+
__powerlines_debug "Directive is: $directive"
|
|
97
97
|
|
|
98
98
|
set -l shellCompDirectiveKeepOrder 32
|
|
99
99
|
set -l keeporder (math (math --scale 0 $directive / $shellCompDirectiveKeepOrder) % 2)
|
|
100
|
-
|
|
100
|
+
__powerlines_debug "Keeporder is: $keeporder"
|
|
101
101
|
|
|
102
102
|
if test $keeporder -ne 0
|
|
103
|
-
|
|
103
|
+
__powerlines_debug "This does require order preservation"
|
|
104
104
|
return 0
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
__powerlines_debug "This doesn't require order preservation"
|
|
108
108
|
return 1
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
# This function does two things:
|
|
112
|
-
# - Obtain the completions and store them in the global
|
|
112
|
+
# - Obtain the completions and store them in the global __powerlines_comp_results
|
|
113
113
|
# - Return false if file completion should be performed
|
|
114
|
-
function
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
function __powerlines_prepare_completions
|
|
115
|
+
__powerlines_debug ""
|
|
116
|
+
__powerlines_debug "========= starting completion logic =========="
|
|
117
117
|
|
|
118
118
|
# Start fresh
|
|
119
|
-
set --erase
|
|
119
|
+
set --erase __powerlines_comp_results
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
__powerlines_perform_completion_once
|
|
122
|
+
__powerlines_debug "Completion results: $__powerlines_perform_completion_once_result"
|
|
123
123
|
|
|
124
|
-
if test -z "$
|
|
125
|
-
|
|
124
|
+
if test -z "$__powerlines_perform_completion_once_result"
|
|
125
|
+
__powerlines_debug "No completion, probably due to a failure"
|
|
126
126
|
# Might as well do file completion, in case it helps
|
|
127
127
|
return 1
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
-
set -l directive (string sub --start 2 $
|
|
131
|
-
set --global
|
|
130
|
+
set -l directive (string sub --start 2 $__powerlines_perform_completion_once_result[-1])
|
|
131
|
+
set --global __powerlines_comp_results $__powerlines_perform_completion_once_result[1..-2]
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
__powerlines_debug "Completions are: $__powerlines_comp_results"
|
|
134
|
+
__powerlines_debug "Directive is: $directive"
|
|
135
135
|
|
|
136
136
|
set -l shellCompDirectiveError 1
|
|
137
137
|
set -l shellCompDirectiveNoSpace 2
|
|
@@ -144,7 +144,7 @@ end
|
|
|
144
144
|
|
|
145
145
|
set -l compErr (math (math --scale 0 $directive / $shellCompDirectiveError) % 2)
|
|
146
146
|
if test $compErr -eq 1
|
|
147
|
-
|
|
147
|
+
__powerlines_debug "Received error directive: aborting."
|
|
148
148
|
# Might as well do file completion, in case it helps
|
|
149
149
|
return 1
|
|
150
150
|
end
|
|
@@ -152,7 +152,7 @@ end
|
|
|
152
152
|
set -l filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) % 2)
|
|
153
153
|
set -l dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) % 2)
|
|
154
154
|
if test $filefilter -eq 1; or test $dirfilter -eq 1
|
|
155
|
-
|
|
155
|
+
__powerlines_debug "File extension filtering or directory filtering not supported"
|
|
156
156
|
# Do full file completion instead
|
|
157
157
|
return 1
|
|
158
158
|
end
|
|
@@ -160,7 +160,7 @@ end
|
|
|
160
160
|
set -l nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) % 2)
|
|
161
161
|
set -l nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) % 2)
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
__powerlines_debug "nospace: $nospace, nofiles: $nofiles"
|
|
164
164
|
|
|
165
165
|
# If we want to prevent a space, or if file completion is NOT disabled,
|
|
166
166
|
# we need to count the number of valid completions.
|
|
@@ -169,22 +169,22 @@ __cli_debug "nospace: $nospace, nofiles: $nofiles"
|
|
|
169
169
|
# criteria than the prefix.
|
|
170
170
|
if test $nospace -ne 0; or test $nofiles -eq 0
|
|
171
171
|
set -l prefix (commandline -t | string escape --style=regex)
|
|
172
|
-
|
|
172
|
+
__powerlines_debug "prefix: $prefix"
|
|
173
173
|
|
|
174
|
-
set -l completions (string match -r -- "^$prefix.*" $
|
|
175
|
-
set --global
|
|
176
|
-
|
|
174
|
+
set -l completions (string match -r -- "^$prefix.*" $__powerlines_comp_results)
|
|
175
|
+
set --global __powerlines_comp_results $completions
|
|
176
|
+
__powerlines_debug "Filtered completions are: $__powerlines_comp_results"
|
|
177
177
|
|
|
178
178
|
# Important not to quote the variable for count to work
|
|
179
|
-
set -l numComps (count $
|
|
180
|
-
|
|
179
|
+
set -l numComps (count $__powerlines_comp_results)
|
|
180
|
+
__powerlines_debug "numComps: $numComps"
|
|
181
181
|
|
|
182
182
|
if test $numComps -eq 1; and test $nospace -ne 0
|
|
183
183
|
# We must first split on to get rid of the descriptions to be
|
|
184
184
|
# able to check what the actual completion will be.
|
|
185
185
|
# We don't need descriptions anyway since there is only a single
|
|
186
186
|
# real completion which the shell will expand immediately.
|
|
187
|
-
set -l split (string split --max 1 " " $
|
|
187
|
+
set -l split (string split --max 1 " " $__powerlines_comp_results[1])
|
|
188
188
|
|
|
189
189
|
# Fish won't add a space if the completion ends with any
|
|
190
190
|
# of the following characters: @=/:.,
|
|
@@ -192,16 +192,16 @@ if test $nospace -ne 0; or test $nofiles -eq 0
|
|
|
192
192
|
if not string match -r -q "[@=/:.,]" -- "$lastChar"
|
|
193
193
|
# In other cases, to support the "nospace" directive we trick the shell
|
|
194
194
|
# by outputting an extra, longer completion.
|
|
195
|
-
|
|
196
|
-
set --global
|
|
197
|
-
|
|
195
|
+
__powerlines_debug "Adding second completion to perform nospace directive"
|
|
196
|
+
set --global __powerlines_comp_results $split[1] $split[1].
|
|
197
|
+
__powerlines_debug "Completions are now: $__powerlines_comp_results"
|
|
198
198
|
end
|
|
199
199
|
end
|
|
200
200
|
|
|
201
201
|
if test $numComps -eq 0; and test $nofiles -eq 0
|
|
202
202
|
# To be consistent with bash and zsh, we only trigger file
|
|
203
203
|
# completion when there are no other completions
|
|
204
|
-
|
|
204
|
+
__powerlines_debug "Requesting file completion"
|
|
205
205
|
return 1
|
|
206
206
|
end
|
|
207
207
|
end
|
|
@@ -213,23 +213,23 @@ end
|
|
|
213
213
|
# so we can properly delete any completions provided by another script.
|
|
214
214
|
# Only do this if the program can be found, or else fish may print some errors; besides,
|
|
215
215
|
# the existing completions will only be loaded if the program can be found.
|
|
216
|
-
if type -q "
|
|
216
|
+
if type -q "powerlines"
|
|
217
217
|
# The space after the program name is essential to trigger completion for the program
|
|
218
218
|
# and not completion of the program name itself.
|
|
219
219
|
# Also, we use '> /dev/null 2>&1' since '&>' is not supported in older versions of fish.
|
|
220
|
-
complete --do-complete "
|
|
220
|
+
complete --do-complete "powerlines " > /dev/null 2>&1
|
|
221
221
|
end
|
|
222
222
|
|
|
223
223
|
# Remove any pre-existing completions for the program since we will be handling all of them.
|
|
224
|
-
complete -c
|
|
224
|
+
complete -c powerlines -e
|
|
225
225
|
# This will get called after the two calls below and clear the cached result
|
|
226
|
-
complete -c
|
|
227
|
-
# The call to
|
|
226
|
+
complete -c powerlines -n '__powerlines_clear_perform_completion_once_result'
|
|
227
|
+
# The call to __powerlines_prepare_completions will setup __powerlines_comp_results
|
|
228
228
|
# which provides the program's completion choices.
|
|
229
229
|
# If this doesn't require order preservation, we don't use the -k flag
|
|
230
|
-
complete -c
|
|
230
|
+
complete -c powerlines -n 'not __powerlines_requires_order_preservation && __powerlines_prepare_completions' -f -a '$__powerlines_comp_results'
|
|
231
231
|
# Otherwise we use the -k flag
|
|
232
|
-
complete -k -c
|
|
232
|
+
complete -k -c powerlines -n '__powerlines_requires_order_preservation && __powerlines_prepare_completions' -f -a '$__powerlines_comp_results'
|
|
233
233
|
`,p=f.split(`
|
|
234
|
-
`).map(f=>f.trim()?f.trim().startsWith(`#`)?`${
|
|
234
|
+
`).map(f=>f.trim()?f.trim().startsWith(`#`)?`${o(f)}`:t(f).replaceAll(/(?<=\$(\{|\()).*(?=(\}\)))/g,l(`$&`)).replaceAll(/(\"|\').*(\"|\')/g,a(`$&`)).replaceAll(/(\[|\]|\(|\)|\||<|>|\$\(|\$?\{|\}|\+|=|;|:)/g,i(u(`$&`))).replaceAll(/(function|complete)\s+/g,l(`$&`)).replaceAll(/(?<=(function|complete)\s+)\w/g,i(s(`$&`))).replaceAll(/set\s+/g,d(`$&`)).replaceAll(/(?<=set\s+)\w/g,i(r(`$&`))).replaceAll(/while\s+/g,a(`$&`)).replaceAll(/(?<=while\s+)\w/g,i(c(`$&`))).replaceAll(/(if|fi|else|elif|then|done)\s+/g,l(`$&`)).replaceAll(/\s__\w/g,i(e(`$&`))).replaceAll(/(?<=\s)(-\w|--\w[\w-]*)(?=\s|$)/g,i(n(`$&`))):``).join(`
|
|
235
235
|
`);export{p as n,f as t};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{C as e,
|
|
1
|
+
import{C as e,P as t,S as n,T as r,a as i,c as a,d as o,h as s,l as c,m as l,p as u,w as d}from"./prompts-DEjU8qNL.mjs";const f=`__powerlines_debug() {
|
|
2
2
|
local file="$BASH_COMP_DEBUG_FILE"
|
|
3
3
|
if [[ -n \${file} ]]; then
|
|
4
4
|
echo "$*" >> "\${file}"
|
|
5
5
|
fi
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
_powerlines() {
|
|
9
9
|
local shellCompDirectiveError=1
|
|
10
10
|
local shellCompDirectiveNoSpace=2
|
|
11
11
|
local shellCompDirectiveNoFileComp=4
|
|
@@ -16,21 +16,21 @@ local shellCompDirectiveKeepOrder=32
|
|
|
16
16
|
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
|
|
17
17
|
local -a completions
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
__powerlines_debug "
|
|
20
20
|
========= starting completion logic =========="
|
|
21
|
-
|
|
21
|
+
__powerlines_debug "CURRENT: \${CURRENT}, words[*]: \${words[*]}"
|
|
22
22
|
|
|
23
23
|
# The user could have moved the cursor backwards on the command-line.
|
|
24
24
|
# We need to trigger completion from the $CURRENT location, so we need
|
|
25
25
|
# to truncate the command-line ($words) up to the $CURRENT location.
|
|
26
26
|
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
|
27
27
|
words=( "\${=words[1,CURRENT]}" )
|
|
28
|
-
|
|
28
|
+
__powerlines_debug "Truncated words[*]: \${words[*]},"
|
|
29
29
|
|
|
30
30
|
lastParam=\${words[-1]}
|
|
31
31
|
lastChar=\${lastParam[-1]}
|
|
32
|
-
|
|
33
|
-
# For zsh, when completing a flag with an = (e.g.,
|
|
32
|
+
__powerlines_debug "lastParam: \${lastParam}, lastChar: \${lastChar}"
|
|
33
|
+
# For zsh, when completing a flag with an = (e.g., powerlines -n=<TAB>)
|
|
34
34
|
# completions must be prefixed with the flag
|
|
35
35
|
setopt local_options BASH_REMATCH
|
|
36
36
|
if [[ "\${lastParam}" =~ '-.*=' ]]; then
|
|
@@ -43,7 +43,7 @@ local -a args_to_quote=("\${(@)words[2,-1]}")
|
|
|
43
43
|
if [ "\${lastChar}" = "" ]; then
|
|
44
44
|
# If the last parameter is complete (there is a space following it)
|
|
45
45
|
# We add an extra empty parameter so we can indicate this to the go completion code.
|
|
46
|
-
|
|
46
|
+
__powerlines_debug "Adding extra empty parameter"
|
|
47
47
|
args_to_quote+=("")
|
|
48
48
|
fi
|
|
49
49
|
|
|
@@ -53,11 +53,11 @@ local quoted_args=("\${(@q)args_to_quote}")
|
|
|
53
53
|
# Join the main command and the quoted arguments into a single string for eval
|
|
54
54
|
requestComp="/nix/store/8spcnffxayf4h9v8w075j01bxxgv5c8j-nodejs-slim-26.3.0/bin/node /home/runner/work/powerlines/powerlines/node_modules/.pnpm/nx@22.7.5_@swc-node+register@1.11.1_@swc+core@1.15.40_@swc+helpers@0.5.23__@swc+types@0_559e3db9ab82faa3b71ca2061041f3f6/node_modules/nx/dist/bin/run-executor.js complete -- \${quoted_args[*]}"
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
__powerlines_debug "About to call: eval \${requestComp}"
|
|
57
57
|
|
|
58
58
|
# Use eval to handle any environment variables and such
|
|
59
59
|
out=$(eval \${requestComp} 2>/dev/null)
|
|
60
|
-
|
|
60
|
+
__powerlines_debug "completion output: \${out}"
|
|
61
61
|
|
|
62
62
|
# Extract the directive integer following a : from the last line
|
|
63
63
|
local lastLine
|
|
@@ -66,7 +66,7 @@ while IFS='
|
|
|
66
66
|
lastLine=\${line}
|
|
67
67
|
done < <(printf "%s
|
|
68
68
|
" "\${out[@]}")
|
|
69
|
-
|
|
69
|
+
__powerlines_debug "last line: \${lastLine}"
|
|
70
70
|
|
|
71
71
|
if [ "\${lastLine[1]}" = : ]; then
|
|
72
72
|
directive=\${lastLine[2,-1]}
|
|
@@ -76,16 +76,16 @@ if [ "\${lastLine[1]}" = : ]; then
|
|
|
76
76
|
out=\${out[1,-$suffix]}
|
|
77
77
|
else
|
|
78
78
|
# There is no directive specified. Leave $out as is.
|
|
79
|
-
|
|
79
|
+
__powerlines_debug "No directive found. Setting to default"
|
|
80
80
|
directive=0
|
|
81
81
|
fi
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
__powerlines_debug "directive: \${directive}"
|
|
84
|
+
__powerlines_debug "completions: \${out}"
|
|
85
|
+
__powerlines_debug "flagPrefix: \${flagPrefix}"
|
|
86
86
|
|
|
87
87
|
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
|
88
|
-
|
|
88
|
+
__powerlines_debug "Completion received error. Ignoring completions."
|
|
89
89
|
return
|
|
90
90
|
fi
|
|
91
91
|
|
|
@@ -97,11 +97,11 @@ while IFS='
|
|
|
97
97
|
' read -r comp; do
|
|
98
98
|
# Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
|
|
99
99
|
if [ "\${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
|
|
100
|
-
|
|
100
|
+
__powerlines_debug "ActiveHelp found: $comp"
|
|
101
101
|
comp="\${comp[$startIndex,-1]}"
|
|
102
102
|
if [ -n "$comp" ]; then
|
|
103
103
|
compadd -x "\${comp}"
|
|
104
|
-
|
|
104
|
+
__powerlines_debug "ActiveHelp will need delimiter"
|
|
105
105
|
hasActiveHelp=1
|
|
106
106
|
fi
|
|
107
107
|
continue
|
|
@@ -117,7 +117,7 @@ if [ -n "$comp" ]; then
|
|
|
117
117
|
local tab="$(printf ' ')"
|
|
118
118
|
comp=\${comp//$tab/:}
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
__powerlines_debug "Adding completion: \${comp}"
|
|
121
121
|
completions+=\${comp}
|
|
122
122
|
lastComp=$comp
|
|
123
123
|
fi
|
|
@@ -129,19 +129,19 @@ done < <(printf "%s
|
|
|
129
129
|
# - file completion will be performed (so there will be choices after the activeHelp)
|
|
130
130
|
if [ $hasActiveHelp -eq 1 ]; then
|
|
131
131
|
if [ \${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
|
|
132
|
-
|
|
132
|
+
__powerlines_debug "Adding activeHelp delimiter"
|
|
133
133
|
compadd -x "--"
|
|
134
134
|
hasActiveHelp=0
|
|
135
135
|
fi
|
|
136
136
|
fi
|
|
137
137
|
|
|
138
138
|
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
|
139
|
-
|
|
139
|
+
__powerlines_debug "Activating nospace."
|
|
140
140
|
noSpace="-S ''"
|
|
141
141
|
fi
|
|
142
142
|
|
|
143
143
|
if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
|
|
144
|
-
|
|
144
|
+
__powerlines_debug "Activating keep order."
|
|
145
145
|
keepOrder="-V"
|
|
146
146
|
fi
|
|
147
147
|
|
|
@@ -158,17 +158,17 @@ if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
|
|
158
158
|
done
|
|
159
159
|
filteringCmd+=" \${flagPrefix}"
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
__powerlines_debug "File filtering command: $filteringCmd"
|
|
162
162
|
_arguments '*:filename:'"$filteringCmd"
|
|
163
163
|
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
|
164
164
|
# File completion for directories only
|
|
165
165
|
local subdir
|
|
166
166
|
subdir="\${completions[1]}"
|
|
167
167
|
if [ -n "$subdir" ]; then
|
|
168
|
-
|
|
168
|
+
__powerlines_debug "Listing directories in $subdir"
|
|
169
169
|
pushd "\${subdir}" >/dev/null 2>&1
|
|
170
170
|
else
|
|
171
|
-
|
|
171
|
+
__powerlines_debug "Listing directories in ."
|
|
172
172
|
fi
|
|
173
173
|
|
|
174
174
|
local result
|
|
@@ -179,17 +179,17 @@ elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
|
|
179
179
|
fi
|
|
180
180
|
return $result
|
|
181
181
|
else
|
|
182
|
-
|
|
182
|
+
__powerlines_debug "Calling _describe"
|
|
183
183
|
if eval _describe $keepOrder "completions" completions -Q \${flagPrefix} \${noSpace}; then
|
|
184
|
-
|
|
184
|
+
__powerlines_debug "_describe found some completions"
|
|
185
185
|
|
|
186
186
|
# Return the success of having called _describe
|
|
187
187
|
return 0
|
|
188
188
|
else
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
__powerlines_debug "_describe did not find completions."
|
|
190
|
+
__powerlines_debug "Checking if we should do file completion."
|
|
191
191
|
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
|
192
|
-
|
|
192
|
+
__powerlines_debug "deactivating file completion"
|
|
193
193
|
|
|
194
194
|
# Return 0 to indicate completion is finished and prevent zsh from
|
|
195
195
|
# trying other completion algorithms (which could cause hanging).
|
|
@@ -197,7 +197,7 @@ else
|
|
|
197
197
|
return 0
|
|
198
198
|
else
|
|
199
199
|
# Perform file completion
|
|
200
|
-
|
|
200
|
+
__powerlines_debug "Activating file completion"
|
|
201
201
|
|
|
202
202
|
# We must return the result of this command, so it must be the
|
|
203
203
|
# last command, or else we must store its result to return it.
|
|
@@ -208,9 +208,9 @@ fi
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
# don't run the completion function when being sourced or eval-ed
|
|
211
|
-
if [ "\${funcstack[1]}" = "
|
|
212
|
-
|
|
211
|
+
if [ "\${funcstack[1]}" = "_powerlines" ]; then
|
|
212
|
+
_powerlines
|
|
213
213
|
fi
|
|
214
214
|
`,p=f.split(`
|
|
215
|
-
`).map(f=>f.trim()?f.trim().startsWith(`#`)?`${
|
|
215
|
+
`).map(f=>f.trim()?f.trim().startsWith(`#`)?`${o(f)}`:t(f).replaceAll(/(?<=\$(\{|\()).*(?=(\}\)))/g,l(`$&`)).replaceAll(/\".*\"/g,a(`$&`)).replaceAll(/(\[|\]|\(|\)|\||<|>|\$\(|\$?\{|\}|\+|=|;|:)/g,i(u(`$&`))).replaceAll(/(readonly|complete)\s+/g,l(`$&`)).replaceAll(/(?<=(readonly|complete)\s+)\w/g,i(s(`$&`))).replaceAll(/local\s+/g,d(`$&`)).replaceAll(/(?<=local\s+)\w/g,i(r(`$&`))).replaceAll(/(for|while)\s+/g,a(`$&`)).replaceAll(/(?<=for|while\s+)\w/g,i(c(`$&`))).replaceAll(/(return|if|fi|else|elif|then|done)\s+/g,l(`$&`)).replaceAll(/__\w/g,i(e(`$&`))).replaceAll(/(?<=\s)(-\w|--\w[\w-]*)(?=\s|$)/g,i(n(`$&`))):``).join(`
|
|
216
216
|
`);export{p as n,f as t};
|