Skip to content

Commit c4fd117

Browse files
committed
return back formatting
1 parent fb487c3 commit c4fd117

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

src/downgrade

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ read_pacman_conf() {
5656
}
5757

5858
read_downgrade_conf() {
59-
local var="$1"
59+
local var=$1
6060

6161
eval "$var=($(grep -E -v '^ *(#.*)?$' "$DOWNGRADE_CONF" 2>/dev/null | xargs printf '%q '))"
6262
}
6363

6464
read_unique() {
65-
local var="$1"
65+
local var=$1
6666
shift
6767

6868
if [[ -n "$*" ]]; then
@@ -98,7 +98,7 @@ present_packages() {
9898

9999
(($#)) || return 1
100100

101-
repo="$(pacman -Ss "^$pkgname$" | awk -F'/' 'NR==1 {print $1}')"
101+
repo="$(pacman -Ss "^${pkgname}$" | awk -F'/' 'NR==1 {print $1}')"
102102
repo=${repo:-foreign/aur}
103103

104104
gettext 'Available packages'
@@ -120,7 +120,7 @@ read_selection() {
120120
}
121121

122122
is_yes() {
123-
local ans="${1,,}" y
123+
local ans=${1,,} y
124124

125125
y=$(gettext 'y')
126126

@@ -152,7 +152,7 @@ prompt_to_ignore() {
152152
}
153153

154154
filter_packages() {
155-
local name="$1" operator="$2" version="$3" pkg
155+
local name=$1 operator=$2 version=$3 pkg
156156

157157
while read -r pkg; do
158158
if matches_name_version_filter "$pkg" "$name" "$operator" "$version"; then
@@ -162,7 +162,7 @@ filter_packages() {
162162
}
163163

164164
matches_name_version_filter() {
165-
local pkg="$1" name="$2" operator="$3" search_version="$4" pkg_version version_regex
165+
local pkg=$1 name=$2 operator=$3 search_version=$4 pkg_version version_regex
166166

167167
if [[ -z "$operator" ]] || [[ -z "$version" ]]; then
168168
return 0
@@ -199,7 +199,7 @@ matches_name_version_filter() {
199199
}
200200

201201
search_git() {
202-
local name="$1" pairs path
202+
local name=$1 pairs path
203203

204204
for cache in "${PACMAN_CACHE[@]}"; do
205205
path="$cache/$name" # directory name
@@ -216,12 +216,12 @@ search_git() {
216216
# We could remove packages that are on local machine in this process,
217217
# however since pathname can be anything except '\0' its better to rename output pkg
218218
# shellcheck disable=SC2086
219-
echo "$path/$name" "$pairs" | awk '{for(i=2;i<NF;i+=2) printf "%s-%s-%s-any.gitpkg.tar.gz\n", $1, $(i+1), $i}' | sort -V
219+
echo "$path/$name" $pairs | awk '{for(i=2;i<NF;i+=2) printf "%s-%s-%s-any.gitpkg.tar.gz\n", $1, $(i+1), $i}' | sort -V
220220
done
221221
}
222222

223223
search_ala() {
224-
local name="$1" uriname pkgfile_re index
224+
local name=$1 uriname pkgfile_re index
225225

226226
# This is a *very* naive URI encoding. Packages typically don't use characters
227227
# that need encoding, so we'll just add them as we get bug reports. So far +
@@ -240,7 +240,7 @@ search_ala() {
240240
}
241241

242242
search_cache() {
243-
local name="$1" pkgfile_re index
243+
local name=$1 pkgfile_re index
244244

245245
# version: 2025.11.12.r15.g0eed3fe
246246
version_regex="[0-9.]+(.[a-zA-Z0-9])*"
@@ -311,7 +311,7 @@ output_package() {
311311

312312
# <package name> <package path>
313313
extract_version_parts() {
314-
local pkgname="$1" path="$2"
314+
local pkgname=$1 path=$2
315315

316316
sed '
317317
# Strip first path component
@@ -330,27 +330,27 @@ extract_version_parts() {
330330

331331
# shellcheck disable=SC2207
332332
process_term() {
333-
local term="$1" name operator version candidates choice
333+
local term=$1 name operator version candidates choice
334334

335335
read -r name operator version < \
336336
<(sed -r "s/(.*[^<>=~])(<=|>=|<|>|=|=~|==)([^<>=~].*)/\1 \2 \3/g" <<<"$term")
337337

338-
installed=("$(previously_installed "$name")")
338+
installed=($(previously_installed "$name"))
339339
current=$(currently_installed "$name")
340340

341341
candidates=()
342342
if ((DOWNGRADE_FROM_CACHE)); then
343-
candidates+=("$(search_cache "$name" | filter_packages "$name" "$operator" "$version")")
343+
candidates+=($(search_cache "$name" | filter_packages "$name" "$operator" "$version"))
344344
fi
345345
if ((DOWNGRADE_FROM_ALA)) && { ((!DOWNGRADE_PREFER_CACHE)) || ((${#candidates[@]} == 0)); }; then
346-
candidates=("$(search_ala "$name" | filter_packages "$name" "$operator" "$version")" "${candidates[@]}")
346+
candidates=($(search_ala "$name" | filter_packages "$name" "$operator" "$version") "${candidates[@]}")
347347
fi
348348

349-
candidates=("$(printf '%s\n' "${candidates[@]}" | sort_packages)")
349+
candidates=($(printf '%s\n' "${candidates[@]}" | sort_packages))
350350

351351
# this is already sorted
352352
if ((DOWNGRADE_FROM_GIT)); then
353-
candidates=("$(search_git "$name" | filter_packages "$name" "$operator" "$version")" "${candidates[@]}")
353+
candidates=($(search_git "$name" | filter_packages "$name" "$operator" "$version") "${candidates[@]}")
354354
fi
355355

356356
if (("${#candidates[@]}" == 0)); then
@@ -402,7 +402,7 @@ main() {
402402
fi
403403
done
404404

405-
return "$exit_code"
405+
return $exit_code
406406
}
407407

408408
parse_options() {

0 commit comments

Comments
 (0)