powerlines 0.47.126 → 0.47.127
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-DB7Qg8JL.mjs +1 -0
- package/bin/build.mjs +1 -1
- package/bin/changelog-BvwdAR9P.mjs +1 -0
- package/bin/changelog.mjs +2 -2
- package/bin/clean-BvoWipQk.mjs +1 -0
- package/bin/clean.mjs +1 -1
- package/bin/completions-bash-config.mjs +4 -4
- package/bin/completions-bash-script.mjs +3 -3
- package/bin/completions-fish-config.mjs +4 -4
- package/bin/completions-fish-script.mjs +3 -3
- package/bin/completions-powershell-config.mjs +3 -3
- package/bin/completions-powershell-script.mjs +2 -2
- package/bin/completions-zsh-config.mjs +3 -3
- package/bin/completions-zsh-script.mjs +2 -2
- package/bin/config-CBOLGGRN.mjs +1 -0
- package/bin/config-Cgy-77bf.mjs +1 -0
- package/bin/config-DN4qOrRO.mjs +1 -0
- package/bin/config-DrW3et5b.mjs +1 -0
- package/bin/create-T3P6LNng.mjs +1 -0
- package/bin/create.mjs +1 -1
- package/bin/deploy-DRvDq2cP.mjs +1 -0
- package/bin/deploy.mjs +1 -1
- package/bin/docs-M1aA2x15.mjs +1 -0
- package/bin/docs.mjs +1 -1
- package/bin/gc-CdHVi7oK.mjs +1 -0
- package/bin/gc.mjs +1 -1
- package/bin/help.mjs +2 -2
- package/bin/lint-Nf5sAXLr.mjs +1 -0
- package/bin/lint.mjs +1 -1
- package/bin/prepare-DzdEY2vL.mjs +1 -0
- package/bin/prepare.mjs +3 -3
- package/bin/{prompts-BnlPjHFR.mjs → prompts-Rsqng44G.mjs} +2 -2
- package/bin/script-BH-9NBWs.mjs +1 -0
- package/bin/script-CA2uVVUu.mjs +1 -0
- package/bin/script-DTC5wHER.mjs +1 -0
- package/bin/script-DhtPxvAu.mjs +1 -0
- package/bin/{shared-D6Uc3liR.mjs → shared-BUzfvq3v.mjs} +4 -4
- package/bin/{shared-BiFPKQIb.mjs → shared-BsePrzLP.mjs} +68 -68
- package/bin/{shared-ClfTGQiY.mjs → shared-CJXquqHR.mjs} +28 -28
- package/bin/{shared-CLQvIZ7z.mjs → shared-CgiVDHJI.mjs} +33 -33
- package/bin/types-Dn7zaJcB.mjs +1 -0
- package/bin/types.mjs +3 -3
- package/bin/upgrade-BZwwh4wZ.mjs +1 -0
- package/bin/{upgrade-yP6Jdrm0.mjs → upgrade-CbOYYUL8.mjs} +1 -1
- package/bin/upgrade.mjs +2 -2
- package/bin/zsh-R9CKPSsN.mjs +3 -0
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/package.json +7 -7
- 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/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/zsh-Cve0Syog.mjs +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{M as e,O as t,a as n}from"./prompts-Rsqng44G.mjs";function r(){e(``),e(n(t.heading.secondary(`Usage:`))),e(t.body.secondary(`${t.usage.bin(`$_ powerlines`)} ${t.usage.command(`completions`)} ${t.usage.command(`fish`)} ${t.usage.command(`script`)} ${t.usage.options(`[options]`)}`),{padding:0}),e(``)}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{M as e,O as t,a as n}from"./prompts-Rsqng44G.mjs";function r(){e(``),e(n(t.heading.secondary(`Usage:`))),e(t.body.secondary(`${t.usage.bin(`$_ powerlines`)} ${t.usage.command(`completions`)} ${t.usage.command(`bash`)} ${t.usage.command(`script`)} ${t.usage.options(`[options]`)}`),{padding:0}),e(``)}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{M as e,O as t,a as n}from"./prompts-Rsqng44G.mjs";function r(){e(``),e(n(t.heading.secondary(`Usage:`))),e(t.body.secondary(`${t.usage.bin(`$_ powerlines`)} ${t.usage.command(`completions`)} ${t.usage.command(`powershell`)} ${t.usage.command(`script`)} ${t.usage.options(`[options]`)}`),{padding:0}),e(``)}export{r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{M as e,O as t,a as n}from"./prompts-Rsqng44G.mjs";function r(){e(``),e(n(t.heading.secondary(`Usage:`))),e(t.body.secondary(`${t.usage.bin(`$_ powerlines`)} ${t.usage.command(`completions`)} ${t.usage.command(`zsh`)} ${t.usage.command(`script`)} ${t.usage.options(`[options]`)}`),{padding:0}),e(``)}export{r as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,S as t,a as n,b as r,c as i,d as a,h as o,j as s,l as c,m as l,p as u,x as d}from"./prompts-
|
|
1
|
+
import{C as e,S as t,a as n,b as r,c as i,d as a,h as o,j as s,l as c,m as l,p as u,x as d}from"./prompts-Rsqng44G.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
102
|
`).map(f=>f.trim()?f.trim().startsWith(`#`)?`${a(f)}`:s(f).replaceAll(/(?<=\$(\{|\()).*(?=(\}\)))/g,l(`$&`)).replaceAll(/\".*\"/g,i(`$&`)).replaceAll(/(\[|\]|\(|\)|\||<|>|\$\(|\$?\{|\}|\+|=|;|:)/g,n(u(`$&`))).replaceAll(/(readonly|complete)\s+/g,l(`$&`)).replaceAll(/(?<=(readonly|complete)\s+)\w/g,n(o(`$&`))).replaceAll(/local\s+/g,t(`$&`)).replaceAll(/(?<=local\s+)\w/g,n(e(`$&`))).replaceAll(/while\s+/g,i(`$&`)).replaceAll(/(?<=while\s+)\w/g,n(c(`$&`))).replaceAll(/(if|fi|else|elif|then|done)\s+/g,l(`$&`)).replaceAll(/__\w/g,n(d(`$&`))).replaceAll(/(?<=\s)(-\w|--\w[\w-]*)(?=\s|$)/g,n(r(`$&`))):``).join(`
|
|
103
103
|
`);export{p as n,f as t};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import{C as e,S as t,a as n,b as r,c as i,d as a,h as o,j as s,l as c,m as l,p as u,x as d}from"./prompts-
|
|
1
|
+
import{C as e,S as t,a as n,b as r,c as i,d as a,h as o,j as s,l as c,m as l,p as u,x as d}from"./prompts-Rsqng44G.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
234
|
`).map(f=>f.trim()?f.trim().startsWith(`#`)?`${a(f)}`:s(f).replaceAll(/(?<=\$(\{|\()).*(?=(\}\)))/g,l(`$&`)).replaceAll(/(\"|\').*(\"|\')/g,i(`$&`)).replaceAll(/(\[|\]|\(|\)|\||<|>|\$\(|\$?\{|\}|\+|=|;|:)/g,n(u(`$&`))).replaceAll(/(function|complete)\s+/g,l(`$&`)).replaceAll(/(?<=(function|complete)\s+)\w/g,n(o(`$&`))).replaceAll(/set\s+/g,t(`$&`)).replaceAll(/(?<=set\s+)\w/g,n(e(`$&`))).replaceAll(/while\s+/g,i(`$&`)).replaceAll(/(?<=while\s+)\w/g,n(c(`$&`))).replaceAll(/(if|fi|else|elif|then|done)\s+/g,l(`$&`)).replaceAll(/\s__\w/g,n(d(`$&`))).replaceAll(/(?<=\s)(-\w|--\w[\w-]*)(?=\s|$)/g,n(r(`$&`))):``).join(`
|
|
235
235
|
`);export{p as n,f as t};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import{C as e,S as t,a as n,b as r,c as i,d as a,h as o,j as s,l as c,m as l,p as u,x as d}from"./prompts-
|
|
1
|
+
import{C as e,S as t,a as n,b as r,c as i,d as a,h as o,j as s,l as c,m as l,p as u,x as d}from"./prompts-Rsqng44G.mjs";const f=`# powershell completion for Powerlines
|
|
2
2
|
|
|
3
3
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
4
|
-
function
|
|
4
|
+
function __powerlines_debug {
|
|
5
5
|
if ($env:BASH_COMP_DEBUG_FILE) {
|
|
6
6
|
"$args" | Out-File -Append -FilePath "$env:BASH_COMP_DEBUG_FILE"
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
filter
|
|
10
|
+
filter __powerlines_escapeStringWithSpecialChars {
|
|
11
11
|
$_ -replace 's|#|@|$|;|,|''|{|}|(|)|"|||<|>|&','\`$&'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
[scriptblock]$
|
|
14
|
+
[scriptblock]$__powerlinesCompleterBlock = {
|
|
15
15
|
param(
|
|
16
16
|
$WordToComplete,
|
|
17
17
|
$CommandAst,
|
|
@@ -22,9 +22,9 @@ param(
|
|
|
22
22
|
$Command = $CommandAst.CommandElements
|
|
23
23
|
$Command = "$Command"
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
__powerlines_debug ""
|
|
26
|
+
__powerlines_debug "========= starting completion logic =========="
|
|
27
|
+
__powerlines_debug "WordToComplete: $WordToComplete Command: $Command CursorPosition: $CursorPosition"
|
|
28
28
|
|
|
29
29
|
# The user could have moved the cursor backwards on the command-line.
|
|
30
30
|
# We need to trigger completion from the $CursorPosition location, so we need
|
|
@@ -34,7 +34,7 @@ __cli_debug "WordToComplete: $WordToComplete Command: $Command CursorPosition: $
|
|
|
34
34
|
if ($Command.Length -gt $CursorPosition) {
|
|
35
35
|
$Command = $Command.Substring(0, $CursorPosition)
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
__powerlines_debug "Truncated command: $Command"
|
|
38
38
|
|
|
39
39
|
$ShellCompDirectiveError=1
|
|
40
40
|
$ShellCompDirectiveNoSpace=2
|
|
@@ -48,10 +48,10 @@ $ShellCompDirectiveKeepOrder=32
|
|
|
48
48
|
$Program, $Arguments = $Command.Split(" ", 2)
|
|
49
49
|
|
|
50
50
|
$QuotedArgs = ($Arguments -split ' ' | ForEach-Object { "'" + ($_ -replace "'", "''") + "'" }) -join ' '
|
|
51
|
-
|
|
51
|
+
__powerlines_debug "QuotedArgs: $QuotedArgs"
|
|
52
52
|
|
|
53
53
|
$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 '--' $QuotedArgs"
|
|
54
|
-
|
|
54
|
+
__powerlines_debug "RequestComp: $RequestComp"
|
|
55
55
|
|
|
56
56
|
# we cannot use $WordToComplete because it
|
|
57
57
|
# has the wrong values if the cursor was moved
|
|
@@ -59,13 +59,13 @@ __cli_debug "RequestComp: $RequestComp"
|
|
|
59
59
|
if ($WordToComplete -ne "" ) {
|
|
60
60
|
$WordToComplete = $Arguments.Split(" ")[-1]
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
__powerlines_debug "New WordToComplete: $WordToComplete"
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
# Check for flag with equal sign
|
|
66
66
|
$IsEqualFlag = ($WordToComplete -Like "--*=*" )
|
|
67
67
|
if ( $IsEqualFlag ) {
|
|
68
|
-
|
|
68
|
+
__powerlines_debug "Completing equal sign flag"
|
|
69
69
|
# Remove the flag part
|
|
70
70
|
$Flag, $WordToComplete = $WordToComplete.Split("=", 2)
|
|
71
71
|
}
|
|
@@ -73,7 +73,7 @@ if ( $IsEqualFlag ) {
|
|
|
73
73
|
if ( $WordToComplete -eq "" -And ( -Not $IsEqualFlag )) {
|
|
74
74
|
# If the last parameter is complete (there is a space following it)
|
|
75
75
|
# We add an extra empty parameter so we can indicate this to the go method.
|
|
76
|
-
|
|
76
|
+
__powerlines_debug "Adding extra empty parameter"
|
|
77
77
|
# PowerShell 7.2+ changed the way how the arguments are passed to executables,
|
|
78
78
|
# so for pre-7.2 or when Legacy argument passing is enabled we need to use
|
|
79
79
|
if ($PSVersionTable.PsVersion -lt [version]'7.2.0' -or
|
|
@@ -86,7 +86,7 @@ if ( $WordToComplete -eq "" -And ( -Not $IsEqualFlag )) {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
__powerlines_debug "Calling $RequestComp"
|
|
90
90
|
# First disable ActiveHelp which is not supported for Powershell
|
|
91
91
|
$env:ActiveHelp = 0
|
|
92
92
|
|
|
@@ -100,14 +100,14 @@ if ($Directive -eq "") {
|
|
|
100
100
|
# There is no directive specified
|
|
101
101
|
$Directive = 0
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
__powerlines_debug "The completion directive is: $Directive"
|
|
104
104
|
|
|
105
105
|
# remove directive (last element) from out
|
|
106
106
|
$Out = $Out | Where-Object { $_ -ne $Out[-1] }
|
|
107
|
-
|
|
107
|
+
__powerlines_debug "The completions are: $Out"
|
|
108
108
|
if (($Directive -band $ShellCompDirectiveError) -ne 0 ) {
|
|
109
109
|
# Error code. No completion.
|
|
110
|
-
|
|
110
|
+
__powerlines_debug "Received error from custom completion go code"
|
|
111
111
|
return
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -115,7 +115,7 @@ $Longest = 0
|
|
|
115
115
|
[Array]$Values = $Out | ForEach-Object {
|
|
116
116
|
# Split the output in name and description
|
|
117
117
|
$Name, $Description = $_.Split("\`t", 2)
|
|
118
|
-
|
|
118
|
+
__powerlines_debug "Name: $Name Description: $Description"
|
|
119
119
|
|
|
120
120
|
# Look for the longest completion so that we can format things nicely
|
|
121
121
|
if ($Longest -lt $Name.Length) {
|
|
@@ -134,13 +134,13 @@ $Longest = 0
|
|
|
134
134
|
$Space = " "
|
|
135
135
|
if (($Directive -band $ShellCompDirectiveNoSpace) -ne 0 ) {
|
|
136
136
|
# remove the space here
|
|
137
|
-
|
|
137
|
+
__powerlines_debug "ShellCompDirectiveNoSpace is called"
|
|
138
138
|
$Space = ""
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
if ((($Directive -band $ShellCompDirectiveFilterFileExt) -ne 0 ) -or
|
|
142
142
|
(($Directive -band $ShellCompDirectiveFilterDirs) -ne 0 )) {
|
|
143
|
-
|
|
143
|
+
__powerlines_debug "ShellCompDirectiveFilterFileExt ShellCompDirectiveFilterDirs are not supported"
|
|
144
144
|
|
|
145
145
|
# return here to prevent the completion of the extensions
|
|
146
146
|
return
|
|
@@ -152,7 +152,7 @@ $Values = $Values | Where-Object {
|
|
|
152
152
|
|
|
153
153
|
# Join the flag back if we have an equal sign flag
|
|
154
154
|
if ( $IsEqualFlag ) {
|
|
155
|
-
|
|
155
|
+
__powerlines_debug "Join the equal sign flag back to the completion value"
|
|
156
156
|
$_.Name = $Flag + "=" + $_.Name
|
|
157
157
|
}
|
|
158
158
|
}
|
|
@@ -163,7 +163,7 @@ if (($Directive -band $ShellCompDirectiveKeepOrder) -eq 0 ) {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {
|
|
166
|
-
|
|
166
|
+
__powerlines_debug "ShellCompDirectiveNoFileComp is called"
|
|
167
167
|
|
|
168
168
|
if ($Values.Length -eq 0) {
|
|
169
169
|
# Just print an empty string here so the
|
|
@@ -177,7 +177,7 @@ if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {
|
|
|
177
177
|
|
|
178
178
|
# Get the current mode
|
|
179
179
|
$Mode = (Get-PSReadLineKeyHandler | Where-Object { $_.Key -eq "Tab" }).Function
|
|
180
|
-
|
|
180
|
+
__powerlines_debug "Mode: $Mode"
|
|
181
181
|
|
|
182
182
|
$Values | ForEach-Object {
|
|
183
183
|
|
|
@@ -202,10 +202,10 @@ $Values | ForEach-Object {
|
|
|
202
202
|
"Complete" {
|
|
203
203
|
|
|
204
204
|
if ($Values.Length -eq 1) {
|
|
205
|
-
|
|
205
|
+
__powerlines_debug "Only one completion left"
|
|
206
206
|
|
|
207
207
|
# insert space after value
|
|
208
|
-
[System.Management.Automation.CompletionResult]::new($($comp.Name |
|
|
208
|
+
[System.Management.Automation.CompletionResult]::new($($comp.Name | __powerlines_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
|
|
209
209
|
|
|
210
210
|
} else {
|
|
211
211
|
# Add the proper number of spaces to align the descriptions
|
|
@@ -229,7 +229,7 @@ $Values | ForEach-Object {
|
|
|
229
229
|
# insert space after value
|
|
230
230
|
# MenuComplete will automatically show the ToolTip of
|
|
231
231
|
# the highlighted value at the bottom of the suggestions.
|
|
232
|
-
[System.Management.Automation.CompletionResult]::new($($comp.Name |
|
|
232
|
+
[System.Management.Automation.CompletionResult]::new($($comp.Name | __powerlines_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
# TabCompleteNext and in case we get something unknown
|
|
@@ -237,13 +237,13 @@ $Values | ForEach-Object {
|
|
|
237
237
|
# Like MenuComplete but we don't want to add a space here because
|
|
238
238
|
# the user need to press space anyway to get the completion.
|
|
239
239
|
# Description will not be shown because that's not possible with TabCompleteNext
|
|
240
|
-
[System.Management.Automation.CompletionResult]::new($($comp.Name |
|
|
240
|
+
[System.Management.Automation.CompletionResult]::new($($comp.Name | __powerlines_escapeStringWithSpecialChars), "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
Register-ArgumentCompleter -CommandName '
|
|
246
|
+
Register-ArgumentCompleter -CommandName 'powerlines' -ScriptBlock $__powerlinesCompleterBlock
|
|
247
247
|
`,p=f.split(`
|
|
248
248
|
`).map(f=>f.trim()?f.trim().startsWith(`#`)?`${a(f)}`:s(f).replaceAll(/(?<=\$(\{|\()).*(?=(\}\)))/g,l(`$&`)).replaceAll(/\".*\"/g,i(`$&`)).replaceAll(/(\[|\]|\(|\)|\||<|>|\$\(|\$?\{|\}|\+|=|;|::new|::OutputEncoding|::UTF8)/g,n(u(`$&`))).replaceAll(/(switch|complete)\s+/g,l(`$&`)).replaceAll(/(?<=(switch|complete)\s+)\w/g,n(o(`$&`))).replaceAll(/(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\w+)\s+/g,t(`$&`)).replaceAll(/(?<=(Get-PSReadLineKeyHandler|Where-Object|ExperimentalFeature|Console|ScriptBlock|Array|ForEach-Object|Register-ArgumentCompleter|System.Management.Automation.CompletionResult|$\w+)\s+)\w/g,n(e(`$&`))).replaceAll(/while\s+/g,i(`$&`)).replaceAll(/(?<=while\s+)\w/g,n(c(`$&`))).replaceAll(/(if|fi|else|elif|then|done)\s+/g,l(`$&`)).replaceAll(/\$?__\w/g,n(d(`$&`))).replaceAll(/(?<=\s)(-\w|--\w[\w-]*)(?=\s|$)/g,n(r(`$&`))):``).join(`
|
|
249
249
|
`);export{p as n,f as t};
|