Demi Marie Obenour <demiobenour@gmail.com> writes:
On 10/1/25 06:27, Alyssa Ross wrote:
This is actually a treewide shfmt run, but I guess nothing outside of scripts/ has any formatting issues.
Signed-off-by: Alyssa Ross <hi@alyssa.is> --- scripts/dist-cloud-hypervisor.sh | 4 +- scripts/format-uuid.sh | 2 +- scripts/make-erofs.sh | 8 +-- scripts/run-qemu.sh | 109 ++++++++++++++++--------------- scripts/update-nixpkgs.sh | 4 +- 5 files changed, 64 insertions(+), 63 deletions(-)
diff --git a/scripts/dist-cloud-hypervisor.sh b/scripts/dist-cloud-hypervisor.sh index 603c2df..22bcbaa 100755 --- a/scripts/dist-cloud-hypervisor.sh +++ b/scripts/dist-cloud-hypervisor.sh @@ -16,6 +16,6 @@ trap 'rm -rf -- "$dir"' EXIT mkdir -p -- "$dir/$name/LICENSES" cp -- LICENSES/Apache-2.0.txt LICENSES/LicenseRef-BSD-3-Clause-Google.txt \ "$dir/$name/LICENSES" -cat pkgs/cloud-hypervisor/*.patch > "$dir/$name/cloud-hypervisor.patch" -cat pkgs/cloud-hypervisor/vhost/*.patch > "$dir/$name/vhost.patch" +cat pkgs/cloud-hypervisor/*.patch >"$dir/$name/cloud-hypervisor.patch" +cat pkgs/cloud-hypervisor/vhost/*.patch >"$dir/$name/vhost.patch" tar -C "$dir" -czf "$name.tar.gz" -- "$name" diff --git a/scripts/format-uuid.sh b/scripts/format-uuid.sh index 497a5f2..3b38278 100755 --- a/scripts/format-uuid.sh +++ b/scripts/format-uuid.sh @@ -4,7 +4,7 @@ # SPDX-FileCopyrightText: 2022 Unikie # SPDX-License-Identifier: EUPL-1.2+
-substr () { +substr() { str=$1 beg=$2 end=$3 diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh index ad04844..7e46847 100755 --- a/scripts/make-erofs.sh +++ b/scripts/make-erofs.sh @@ -35,8 +35,8 @@ while read -r arg1; do # a subset of all paths, but this subset includes all of # the ones passed in practice other than /. case $arg2 in - (*/*) parent=${arg2%/*};; - (*) parent=.;; + */*) parent=${arg2%/*} ;; + *) parent=. ;; esac
I *really* don't like introducing mismatched parentheses, as it breaks parentheses matching in editors. Editors know about quoting, but probably not about case statements. Also, at least some shells misparse the form without the extra parentheses when inside $(...).
Emacs seems to, but it's probably an exception. I would like to have soem standard, and I wouldn't mind adopting matched parentheses style, but I didn't see an option for that in shfmt, at least. If there's a way to get formatted shell scripts with matched parantheses case items, then we can both be happy, but otherwise I'm inclined to favour consistent formatting, especially because I don't think we'd be able to standardize on a syntax I suspect most shell scripters don't even know exists (I didn't) without tooling support.
diff --git a/scripts/update-nixpkgs.sh b/scripts/update-nixpkgs.sh index dd1b7de..e481eb0 100755 --- a/scripts/update-nixpkgs.sh +++ b/scripts/update-nixpkgs.sh @@ -12,11 +12,11 @@ set -ueo pipefail root="$(dirname "$0")/.." out="$(mktemp -p "$root/lib" -t nixpkgs.default.nix.XXXXXXXXXX)"
-exec > "$out" +exec >"$out"
rev="$( curl -fsLS "https://api.github.com/repos/NixOS/nixpkgs/branches/${1-nixos-unstable}" | - jq -r .commit.sha + jq -r .commit.sha
This seems to be pointless extra indentation.
I think it's probably a good thing to have a consistent way of showing that something is part of a pipeline, since it's so easy to miss the line-final |.