shell: format with shfmt
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I86a7c52c32a14bf0a1184b6d7dc50112c49ade91
diff --git a/tools/sdbus++-gendir b/tools/sdbus++-gendir
index 25c4c0e..2ad4e36 100755
--- a/tools/sdbus++-gendir
+++ b/tools/sdbus++-gendir
@@ -32,8 +32,7 @@
options="$(getopt -o ho:t:j: --long help,list-all,output:,tool:,jobs: -- "$@")"
eval set -- "$options"
-while true;
-do
+while true; do
case "$1" in
-h | --help)
show_usage
@@ -70,8 +69,7 @@
esac
done
-if [ $# -eq 0 ];
-then
+if [ $# -eq 0 ]; then
show_usage
exit 1
fi
@@ -87,11 +85,9 @@
# $5: 'append-mode' if present.
function generate_single {
- if [ "xempty" == "x$1" ];
- then
+ if [ "empty" == "$1" ]; then
echo -n > "$outputdir/$4"
- elif [ "x" == "x$5" ];
- then
+ elif [ "" == "$5" ]; then
$sdbuspp "$1" "$2" "$3" > "$outputdir/$4" &
all_jobs="$all_jobs $!"
else
@@ -101,8 +97,7 @@
# Emit filename as needed.
filename=$outputdir/$4
- if [ "x1" != "x${emitted_file_names[$filename]}" ];
- then
+ if [ "x1" != "x${emitted_file_names[$filename]}" ]; then
emitted_file_names[$filename]="1"
# Always emit generated file name for foo-cpp and foo-header.
@@ -113,8 +108,7 @@
;;
*)
- if [ "xyes" == "x$listall" ];
- then
+ if [ "yes" == "$listall" ]; then
echo "$filename"
fi
;;
@@ -123,22 +117,19 @@
# Ensure that no more than ${parallel} jobs are running at a time and if so
# wait for them to finish.
- if [[ $(echo "$all_jobs" | wc -w) -ge $parallel ]];
- then
+ if [[ $(echo "$all_jobs" | wc -w) -ge $parallel ]]; then
waitall
fi
}
function waitall {
- for job in $all_jobs;
- do
+ for job in $all_jobs; do
wait "$job"
done
all_jobs=""
}
-for d in "$@";
-do
+for d in "$@"; do
interfaces="$(find "$d" -name '*.interface.yaml')"
errors="$(find "$d" -name '*.errors.yaml')"
@@ -146,8 +137,7 @@
# which YAML sources are present. For these files, we need to first
# create an empty file to ensure the file does not carry old data from
# a previous run.
- for y in $interfaces $errors;
- do
+ for y in $interfaces $errors; do
path="${y%.interface.yaml}"
path="${path%.errors.yaml}"
iface="${path//\//.}"
@@ -156,8 +146,7 @@
generate_single empty markdown "$iface" "$path.md"
done
- for i in $interfaces;
- do
+ for i in $interfaces; do
path="${i%.interface.yaml}"
iface="${path//\//.}"
@@ -169,9 +158,7 @@
done
waitall # finish all before continuing
-
- for e in $errors;
- do
+ for e in $errors; do
path="${e%.errors.yaml}"
iface="${path//\//.}"