powerlines 0.47.144 → 0.47.145
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/config.mjs +0 -2
- package/dist/index.mjs +0 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/plugin-utils.mjs +0 -2
- package/dist/storage.mjs +0 -2
- package/package.json +13 -13
- package/bin/bin.mjs +0 -8
- package/bin/build-DjyA6GQp.mjs +0 -1
- package/bin/build.mjs +0 -2
- package/bin/changelog-B8i9yY3P.mjs +0 -1
- package/bin/changelog.mjs +0 -524
- package/bin/clean-B9CJqZ1x.mjs +0 -1
- package/bin/clean.mjs +0 -2
- package/bin/completions-bash-config.mjs +0 -7
- package/bin/completions-bash-script.mjs +0 -7
- package/bin/completions-fish-config.mjs +0 -7
- package/bin/completions-fish-script.mjs +0 -7
- package/bin/completions-powershell-config.mjs +0 -7
- package/bin/completions-powershell-script.mjs +0 -7
- package/bin/completions-zsh-config.mjs +0 -7
- package/bin/completions-zsh-script.mjs +0 -7
- package/bin/config-BYBQBrQG.mjs +0 -1
- package/bin/config-C1fmmSMf.mjs +0 -1
- package/bin/config-CK793fTW.mjs +0 -1
- package/bin/config-Zf66j-rA.mjs +0 -1
- package/bin/create-DqStfXER.mjs +0 -1
- package/bin/create-powerlines-DvusHjN3.mjs +0 -1
- package/bin/create.mjs +0 -3
- package/bin/deploy-DnH_cRzq.mjs +0 -1
- package/bin/deploy.mjs +0 -2
- package/bin/docs-HAdp8uaP.mjs +0 -1
- package/bin/docs.mjs +0 -2
- package/bin/gc-DPUIueyK.mjs +0 -1
- package/bin/gc.mjs +0 -3
- package/bin/help.mjs +0 -3
- package/bin/lint-Ba5PLVn8.mjs +0 -1
- package/bin/lint.mjs +0 -2
- package/bin/prepare-CGt61HvT.mjs +0 -1
- package/bin/prepare.mjs +0 -2
- package/bin/prompts-D_Rv-lNz.mjs +0 -27
- package/bin/script-Bd5rrPMc.mjs +0 -1
- package/bin/script-DG76mLcM.mjs +0 -1
- package/bin/script-ad5QoVHh.mjs +0 -1
- package/bin/script-zD-5QlvH.mjs +0 -1
- package/bin/shared-BItwCZrh.mjs +0 -216
- package/bin/shared-HomY1B9h.mjs +0 -103
- package/bin/shared-ZYvIh4BL.mjs +0 -249
- package/bin/shared-l2cUQ8pt.mjs +0 -235
- package/bin/types-CK9oFG7L.mjs +0 -1
- package/bin/types.mjs +0 -2
- package/bin/update-ChLxGxOi.mjs +0 -1
- package/bin/update-ZLGSIorW.mjs +0 -1
- package/bin/update.mjs +0 -2
- package/bin/zsh-HSOqkRfN.mjs +0 -1
- package/dist/_virtual/_rolldown/runtime.mjs +0 -36
package/bin/script-zD-5QlvH.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,L as t,M as n,j as r,s as i,x as a}from"./prompts-D_Rv-lNz.mjs";function o(){t(`${i(n.heading.secondary(`Tags: `))} ${n.tags.utility?n.tags.utility(a(` Utility `)):n.tags.$default(a(` Utility `))}`,{padding:0}),t(``),t(i(n.heading.secondary(`Usage:`))),t(n.body.secondary(`${n.usage.bin(`>_ powerlines`)} ${n.usage.command(`completions`)} ${n.usage.command(`fish`)} ${n.usage.command(`script`)} ${n.usage.args(`<path>`)} ${n.usage.options(`[options]`)}`),{padding:0}),t(n.body.secondary(`${n.usage.bin(`>_ powerlines`)} ${n.usage.command(`completions`)} ${n.usage.command(`fish`)} ${n.usage.command(`script`)} ${n.usage.options(`[options]`)} ${n.usage.args(`<path>`)}`),{padding:0}),t(``),t(i(n.heading.secondary(`Options:`))),r([[{value:n.body.primary(`--color, --colors`),align:`right`,border:`none`,maxWidth:`1/3`},{value:n.body.tertiary(`Force colored terminal output (env: POWERLINES_COLOR, default: false).`),align:`left`,border:`none`}],[{value:n.body.primary(`--no-color, --no-colors`),align:`right`,border:`none`,maxWidth:`1/3`},{value:n.body.tertiary(`Force disable colored terminal output (env: POWERLINES_NO_COLOR, default: false).`),align:`left`,border:`none`}],[{value:n.body.primary(`--display`),align:`right`,border:`none`,maxWidth:`1/3`},{value:n.body.tertiary(`Should the generated completion script be written to console output instead of an actual file on disk? (default: true).`),align:`left`,border:`none`}],[{value:n.body.primary(`-?, -h, --help`),align:`right`,border:`none`,maxWidth:`1/3`},{value:n.body.tertiary(`Show help information (default: false).`),align:`left`,border:`none`}],[{value:n.body.primary(`-i, --interact, --interactive`),align:`right`,border:`none`,maxWidth:`1/3`},{value:n.body.tertiary(`Enable interactive mode - will be set to false if running in a CI pipeline (env: POWERLINES_INTERACTIVE, default: true).`),align:`left`,border:`none`}],[{value:n.body.primary(`--no-interactive, --non-interactive`),align:`right`,border:`none`,maxWidth:`1/3`},{value:n.body.tertiary(`Disable interactive mode - will be set to true if running in a CI pipeline (env: POWERLINES_NON_INTERACTIVE, default: false).`),align:`left`,border:`none`}],[{value:n.body.primary(`--hide-banner, --no-banner`),align:`right`,border:`none`,maxWidth:`1/3`},{value:n.body.tertiary(`Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline (env: POWERLINES_NO_BANNER, default: false).`),align:`left`,border:`none`}],[{value:n.body.primary(`--no-color, --no-colors`),align:`right`,border:`none`,maxWidth:`1/3`},{value:n.body.tertiary(`Force disable colored terminal output (env: POWERLINES_NO_COLOR, default: false).`),align:`left`,border:`none`}],[{value:n.body.primary(`--no-interactive, --non-interactive`),align:`right`,border:`none`,maxWidth:`1/3`},{value:n.body.tertiary(`Disable interactive mode - will be set to true if running in a CI pipeline (env: POWERLINES_NON_INTERACTIVE, default: false).`),align:`left`,border:`none`}],[{value:n.body.primary(`-V, --verbose`),align:`right`,border:`none`,maxWidth:`1/3`},{value:n.body.tertiary(`Enable verbose output (env: POWERLINES_VERBOSE, default: false).`),align:`left`,border:`none`}],[{value:n.body.primary(`-v, --version`),align:`right`,border:`none`,maxWidth:`1/3`},{value:n.body.tertiary(`Show the version of the application (default: false).`),align:`left`,border:`none`}],[{value:n.body.primary(`-y, --yes`),align:`right`,border:`none`,maxWidth:`1/3`},{value:n.body.tertiary(`Skip all prompts by answering yes to all of them - will be set to true if running in a CI pipeline (env: POWERLINES_YES, default: false).`),align:`left`,border:`none`}]]),t(``),t(n.body.tertiary(`More information can be found in the Completions - Fish Script command documentation at ${e(`https://docs.stormsoftware.com/projects/powerlines/reference/cli/completions/fish/script`)}${n.body.tertiary(`.`)}`),{padding:0}),t(``)}export{o as t};
|
package/bin/shared-BItwCZrh.mjs
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import{D as e,E as t,I as n,T as r,_ as i,d as a,g as o,h as s,p as c,s as l,u,w as d}from"./prompts-D_Rv-lNz.mjs";const f=`__powerlines_debug() {
|
|
2
|
-
local file="$BASH_COMP_DEBUG_FILE"
|
|
3
|
-
if [[ -n \${file} ]]; then
|
|
4
|
-
echo "$*" >> "\${file}"
|
|
5
|
-
fi
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
_powerlines() {
|
|
9
|
-
local shellCompDirectiveError=1
|
|
10
|
-
local shellCompDirectiveNoSpace=2
|
|
11
|
-
local shellCompDirectiveNoFileComp=4
|
|
12
|
-
local shellCompDirectiveFilterFileExt=8
|
|
13
|
-
local shellCompDirectiveFilterDirs=16
|
|
14
|
-
local shellCompDirectiveKeepOrder=32
|
|
15
|
-
|
|
16
|
-
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
|
|
17
|
-
local -a completions
|
|
18
|
-
|
|
19
|
-
__powerlines_debug "
|
|
20
|
-
========= starting completion logic =========="
|
|
21
|
-
__powerlines_debug "CURRENT: \${CURRENT}, words[*]: \${words[*]}"
|
|
22
|
-
|
|
23
|
-
# The user could have moved the cursor backwards on the command-line.
|
|
24
|
-
# We need to trigger completion from the $CURRENT location, so we need
|
|
25
|
-
# to truncate the command-line ($words) up to the $CURRENT location.
|
|
26
|
-
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
|
27
|
-
words=( "\${=words[1,CURRENT]}" )
|
|
28
|
-
__powerlines_debug "Truncated words[*]: \${words[*]},"
|
|
29
|
-
|
|
30
|
-
lastParam=\${words[-1]}
|
|
31
|
-
lastChar=\${lastParam[-1]}
|
|
32
|
-
__powerlines_debug "lastParam: \${lastParam}, lastChar: \${lastChar}"
|
|
33
|
-
# For zsh, when completing a flag with an = (e.g., powerlines -n=<TAB>)
|
|
34
|
-
# completions must be prefixed with the flag
|
|
35
|
-
setopt local_options BASH_REMATCH
|
|
36
|
-
if [[ "\${lastParam}" =~ '-.*=' ]]; then
|
|
37
|
-
# We are dealing with a flag with an =
|
|
38
|
-
flagPrefix="-P \${BASH_REMATCH}"
|
|
39
|
-
fi
|
|
40
|
-
|
|
41
|
-
# Prepare the command to obtain completions, ensuring arguments are quoted for eval
|
|
42
|
-
local -a args_to_quote=("\${(@)words[2,-1]}")
|
|
43
|
-
if [ "\${lastChar}" = "" ]; then
|
|
44
|
-
# If the last parameter is complete (there is a space following it)
|
|
45
|
-
# We add an extra empty parameter so we can indicate this to the go completion code.
|
|
46
|
-
__powerlines_debug "Adding extra empty parameter"
|
|
47
|
-
args_to_quote+=("")
|
|
48
|
-
fi
|
|
49
|
-
|
|
50
|
-
# Use Zsh's (q) flag to quote each argument safely for eval
|
|
51
|
-
local quoted_args=("\${(@q)args_to_quote}")
|
|
52
|
-
|
|
53
|
-
# Join the main command and the quoted arguments into a single string for eval
|
|
54
|
-
requestComp="/nix/store/k6rg5622i98aqmjy94jki8nz7ghm3x0s-nodejs-slim-26.5.0/bin/node /home/runner/work/powerlines/powerlines/node_modules/.pnpm/nx@23.0.1_@swc-node+register@1.11.1_@swc+core@1.15.43_@swc+helpers@0.5.23__@swc+types@0_8e3dcc932a61eeca7d9982114458b00b/node_modules/nx/dist/bin/run-executor.js complete -- \${quoted_args[*]}"
|
|
55
|
-
|
|
56
|
-
__powerlines_debug "About to call: eval \${requestComp}"
|
|
57
|
-
|
|
58
|
-
# Use eval to handle any environment variables and such
|
|
59
|
-
out=$(eval \${requestComp} 2>/dev/null)
|
|
60
|
-
__powerlines_debug "completion output: \${out}"
|
|
61
|
-
|
|
62
|
-
# Extract the directive integer following a : from the last line
|
|
63
|
-
local lastLine
|
|
64
|
-
while IFS='
|
|
65
|
-
' read -r line; do
|
|
66
|
-
lastLine=\${line}
|
|
67
|
-
done < <(printf "%s
|
|
68
|
-
" "\${out[@]}")
|
|
69
|
-
__powerlines_debug "last line: \${lastLine}"
|
|
70
|
-
|
|
71
|
-
if [ "\${lastLine[1]}" = : ]; then
|
|
72
|
-
directive=\${lastLine[2,-1]}
|
|
73
|
-
# Remove the directive including the : and the newline
|
|
74
|
-
local suffix
|
|
75
|
-
(( suffix=\${#lastLine}+2))
|
|
76
|
-
out=\${out[1,-$suffix]}
|
|
77
|
-
else
|
|
78
|
-
# There is no directive specified. Leave $out as is.
|
|
79
|
-
__powerlines_debug "No directive found. Setting to default"
|
|
80
|
-
directive=0
|
|
81
|
-
fi
|
|
82
|
-
|
|
83
|
-
__powerlines_debug "directive: \${directive}"
|
|
84
|
-
__powerlines_debug "completions: \${out}"
|
|
85
|
-
__powerlines_debug "flagPrefix: \${flagPrefix}"
|
|
86
|
-
|
|
87
|
-
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
|
88
|
-
__powerlines_debug "Completion received error. Ignoring completions."
|
|
89
|
-
return
|
|
90
|
-
fi
|
|
91
|
-
|
|
92
|
-
local activeHelpMarker="%"
|
|
93
|
-
local endIndex=\${#activeHelpMarker}
|
|
94
|
-
local startIndex=$((\${#activeHelpMarker}+1))
|
|
95
|
-
local hasActiveHelp=0
|
|
96
|
-
while IFS='
|
|
97
|
-
' read -r comp; do
|
|
98
|
-
# Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
|
|
99
|
-
if [ "\${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
|
|
100
|
-
__powerlines_debug "ActiveHelp found: $comp"
|
|
101
|
-
comp="\${comp[$startIndex,-1]}"
|
|
102
|
-
if [ -n "$comp" ]; then
|
|
103
|
-
compadd -x "\${comp}"
|
|
104
|
-
__powerlines_debug "ActiveHelp will need delimiter"
|
|
105
|
-
hasActiveHelp=1
|
|
106
|
-
fi
|
|
107
|
-
continue
|
|
108
|
-
fi
|
|
109
|
-
|
|
110
|
-
if [ -n "$comp" ]; then
|
|
111
|
-
# If requested, completions are returned with a description.
|
|
112
|
-
# The description is preceded by a TAB character.
|
|
113
|
-
# For zsh's _describe, we need to use a : instead of a TAB.
|
|
114
|
-
# We first need to escape any : as part of the completion itself.
|
|
115
|
-
comp=\${comp//:/:}
|
|
116
|
-
|
|
117
|
-
local tab="$(printf ' ')"
|
|
118
|
-
comp=\${comp//$tab/:}
|
|
119
|
-
|
|
120
|
-
__powerlines_debug "Adding completion: \${comp}"
|
|
121
|
-
completions+=\${comp}
|
|
122
|
-
lastComp=$comp
|
|
123
|
-
fi
|
|
124
|
-
done < <(printf "%s
|
|
125
|
-
" "\${out[@]}")
|
|
126
|
-
|
|
127
|
-
# Add a delimiter after the activeHelp statements, but only if:
|
|
128
|
-
# - there are completions following the activeHelp statements, or
|
|
129
|
-
# - file completion will be performed (so there will be choices after the activeHelp)
|
|
130
|
-
if [ $hasActiveHelp -eq 1 ]; then
|
|
131
|
-
if [ \${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
|
|
132
|
-
__powerlines_debug "Adding activeHelp delimiter"
|
|
133
|
-
compadd -x "--"
|
|
134
|
-
hasActiveHelp=0
|
|
135
|
-
fi
|
|
136
|
-
fi
|
|
137
|
-
|
|
138
|
-
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
|
139
|
-
__powerlines_debug "Activating nospace."
|
|
140
|
-
noSpace="-S ''"
|
|
141
|
-
fi
|
|
142
|
-
|
|
143
|
-
if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
|
|
144
|
-
__powerlines_debug "Activating keep order."
|
|
145
|
-
keepOrder="-V"
|
|
146
|
-
fi
|
|
147
|
-
|
|
148
|
-
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
|
149
|
-
# File extension filtering
|
|
150
|
-
local filteringCmd
|
|
151
|
-
filteringCmd='_files'
|
|
152
|
-
for filter in \${completions[@]}; do
|
|
153
|
-
if [ \${filter[1]} != '*' ]; then
|
|
154
|
-
# zsh requires a glob pattern to do file filtering
|
|
155
|
-
filter="*.$filter"
|
|
156
|
-
fi
|
|
157
|
-
filteringCmd+=" -g $filter"
|
|
158
|
-
done
|
|
159
|
-
filteringCmd+=" \${flagPrefix}"
|
|
160
|
-
|
|
161
|
-
__powerlines_debug "File filtering command: $filteringCmd"
|
|
162
|
-
_arguments '*:filename:'"$filteringCmd"
|
|
163
|
-
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
|
164
|
-
# File completion for directories only
|
|
165
|
-
local subdir
|
|
166
|
-
subdir="\${completions[1]}"
|
|
167
|
-
if [ -n "$subdir" ]; then
|
|
168
|
-
__powerlines_debug "Listing directories in $subdir"
|
|
169
|
-
pushd "\${subdir}" >/dev/null 2>&1
|
|
170
|
-
else
|
|
171
|
-
__powerlines_debug "Listing directories in ."
|
|
172
|
-
fi
|
|
173
|
-
|
|
174
|
-
local result
|
|
175
|
-
_arguments '*:dirname:_files -/'" \${flagPrefix}"
|
|
176
|
-
result=$?
|
|
177
|
-
if [ -n "$subdir" ]; then
|
|
178
|
-
popd >/dev/null 2>&1
|
|
179
|
-
fi
|
|
180
|
-
return $result
|
|
181
|
-
else
|
|
182
|
-
__powerlines_debug "Calling _describe"
|
|
183
|
-
if eval _describe $keepOrder "completions" completions -Q \${flagPrefix} \${noSpace}; then
|
|
184
|
-
__powerlines_debug "_describe found some completions"
|
|
185
|
-
|
|
186
|
-
# Return the success of having called _describe
|
|
187
|
-
return 0
|
|
188
|
-
else
|
|
189
|
-
__powerlines_debug "_describe did not find completions."
|
|
190
|
-
__powerlines_debug "Checking if we should do file completion."
|
|
191
|
-
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
|
192
|
-
__powerlines_debug "deactivating file completion"
|
|
193
|
-
|
|
194
|
-
# Return 0 to indicate completion is finished and prevent zsh from
|
|
195
|
-
# trying other completion algorithms (which could cause hanging).
|
|
196
|
-
# We use NoFileComp directive to explicitly disable file completion.
|
|
197
|
-
return 0
|
|
198
|
-
else
|
|
199
|
-
# Perform file completion
|
|
200
|
-
__powerlines_debug "Activating file completion"
|
|
201
|
-
|
|
202
|
-
# We must return the result of this command, so it must be the
|
|
203
|
-
# last command, or else we must store its result to return it.
|
|
204
|
-
_arguments '*:filename:_files'" \${flagPrefix}"
|
|
205
|
-
fi
|
|
206
|
-
fi
|
|
207
|
-
fi
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
# don't run the completion function when being sourced or eval-ed
|
|
211
|
-
if [ "\${funcstack[1]}" = "_powerlines" ]; then
|
|
212
|
-
_powerlines
|
|
213
|
-
fi
|
|
214
|
-
`,p=f.split(`
|
|
215
|
-
`).map(f=>f.trim()?f.trim().startsWith(`#`)?`${c(f)}`:n(f).replaceAll(/(?<=\$(\{|\()).*(?=(\}\)))/g,o(`$&`)).replaceAll(/\".*\"/g,u(`$&`)).replaceAll(/(\[|\]|\(|\)|\||<|>|\$\(|\$?\{|\}|\+|=|;|:)/g,l(s(`$&`))).replaceAll(/(readonly|complete)\s+/g,o(`$&`)).replaceAll(/(?<=(readonly|complete)\s+)\w/g,l(i(`$&`))).replaceAll(/local\s+/g,t(`$&`)).replaceAll(/(?<=local\s+)\w/g,l(e(`$&`))).replaceAll(/(for|while)\s+/g,u(`$&`)).replaceAll(/(?<=for|while\s+)\w/g,l(a(`$&`))).replaceAll(/(return|if|fi|else|elif|then|done)\s+/g,o(`$&`)).replaceAll(/__\w/g,l(r(`$&`))).replaceAll(/(?<=\s)(-\w|--\w[\w-]*)(?=\s|$)/g,l(d(`$&`))):``).join(`
|
|
216
|
-
`);export{p as n,f as t};
|
package/bin/shared-HomY1B9h.mjs
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import{D as e,E as t,I as n,T as r,_ as i,d as a,g as o,h as s,p as c,s as l,u,w as d}from"./prompts-D_Rv-lNz.mjs";const f=`# Define shell completion directives
|
|
2
|
-
readonly ShellCompDirectiveError=1
|
|
3
|
-
readonly ShellCompDirectiveNoSpace=2
|
|
4
|
-
readonly ShellCompDirectiveNoFileComp=4
|
|
5
|
-
readonly ShellCompDirectiveFilterFileExt=8
|
|
6
|
-
readonly ShellCompDirectiveFilterDirs=16
|
|
7
|
-
readonly ShellCompDirectiveKeepOrder=32
|
|
8
|
-
|
|
9
|
-
# Function to debug completion
|
|
10
|
-
__powerlines_debug() {
|
|
11
|
-
if [[ -n \${BASH_COMP_DEBUG_FILE:-} ]]; then
|
|
12
|
-
echo "$*" >> "\${BASH_COMP_DEBUG_FILE}"
|
|
13
|
-
fi
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
# Function to handle completions
|
|
17
|
-
__powerlines_complete() {
|
|
18
|
-
local cur prev words cword
|
|
19
|
-
_get_comp_words_by_ref -n "=:" cur prev words cword
|
|
20
|
-
|
|
21
|
-
local requestComp out directive
|
|
22
|
-
|
|
23
|
-
# Build the command to get completions
|
|
24
|
-
requestComp="/nix/store/k6rg5622i98aqmjy94jki8nz7ghm3x0s-nodejs-slim-26.5.0/bin/node /home/runner/work/powerlines/powerlines/node_modules/.pnpm/nx@23.0.1_@swc-node+register@1.11.1_@swc+core@1.15.43_@swc+helpers@0.5.23__@swc+types@0_8e3dcc932a61eeca7d9982114458b00b/node_modules/nx/dist/bin/run-executor.js complete -- \${words[@]:1}"
|
|
25
|
-
|
|
26
|
-
# Add an empty parameter if the last parameter is complete
|
|
27
|
-
if [[ -z "$cur" ]]; then
|
|
28
|
-
requestComp="$requestComp ''"
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
# Get completions from the program
|
|
32
|
-
out=$(eval "$requestComp" 2>/dev/null)
|
|
33
|
-
|
|
34
|
-
# Extract directive if present
|
|
35
|
-
directive=0
|
|
36
|
-
if [[ "$out" == *:* ]]; then
|
|
37
|
-
directive=\${out##*:}
|
|
38
|
-
out=\${out%:*}
|
|
39
|
-
fi
|
|
40
|
-
|
|
41
|
-
# Process completions based on directive
|
|
42
|
-
if [[ $((directive & $ShellCompDirectiveError)) -ne 0 ]]; then
|
|
43
|
-
# Error, no completion
|
|
44
|
-
return
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
# Apply directives
|
|
48
|
-
if [[ $((directive & $ShellCompDirectiveNoSpace)) -ne 0 ]]; then
|
|
49
|
-
compopt -o nospace
|
|
50
|
-
fi
|
|
51
|
-
if [[ $((directive & $ShellCompDirectiveKeepOrder)) -ne 0 ]]; then
|
|
52
|
-
compopt -o nosort
|
|
53
|
-
fi
|
|
54
|
-
if [[ $((directive & $ShellCompDirectiveNoFileComp)) -ne 0 ]]; then
|
|
55
|
-
compopt +o default
|
|
56
|
-
fi
|
|
57
|
-
|
|
58
|
-
# Handle file extension filtering
|
|
59
|
-
if [[ $((directive & $ShellCompDirectiveFilterFileExt)) -ne 0 ]]; then
|
|
60
|
-
local filter=""
|
|
61
|
-
for ext in $out; do
|
|
62
|
-
filter="$filter|$ext"
|
|
63
|
-
done
|
|
64
|
-
filter=".($filter)"
|
|
65
|
-
compopt -o filenames
|
|
66
|
-
COMPREPLY=( $(compgen -f -X "!$filter" -- "$cur") )
|
|
67
|
-
return
|
|
68
|
-
fi
|
|
69
|
-
|
|
70
|
-
# Handle directory filtering
|
|
71
|
-
if [[ $((directive & $ShellCompDirectiveFilterDirs)) -ne 0 ]]; then
|
|
72
|
-
compopt -o dirnames
|
|
73
|
-
COMPREPLY=( $(compgen -d -- "$cur") )
|
|
74
|
-
return
|
|
75
|
-
fi
|
|
76
|
-
|
|
77
|
-
# Process completions
|
|
78
|
-
local IFS=$'
|
|
79
|
-
'
|
|
80
|
-
local tab=$(printf ' ')
|
|
81
|
-
|
|
82
|
-
# Parse completions with descriptions
|
|
83
|
-
local completions=()
|
|
84
|
-
while read -r comp; do
|
|
85
|
-
if [[ "$comp" == *$tab* ]]; then
|
|
86
|
-
# Split completion and description
|
|
87
|
-
local value=\${comp%%$tab*}
|
|
88
|
-
local desc=\${comp#*$tab}
|
|
89
|
-
completions+=("$value")
|
|
90
|
-
else
|
|
91
|
-
completions+=("$comp")
|
|
92
|
-
fi
|
|
93
|
-
done <<< "$out"
|
|
94
|
-
|
|
95
|
-
# Return completions
|
|
96
|
-
COMPREPLY=( $(compgen -W "\${completions[*]}" -- "$cur") )
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
# Register completion function
|
|
100
|
-
complete -F __powerlines_complete powerlines
|
|
101
|
-
`,p=f.split(`
|
|
102
|
-
`).map(f=>f.trim()?f.trim().startsWith(`#`)?`${c(f)}`:n(f).replaceAll(/(?<=\$(\{|\()).*(?=(\}\)))/g,o(`$&`)).replaceAll(/\".*\"/g,u(`$&`)).replaceAll(/(\[|\]|\(|\)|\||<|>|\$\(|\$?\{|\}|\+|=|;|:)/g,l(s(`$&`))).replaceAll(/(readonly|complete)\s+/g,o(`$&`)).replaceAll(/(?<=(readonly|complete)\s+)\w/g,l(i(`$&`))).replaceAll(/local\s+/g,t(`$&`)).replaceAll(/(?<=local\s+)\w/g,l(e(`$&`))).replaceAll(/while\s+/g,u(`$&`)).replaceAll(/(?<=while\s+)\w/g,l(a(`$&`))).replaceAll(/(if|fi|else|elif|then|done)\s+/g,o(`$&`)).replaceAll(/__\w/g,l(r(`$&`))).replaceAll(/(?<=\s)(-\w|--\w[\w-]*)(?=\s|$)/g,l(d(`$&`))):``).join(`
|
|
103
|
-
`);export{p as n,f as t};
|
package/bin/shared-ZYvIh4BL.mjs
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import{D as e,E as t,I as n,T as r,_ as i,d as a,g as o,h as s,p as c,s as l,u,w as d}from"./prompts-D_Rv-lNz.mjs";const f=`# powershell completion for Powerlines
|
|
2
|
-
|
|
3
|
-
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
4
|
-
function __powerlines_debug {
|
|
5
|
-
if ($env:BASH_COMP_DEBUG_FILE) {
|
|
6
|
-
"$args" | Out-File -Append -FilePath "$env:BASH_COMP_DEBUG_FILE"
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
filter __powerlines_escapeStringWithSpecialChars {
|
|
11
|
-
$_ -replace 's|#|@|$|;|,|''|{|}|(|)|"|||<|>|&','\`$&'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
[scriptblock]$__powerlinesCompleterBlock = {
|
|
15
|
-
param(
|
|
16
|
-
$WordToComplete,
|
|
17
|
-
$CommandAst,
|
|
18
|
-
$CursorPosition
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
# Get the current command-line and convert into a string
|
|
22
|
-
$Command = $CommandAst.CommandElements
|
|
23
|
-
$Command = "$Command"
|
|
24
|
-
|
|
25
|
-
__powerlines_debug ""
|
|
26
|
-
__powerlines_debug "========= starting completion logic =========="
|
|
27
|
-
__powerlines_debug "WordToComplete: $WordToComplete Command: $Command CursorPosition: $CursorPosition"
|
|
28
|
-
|
|
29
|
-
# The user could have moved the cursor backwards on the command-line.
|
|
30
|
-
# We need to trigger completion from the $CursorPosition location, so we need
|
|
31
|
-
# to truncate the command-line ($Command) up to the $CursorPosition location.
|
|
32
|
-
# Make sure the $Command is longer then the $CursorPosition before we truncate.
|
|
33
|
-
# This happens because the $Command does not include the last space.
|
|
34
|
-
if ($Command.Length -gt $CursorPosition) {
|
|
35
|
-
$Command = $Command.Substring(0, $CursorPosition)
|
|
36
|
-
}
|
|
37
|
-
__powerlines_debug "Truncated command: $Command"
|
|
38
|
-
|
|
39
|
-
$ShellCompDirectiveError=1
|
|
40
|
-
$ShellCompDirectiveNoSpace=2
|
|
41
|
-
$ShellCompDirectiveNoFileComp=4
|
|
42
|
-
$ShellCompDirectiveFilterFileExt=8
|
|
43
|
-
$ShellCompDirectiveFilterDirs=16
|
|
44
|
-
$ShellCompDirectiveKeepOrder=32
|
|
45
|
-
|
|
46
|
-
# Prepare the command to request completions for the program.
|
|
47
|
-
# Split the command at the first space to separate the program and arguments.
|
|
48
|
-
$Program, $Arguments = $Command.Split(" ", 2)
|
|
49
|
-
|
|
50
|
-
$QuotedArgs = ($Arguments -split ' ' | ForEach-Object { "'" + ($_ -replace "'", "''") + "'" }) -join ' '
|
|
51
|
-
__powerlines_debug "QuotedArgs: $QuotedArgs"
|
|
52
|
-
|
|
53
|
-
$RequestComp = "& /nix/store/k6rg5622i98aqmjy94jki8nz7ghm3x0s-nodejs-slim-26.5.0/bin/node /home/runner/work/powerlines/powerlines/node_modules/.pnpm/nx@23.0.1_@swc-node+register@1.11.1_@swc+core@1.15.43_@swc+helpers@0.5.23__@swc+types@0_8e3dcc932a61eeca7d9982114458b00b/node_modules/nx/dist/bin/run-executor.js complete '--' $QuotedArgs"
|
|
54
|
-
__powerlines_debug "RequestComp: $RequestComp"
|
|
55
|
-
|
|
56
|
-
# we cannot use $WordToComplete because it
|
|
57
|
-
# has the wrong values if the cursor was moved
|
|
58
|
-
# so use the last argument
|
|
59
|
-
if ($WordToComplete -ne "" ) {
|
|
60
|
-
$WordToComplete = $Arguments.Split(" ")[-1]
|
|
61
|
-
}
|
|
62
|
-
__powerlines_debug "New WordToComplete: $WordToComplete"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
# Check for flag with equal sign
|
|
66
|
-
$IsEqualFlag = ($WordToComplete -Like "--*=*" )
|
|
67
|
-
if ( $IsEqualFlag ) {
|
|
68
|
-
__powerlines_debug "Completing equal sign flag"
|
|
69
|
-
# Remove the flag part
|
|
70
|
-
$Flag, $WordToComplete = $WordToComplete.Split("=", 2)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if ( $WordToComplete -eq "" -And ( -Not $IsEqualFlag )) {
|
|
74
|
-
# If the last parameter is complete (there is a space following it)
|
|
75
|
-
# We add an extra empty parameter so we can indicate this to the go method.
|
|
76
|
-
__powerlines_debug "Adding extra empty parameter"
|
|
77
|
-
# PowerShell 7.2+ changed the way how the arguments are passed to executables,
|
|
78
|
-
# so for pre-7.2 or when Legacy argument passing is enabled we need to use
|
|
79
|
-
if ($PSVersionTable.PsVersion -lt [version]'7.2.0' -or
|
|
80
|
-
($PSVersionTable.PsVersion -lt [version]'7.3.0' -and -not [ExperimentalFeature]::IsEnabled("PSNativeCommandArgumentPassing")) -or
|
|
81
|
-
(($PSVersionTable.PsVersion -ge [version]'7.3.0' -or [ExperimentalFeature]::IsEnabled("PSNativeCommandArgumentPassing")) -and
|
|
82
|
-
$PSNativeCommandArgumentPassing -eq 'Legacy')) {
|
|
83
|
-
$RequestComp="$RequestComp" + ' \`"\`"'
|
|
84
|
-
} else {
|
|
85
|
-
$RequestComp = "$RequestComp" + ' ""'
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
__powerlines_debug "Calling $RequestComp"
|
|
90
|
-
# First disable ActiveHelp which is not supported for Powershell
|
|
91
|
-
$env:ActiveHelp = 0
|
|
92
|
-
|
|
93
|
-
# call the command store the output in $out and redirect stderr and stdout to null
|
|
94
|
-
# $Out is an array contains each line per element
|
|
95
|
-
Invoke-Expression -OutVariable out "$RequestComp" 2>&1 | Out-Null
|
|
96
|
-
|
|
97
|
-
# get directive from last line
|
|
98
|
-
[int]$Directive = $Out[-1].TrimStart(':')
|
|
99
|
-
if ($Directive -eq "") {
|
|
100
|
-
# There is no directive specified
|
|
101
|
-
$Directive = 0
|
|
102
|
-
}
|
|
103
|
-
__powerlines_debug "The completion directive is: $Directive"
|
|
104
|
-
|
|
105
|
-
# remove directive (last element) from out
|
|
106
|
-
$Out = $Out | Where-Object { $_ -ne $Out[-1] }
|
|
107
|
-
__powerlines_debug "The completions are: $Out"
|
|
108
|
-
if (($Directive -band $ShellCompDirectiveError) -ne 0 ) {
|
|
109
|
-
# Error code. No completion.
|
|
110
|
-
__powerlines_debug "Received error from custom completion go code"
|
|
111
|
-
return
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
$Longest = 0
|
|
115
|
-
[Array]$Values = $Out | ForEach-Object {
|
|
116
|
-
# Split the output in name and description
|
|
117
|
-
$Name, $Description = $_.Split("\`t", 2)
|
|
118
|
-
__powerlines_debug "Name: $Name Description: $Description"
|
|
119
|
-
|
|
120
|
-
# Look for the longest completion so that we can format things nicely
|
|
121
|
-
if ($Longest -lt $Name.Length) {
|
|
122
|
-
$Longest = $Name.Length
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
# Set the description to a one space string if there is none set.
|
|
126
|
-
# This is needed because the CompletionResult does not accept an empty string as argument
|
|
127
|
-
if (-Not $Description) {
|
|
128
|
-
$Description = " "
|
|
129
|
-
}
|
|
130
|
-
@{ Name = "$Name"; Description = "$Description" }
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
$Space = " "
|
|
135
|
-
if (($Directive -band $ShellCompDirectiveNoSpace) -ne 0 ) {
|
|
136
|
-
# remove the space here
|
|
137
|
-
__powerlines_debug "ShellCompDirectiveNoSpace is called"
|
|
138
|
-
$Space = ""
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if ((($Directive -band $ShellCompDirectiveFilterFileExt) -ne 0 ) -or
|
|
142
|
-
(($Directive -band $ShellCompDirectiveFilterDirs) -ne 0 )) {
|
|
143
|
-
__powerlines_debug "ShellCompDirectiveFilterFileExt ShellCompDirectiveFilterDirs are not supported"
|
|
144
|
-
|
|
145
|
-
# return here to prevent the completion of the extensions
|
|
146
|
-
return
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
$Values = $Values | Where-Object {
|
|
150
|
-
# filter the result
|
|
151
|
-
$_.Name -like "$WordToComplete*"
|
|
152
|
-
|
|
153
|
-
# Join the flag back if we have an equal sign flag
|
|
154
|
-
if ( $IsEqualFlag ) {
|
|
155
|
-
__powerlines_debug "Join the equal sign flag back to the completion value"
|
|
156
|
-
$_.Name = $Flag + "=" + $_.Name
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
# we sort the values in ascending order by name if keep order isn't passed
|
|
161
|
-
if (($Directive -band $ShellCompDirectiveKeepOrder) -eq 0 ) {
|
|
162
|
-
$Values = $Values | Sort-Object -Property Name
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) {
|
|
166
|
-
__powerlines_debug "ShellCompDirectiveNoFileComp is called"
|
|
167
|
-
|
|
168
|
-
if ($Values.Length -eq 0) {
|
|
169
|
-
# Just print an empty string here so the
|
|
170
|
-
# shell does not start to complete paths.
|
|
171
|
-
# We cannot use CompletionResult here because
|
|
172
|
-
# it does not accept an empty string as argument.
|
|
173
|
-
""
|
|
174
|
-
return
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
# Get the current mode
|
|
179
|
-
$Mode = (Get-PSReadLineKeyHandler | Where-Object { $_.Key -eq "Tab" }).Function
|
|
180
|
-
__powerlines_debug "Mode: $Mode"
|
|
181
|
-
|
|
182
|
-
$Values | ForEach-Object {
|
|
183
|
-
|
|
184
|
-
# store temporary because switch will overwrite $_
|
|
185
|
-
$comp = $_
|
|
186
|
-
|
|
187
|
-
# PowerShell supports three different completion modes
|
|
188
|
-
# - TabCompleteNext (default windows style - on each key press the next option is displayed)
|
|
189
|
-
# - Complete (works like bash)
|
|
190
|
-
# - MenuComplete (works like zsh)
|
|
191
|
-
# You set the mode with Set-PSReadLineKeyHandler -Key Tab -Function <mode>
|
|
192
|
-
|
|
193
|
-
# CompletionResult Arguments:
|
|
194
|
-
# 1) CompletionText text to be used as the auto completion result
|
|
195
|
-
# 2) ListItemText text to be displayed in the suggestion list
|
|
196
|
-
# 3) ResultType type of completion result
|
|
197
|
-
# 4) ToolTip text for the tooltip with details about the object
|
|
198
|
-
|
|
199
|
-
switch ($Mode) {
|
|
200
|
-
|
|
201
|
-
# bash like
|
|
202
|
-
"Complete" {
|
|
203
|
-
|
|
204
|
-
if ($Values.Length -eq 1) {
|
|
205
|
-
__powerlines_debug "Only one completion left"
|
|
206
|
-
|
|
207
|
-
# insert space after value
|
|
208
|
-
[System.Management.Automation.CompletionResult]::new($($comp.Name | __powerlines_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
|
|
209
|
-
|
|
210
|
-
} else {
|
|
211
|
-
# Add the proper number of spaces to align the descriptions
|
|
212
|
-
while($comp.Name.Length -lt $Longest) {
|
|
213
|
-
$comp.Name = $comp.Name + " "
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
# Check for empty description and only add parentheses if needed
|
|
217
|
-
if ($($comp.Description) -eq " " ) {
|
|
218
|
-
$Description = ""
|
|
219
|
-
} else {
|
|
220
|
-
$Description = " ($($comp.Description))"
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
[System.Management.Automation.CompletionResult]::new("$($comp.Name)$Description", "$($comp.Name)$Description", 'ParameterValue', "$($comp.Description)")
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
# zsh like
|
|
228
|
-
"MenuComplete" {
|
|
229
|
-
# insert space after value
|
|
230
|
-
# MenuComplete will automatically show the ToolTip of
|
|
231
|
-
# the highlighted value at the bottom of the suggestions.
|
|
232
|
-
[System.Management.Automation.CompletionResult]::new($($comp.Name | __powerlines_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
# TabCompleteNext and in case we get something unknown
|
|
236
|
-
Default {
|
|
237
|
-
# Like MenuComplete but we don't want to add a space here because
|
|
238
|
-
# the user need to press space anyway to get the completion.
|
|
239
|
-
# Description will not be shown because that's not possible with TabCompleteNext
|
|
240
|
-
[System.Management.Automation.CompletionResult]::new($($comp.Name | __powerlines_escapeStringWithSpecialChars), "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
Register-ArgumentCompleter -CommandName 'powerlines' -ScriptBlock $__powerlinesCompleterBlock
|
|
247
|
-
`,p=f.split(`
|
|
248
|
-
`).map(f=>f.trim()?f.trim().startsWith(`#`)?`${c(f)}`:n(f).replaceAll(/(?<=\$(\{|\()).*(?=(\}\)))/g,o(`$&`)).replaceAll(/\".*\"/g,u(`$&`)).replaceAll(/(\[|\]|\(|\)|\||<|>|\$\(|\$?\{|\}|\+|=|;|::new|::OutputEncoding|::UTF8)/g,l(s(`$&`))).replaceAll(/(switch|complete)\s+/g,o(`$&`)).replaceAll(/(?<=(switch|complete)\s+)\w/g,l(i(`$&`))).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,l(e(`$&`))).replaceAll(/while\s+/g,u(`$&`)).replaceAll(/(?<=while\s+)\w/g,l(a(`$&`))).replaceAll(/(if|fi|else|elif|then|done)\s+/g,o(`$&`)).replaceAll(/\$?__\w/g,l(r(`$&`))).replaceAll(/(?<=\s)(-\w|--\w[\w-]*)(?=\s|$)/g,l(d(`$&`))):``).join(`
|
|
249
|
-
`);export{p as n,f as t};
|