Skip to content

Commit ea45cd5

Browse files
Merge pull request #2058 from ardaguclu/k8s-1.33
CNTRLPLANE-1054: Update k8s dependencies to 1.33 with bumping the other dependencies
2 parents 1baef05 + e421001 commit ea45cd5

File tree

1,733 files changed

+95356
-64746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,733 files changed

+95356
-64746
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \
1313
targets/openshift/deps-gomod.mk \
1414
)
1515

16-
KUBE_GIT_MINOR_VERSION := "32"
17-
KUBE_GIT_VERSION := "v1.32.1"
16+
KUBE_GIT_MINOR_VERSION := "33"
17+
KUBE_GIT_VERSION := "v1.33.3"
1818

1919
GO_LD_EXTRAFLAGS :=-X k8s.io/component-base/version.gitMajor="1" \
2020
-X k8s.io/component-base/version.gitMinor=$(KUBE_GIT_MINOR_VERSION) \

contrib/completions/bash/oc

Lines changed: 120 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ __oc_process_completion_results() {
111111

112112
if (((directive & shellCompDirectiveFilterFileExt) != 0)); then
113113
# File extension filtering
114-
local fullFilter filter filteringCmd
114+
local fullFilter="" filter filteringCmd
115115

116116
# Do not use quotes around the $completions variable or else newline
117117
# characters will be kept.
@@ -142,20 +142,71 @@ __oc_process_completion_results() {
142142
__oc_handle_special_char "$cur" =
143143

144144
# Print the activeHelp statements before we finish
145+
__oc_handle_activeHelp
146+
}
147+
148+
__oc_handle_activeHelp() {
149+
# Print the activeHelp statements
145150
if ((${#activeHelp[*]} != 0)); then
146-
printf "\n";
147-
printf "%s\n" "${activeHelp[@]}"
148-
printf "\n"
149-
150-
# The prompt format is only available from bash 4.4.
151-
# We test if it is available before using it.
152-
if (x=${PS1@P}) 2> /dev/null; then
153-
printf "%s" "${PS1@P}${COMP_LINE[@]}"
154-
else
155-
# Can't print the prompt. Just print the
156-
# text the user had typed, it is workable enough.
157-
printf "%s" "${COMP_LINE[@]}"
151+
if [ -z $COMP_TYPE ]; then
152+
# Bash v3 does not set the COMP_TYPE variable.
153+
printf "\n";
154+
printf "%s\n" "${activeHelp[@]}"
155+
printf "\n"
156+
__oc_reprint_commandLine
157+
return
158158
fi
159+
160+
# Only print ActiveHelp on the second TAB press
161+
if [ $COMP_TYPE -eq 63 ]; then
162+
printf "\n"
163+
printf "%s\n" "${activeHelp[@]}"
164+
165+
if ((${#COMPREPLY[*]} == 0)); then
166+
# When there are no completion choices from the program, file completion
167+
# may kick in if the program has not disabled it; in such a case, we want
168+
# to know if any files will match what the user typed, so that we know if
169+
# there will be completions presented, so that we know how to handle ActiveHelp.
170+
# To find out, we actually trigger the file completion ourselves;
171+
# the call to _filedir will fill COMPREPLY if files match.
172+
if (((directive & shellCompDirectiveNoFileComp) == 0)); then
173+
__oc_debug "Listing files"
174+
_filedir
175+
fi
176+
fi
177+
178+
if ((${#COMPREPLY[*]} != 0)); then
179+
# If there are completion choices to be shown, print a delimiter.
180+
# Re-printing the command-line will automatically be done
181+
# by the shell when it prints the completion choices.
182+
printf -- "--"
183+
else
184+
# When there are no completion choices at all, we need
185+
# to re-print the command-line since the shell will
186+
# not be doing it itself.
187+
__oc_reprint_commandLine
188+
fi
189+
elif [ $COMP_TYPE -eq 37 ] || [ $COMP_TYPE -eq 42 ]; then
190+
# For completion type: menu-complete/menu-complete-backward and insert-completions
191+
# the completions are immediately inserted into the command-line, so we first
192+
# print the activeHelp message and reprint the command-line since the shell won't.
193+
printf "\n"
194+
printf "%s\n" "${activeHelp[@]}"
195+
196+
__oc_reprint_commandLine
197+
fi
198+
fi
199+
}
200+
201+
__oc_reprint_commandLine() {
202+
# The prompt format is only available from bash 4.4.
203+
# We test if it is available before using it.
204+
if (x=${PS1@P}) 2> /dev/null; then
205+
printf "%s" "${PS1@P}${COMP_LINE[@]}"
206+
else
207+
# Can't print the prompt. Just print the
208+
# text the user had typed, it is workable enough.
209+
printf "%s" "${COMP_LINE[@]}"
159210
fi
160211
}
161212

@@ -166,6 +217,8 @@ __oc_extract_activeHelp() {
166217
local endIndex=${#activeHelpMarker}
167218

168219
while IFS='' read -r comp; do
220+
[[ -z $comp ]] && continue
221+
169222
if [[ ${comp:0:endIndex} == $activeHelpMarker ]]; then
170223
comp=${comp:endIndex}
171224
__oc_debug "ActiveHelp found: $comp"
@@ -188,16 +241,21 @@ __oc_handle_completion_types() {
188241
# If the user requested inserting one completion at a time, or all
189242
# completions at once on the command-line we must remove the descriptions.
190243
# https://github.com/spf13/cobra/issues/1508
191-
local tab=$'\t' comp
192-
while IFS='' read -r comp; do
193-
[[ -z $comp ]] && continue
194-
# Strip any description
195-
comp=${comp%%$tab*}
196-
# Only consider the completions that match
197-
if [[ $comp == "$cur"* ]]; then
198-
COMPREPLY+=("$comp")
199-
fi
200-
done < <(printf "%s\n" "${completions[@]}")
244+
245+
# If there are no completions, we don't need to do anything
246+
(( ${#completions[@]} == 0 )) && return 0
247+
248+
local tab=$'\t'
249+
250+
# Strip any description and escape the completion to handled special characters
251+
IFS=$'\n' read -ra completions -d '' < <(printf "%q\n" "${completions[@]%%$tab*}")
252+
253+
# Only consider the completions that match
254+
IFS=$'\n' read -ra COMPREPLY -d '' < <(IFS=$'\n'; compgen -W "${completions[*]}" -- "${cur}")
255+
256+
# compgen looses the escaping so we need to escape all completions again since they will
257+
# all be inserted on the command-line.
258+
IFS=$'\n' read -ra COMPREPLY -d '' < <(printf "%q\n" "${COMPREPLY[@]}")
201259
;;
202260

203261
*)
@@ -208,11 +266,25 @@ __oc_handle_completion_types() {
208266
}
209267

210268
__oc_handle_standard_completion_case() {
211-
local tab=$'\t' comp
269+
local tab=$'\t'
270+
271+
# If there are no completions, we don't need to do anything
272+
(( ${#completions[@]} == 0 )) && return 0
212273

213274
# Short circuit to optimize if we don't have descriptions
214275
if [[ "${completions[*]}" != *$tab* ]]; then
215-
IFS=$'\n' read -ra COMPREPLY -d '' < <(compgen -W "${completions[*]}" -- "$cur")
276+
# First, escape the completions to handle special characters
277+
IFS=$'\n' read -ra completions -d '' < <(printf "%q\n" "${completions[@]}")
278+
# Only consider the completions that match what the user typed
279+
IFS=$'\n' read -ra COMPREPLY -d '' < <(IFS=$'\n'; compgen -W "${completions[*]}" -- "${cur}")
280+
281+
# compgen looses the escaping so, if there is only a single completion, we need to
282+
# escape it again because it will be inserted on the command-line. If there are multiple
283+
# completions, we don't want to escape them because they will be printed in a list
284+
# and we don't want to show escape characters in that list.
285+
if (( ${#COMPREPLY[@]} == 1 )); then
286+
COMPREPLY[0]=$(printf "%q" "${COMPREPLY[0]}")
287+
fi
216288
return 0
217289
fi
218290

@@ -221,23 +293,39 @@ __oc_handle_standard_completion_case() {
221293
# Look for the longest completion so that we can format things nicely
222294
while IFS='' read -r compline; do
223295
[[ -z $compline ]] && continue
224-
# Strip any description before checking the length
225-
comp=${compline%%$tab*}
296+
297+
# Before checking if the completion matches what the user typed,
298+
# we need to strip any description and escape the completion to handle special
299+
# characters because those escape characters are part of what the user typed.
300+
# Don't call "printf" in a sub-shell because it will be much slower
301+
# since we are in a loop.
302+
printf -v comp "%q" "${compline%%$tab*}" &>/dev/null || comp=$(printf "%q" "${compline%%$tab*}")
303+
226304
# Only consider the completions that match
227305
[[ $comp == "$cur"* ]] || continue
306+
307+
# The completions matches. Add it to the list of full completions including
308+
# its description. We don't escape the completion because it may get printed
309+
# in a list if there are more than one and we don't want show escape characters
310+
# in that list.
228311
COMPREPLY+=("$compline")
312+
313+
# Strip any description before checking the length, and again, don't escape
314+
# the completion because this length is only used when printing the completions
315+
# in a list and we don't want show escape characters in that list.
316+
comp=${compline%%$tab*}
229317
if ((${#comp}>longest)); then
230318
longest=${#comp}
231319
fi
232320
done < <(printf "%s\n" "${completions[@]}")
233321

234-
# If there is a single completion left, remove the description text
322+
# If there is a single completion left, remove the description text and escape any special characters
235323
if ((${#COMPREPLY[*]} == 1)); then
236324
__oc_debug "COMPREPLY[0]: ${COMPREPLY[0]}"
237-
comp="${COMPREPLY[0]%%$tab*}"
238-
__oc_debug "Removed description from single completion, which is now: ${comp}"
239-
COMPREPLY[0]=$comp
240-
else # Format the descriptions
325+
COMPREPLY[0]=$(printf "%q" "${COMPREPLY[0]%%$tab*}")
326+
__oc_debug "Removed description from single completion, which is now: ${COMPREPLY[0]}"
327+
else
328+
# Format the descriptions
241329
__oc_format_comp_descriptions $longest
242330
fi
243331
}

0 commit comments

Comments
 (0)