@pnpm.e2e/testing-provenance2 0.0.2 → 0.0.7

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.
@@ -0,0 +1,2 @@
1
+ # DO NOT MODIFY THIS FILE UNLESS YOU KNOW WHAT WILL HAPPEN
2
+ # This file is intended for changing pnpm's default settings by the package manager that install pnpm
@@ -0,0 +1,31 @@
1
+ ###-begin-{pkgname}-completion-###
2
+ if type complete &>/dev/null; then
3
+ _{pkgname}_completion () {
4
+ local words cword
5
+ if type _get_comp_words_by_ref &>/dev/null; then
6
+ _get_comp_words_by_ref -n = -n @ -n : -w words -i cword
7
+ else
8
+ cword="$COMP_CWORD"
9
+ words=("${COMP_WORDS[@]}")
10
+ fi
11
+
12
+ local si="$IFS"
13
+ IFS=$'\n' COMPREPLY=($(COMP_CWORD="$cword" \
14
+ COMP_LINE="$COMP_LINE" \
15
+ COMP_POINT="$COMP_POINT" \
16
+ SHELL=bash \
17
+ {completer} completion-server -- "${words[@]}" \
18
+ 2>/dev/null)) || return $?
19
+ IFS="$si"
20
+
21
+ if [ "$COMPREPLY" = "__tabtab_complete_files__" ]; then
22
+ COMPREPLY=($(compgen -f -- "$cword"))
23
+ fi
24
+
25
+ if type __ltrim_colon_completions &>/dev/null; then
26
+ __ltrim_colon_completions "${words[cword]}"
27
+ fi
28
+ }
29
+ complete -o default -F _{pkgname}_completion {pkgname}
30
+ fi
31
+ ###-end-{pkgname}-completion-###
@@ -0,0 +1,22 @@
1
+ ###-begin-{pkgname}-completion-###
2
+ function _{pkgname}_completion
3
+ set cmd (commandline -o)
4
+ set cursor (commandline -C)
5
+ set words (count $cmd)
6
+
7
+ set completions (eval env DEBUG=\"" \"" COMP_CWORD=\""$words\"" COMP_LINE=\""$cmd \"" COMP_POINT=\""$cursor\"" SHELL=fish {completer} completion-server -- $cmd)
8
+
9
+ if [ "$completions" = "__tabtab_complete_files__" ]
10
+ set -l matches (commandline -ct)*
11
+ if [ -n "$matches" ]
12
+ __fish_complete_path (commandline -ct)
13
+ end
14
+ else
15
+ for completion in $completions
16
+ echo -e $completion
17
+ end
18
+ end
19
+ end
20
+
21
+ complete -f -d '{pkgname}' -c {pkgname} -a "(_{pkgname}_completion)"
22
+ ###-end-{pkgname}-completion-###
@@ -0,0 +1,193 @@
1
+ ###-begin-{pkgname}-completion-###
2
+
3
+ Register-ArgumentCompleter -CommandName '{pkgname}' -ScriptBlock {
4
+ param(
5
+ $WordToComplete,
6
+ $CommandAst,
7
+ $CursorPosition
8
+ )
9
+
10
+ function __{pkgname}_debug {
11
+ if ($env:BASH_COMP_DEBUG_FILE) {
12
+ "$args" | Out-File -Append -FilePath "$env:BASH_COMP_DEBUG_FILE"
13
+ }
14
+ }
15
+
16
+ filter __{pkgname}_escapeStringWithSpecialChars {
17
+ $_ -replace '\s|#|@|\$|;|,|''|\{|\}|\(|\)|"|`|\||<|>|&','`$&'
18
+ }
19
+
20
+ # Get the current command line and convert into a string
21
+ $Command = $CommandAst.CommandElements
22
+ $Command = "$Command"
23
+
24
+ __{pkgname}_debug ""
25
+ __{pkgname}_debug "========= starting completion logic =========="
26
+ __{pkgname}_debug "WordToComplete: $WordToComplete Command: $Command CursorPosition: $CursorPosition"
27
+
28
+ # The user could have moved the cursor backwards on the command-line.
29
+ # We need to trigger completion from the $CursorPosition location, so we need
30
+ # to truncate the command-line ($Command) up to the $CursorPosition location.
31
+ # Make sure the $Command is longer then the $CursorPosition before we truncate.
32
+ # This happens because the $Command does not include the last space.
33
+ if ($Command.Length -gt $CursorPosition) {
34
+ $Command=$Command.Substring(0,$CursorPosition)
35
+ }
36
+ __{pkgname}_debug "Truncated command: $Command"
37
+
38
+ # Prepare the command to request completions for the program.
39
+ # Split the command at the first space to separate the program and arguments.
40
+ $Program,$Arguments = $Command.Split(" ",2)
41
+ $RequestComp="$Program completion-server"
42
+ __{pkgname}_debug "RequestComp: $RequestComp"
43
+
44
+ # we cannot use $WordToComplete because it
45
+ # has the wrong values if the cursor was moved
46
+ # so use the last argument
47
+ if ($WordToComplete -ne "" ) {
48
+ $WordToComplete = $Arguments.Split(" ")[-1]
49
+ }
50
+ __{pkgname}_debug "New WordToComplete: $WordToComplete"
51
+
52
+
53
+ # Check for flag with equal sign
54
+ $IsEqualFlag = ($WordToComplete -Like "--*=*" )
55
+ if ( $IsEqualFlag ) {
56
+ __{pkgname}_debug "Completing equal sign flag"
57
+ # Remove the flag part
58
+ $Flag,$WordToComplete = $WordToComplete.Split("=",2)
59
+ }
60
+
61
+ if ( $WordToComplete -eq "" -And ( -Not $IsEqualFlag )) {
62
+ # If the last parameter is complete (there is a space following it)
63
+ # We add an extra empty parameter so we can indicate this to the go method.
64
+ __{pkgname}_debug "Adding extra empty parameter"
65
+ # We need to use `"`" to pass an empty argument a "" or '' does not work!!!
66
+ $Command="$Command" + ' `"`"'
67
+ }
68
+
69
+ __{pkgname}_debug "Calling $RequestComp"
70
+
71
+ $oldenv = ($env:SHELL, $env:COMP_CWORD, $env:COMP_LINE, $env:COMP_POINT)
72
+ $env:SHELL = "pwsh"
73
+ $env:COMP_CWORD = $Command.Split(" ").Count - 1
74
+ $env:COMP_POINT = $CursorPosition
75
+ $env:COMP_LINE = $Command
76
+
77
+ try {
78
+ #call the command store the output in $out and redirect stderr and stdout to null
79
+ # $Out is an array contains each line per element
80
+ Invoke-Expression -OutVariable out "$RequestComp" 2>&1 | Out-Null
81
+ } finally {
82
+ ($env:SHELL, $env:COMP_CWORD, $env:COMP_LINE, $env:COMP_POINT) = $oldenv
83
+ }
84
+
85
+ __{pkgname}_debug "The completions are: $Out"
86
+
87
+ $Longest = 0
88
+ $Values = $Out | ForEach-Object {
89
+ #Split the output in name and description
90
+ $Name, $Description = $_.Split("`t",2)
91
+ __{pkgname}_debug "Name: $Name Description: $Description"
92
+
93
+ # Look for the longest completion so that we can format things nicely
94
+ if ($Longest -lt $Name.Length) {
95
+ $Longest = $Name.Length
96
+ }
97
+
98
+ # Set the description to a one space string if there is none set.
99
+ # This is needed because the CompletionResult does not accept an empty string as argument
100
+ if (-Not $Description) {
101
+ $Description = " "
102
+ }
103
+ @{Name="$Name";Description="$Description"}
104
+ }
105
+
106
+
107
+ $Space = " "
108
+ $Values = $Values | Where-Object {
109
+ # filter the result
110
+ if (-not $WordToComplete.StartsWith("-") -and $_.Name.StartsWith("-")) {
111
+ # skip flag completions unless a dash is present
112
+ return
113
+ } else {
114
+ $_.Name -like "$WordToComplete*"
115
+ }
116
+
117
+ # Join the flag back if we have an equal sign flag
118
+ if ( $IsEqualFlag ) {
119
+ __{pkgname}_debug "Join the equal sign flag back to the completion value"
120
+ $_.Name = $Flag + "=" + $_.Name
121
+ }
122
+ }
123
+
124
+ # Get the current mode
125
+ $Mode = (Get-PSReadLineKeyHandler | Where-Object {$_.Key -eq "Tab" }).Function
126
+ __{pkgname}_debug "Mode: $Mode"
127
+
128
+ $Values | ForEach-Object {
129
+
130
+ # store temporary because switch will overwrite $_
131
+ $comp = $_
132
+
133
+ # PowerShell supports three different completion modes
134
+ # - TabCompleteNext (default windows style - on each key press the next option is displayed)
135
+ # - Complete (works like bash)
136
+ # - MenuComplete (works like zsh)
137
+ # You set the mode with Set-PSReadLineKeyHandler -Key Tab -Function <mode>
138
+
139
+ # CompletionResult Arguments:
140
+ # 1) CompletionText text to be used as the auto completion result
141
+ # 2) ListItemText text to be displayed in the suggestion list
142
+ # 3) ResultType type of completion result
143
+ # 4) ToolTip text for the tooltip with details about the object
144
+
145
+ switch ($Mode) {
146
+
147
+ # bash like
148
+ "Complete" {
149
+
150
+ if ($Values.Length -eq 1) {
151
+ __{pkgname}_debug "Only one completion left"
152
+
153
+ # insert space after value
154
+ [System.Management.Automation.CompletionResult]::new($($comp.Name | __{pkgname}_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
155
+
156
+ } else {
157
+ # Add the proper number of spaces to align the descriptions
158
+ while($comp.Name.Length -lt $Longest) {
159
+ $comp.Name = $comp.Name + " "
160
+ }
161
+
162
+ # Check for empty description and only add parentheses if needed
163
+ if ($($comp.Description) -eq " " ) {
164
+ $Description = ""
165
+ } else {
166
+ $Description = " ($($comp.Description))"
167
+ }
168
+
169
+ [System.Management.Automation.CompletionResult]::new("$($comp.Name)$Description", "$($comp.Name)$Description", 'ParameterValue', "$($comp.Description)")
170
+ }
171
+ }
172
+
173
+ # zsh like
174
+ "MenuComplete" {
175
+ # insert space after value
176
+ # MenuComplete will automatically show the ToolTip of
177
+ # the highlighted value at the bottom of the suggestions.
178
+ [System.Management.Automation.CompletionResult]::new($($comp.Name | __{pkgname}_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
179
+ }
180
+
181
+ # TabCompleteNext and in case we get something unknown
182
+ Default {
183
+ # Like MenuComplete but we don't want to add a space here because
184
+ # the user need to press space anyway to get the completion.
185
+ # Description will not be shown because that's not possible with TabCompleteNext
186
+ [System.Management.Automation.CompletionResult]::new($($comp.Name | __{pkgname}_escapeStringWithSpecialChars), "$($comp.Name)", 'ParameterValue', "$($comp.Description)")
187
+ }
188
+ }
189
+
190
+ }
191
+ }
192
+
193
+ ###-end-{pkgname}-completion-###
@@ -0,0 +1,27 @@
1
+ #compdef {pkgname}
2
+ ###-begin-{pkgname}-completion-###
3
+ if type compdef &>/dev/null; then
4
+ _{pkgname}_completion () {
5
+ local reply
6
+ local si=$IFS
7
+
8
+ IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" SHELL=zsh {completer} completion-server -- "${words[@]}"))
9
+ IFS=$si
10
+
11
+ if [ "$reply" = "__tabtab_complete_files__" ]; then
12
+ _files
13
+ else
14
+ _describe 'values' reply
15
+ fi
16
+ }
17
+ # When called by the Zsh completion system, this will end with
18
+ # "loadautofunc" when initially autoloaded and "shfunc" later on, otherwise,
19
+ # the script was "eval"-ed so use "compdef" to register it with the
20
+ # completion system
21
+ if [[ $zsh_eval_context == *func ]]; then
22
+ _{pkgname}_completion "$@"
23
+ else
24
+ compdef _{pkgname}_completion {pkgname}
25
+ fi
26
+ fi
27
+ ###-end-{pkgname}-completion-###