Skip to content

Commit 881ac01

Browse files
Fix restyle
1 parent 420fbb8 commit 881ac01

File tree

5 files changed

+61
-61
lines changed

5 files changed

+61
-61
lines changed

scripts/sdk-doctor/_network.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ display_interface_info() {
5252
interfaces=$(ip link show | grep -oP '(?<=^\d: )[e-w]+[0-9a-zA-Z-]+')
5353

5454
# Iterate over each interface and display relevant information
55-
for intf in $interfaces; do
55+
for intf in "$interfaces"; do
5656
display_interface_info "$intf"
5757
echo ""
5858
done

scripts/sdk-doctor/_os.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18-
ROOT_DIR=$(realpath $(dirname "$0")/../..)
19-
cd $ROOT_DIR
18+
ROOT_DIR=$(realpath "$(dirname "$0")"/../..)
19+
cd "$ROOT_DIR"
2020

2121
# Function to display OS information
2222
get_os_info() {

scripts/sdk-doctor/_repo.sh

+27-27
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18-
ROOT_DIR=$(realpath $(dirname "$0")/../..)
19-
cd $ROOT_DIR
18+
ROOT_DIR=$(realpath "$(dirname "$0")"/../..)
19+
cd "$ROOT_DIR"
2020

2121
get_repo_and_branch_info() {
2222
# Input validation
@@ -39,7 +39,7 @@ get_repo_and_branch_info() {
3939
return 1
4040
fi
4141

42-
cd $path
42+
cd "$path"
4343

4444
# Get the URL of the remote origin
4545
remote_url=$(git config --get remote.origin.url)
@@ -54,7 +54,7 @@ get_repo_and_branch_info() {
5454
padding_length=$((total_length - text_length))
5555

5656
echo '+-----------------------------------------------------------------------------------------------+'
57-
printf "| %s: %s%*s|\n" "$repo_friendly_name" "$repo_name" $padding_length ""
57+
printf "| %s: %s%*s|\n" "$repo_friendly_name" "$repo_name" "$padding_length" ""
5858
echo '+-----------------------------------------------------------------------------------------------+'
5959
else
6060
# Print error message if there is no remote URL
@@ -91,7 +91,7 @@ get_repo_and_branch_info() {
9191
echo "Commit Date: $commit_datetime"
9292

9393
# Attempt to find branches that contain this commit
94-
branches=$(git branch --contains $commit_sha | sed 's/^/ /')
94+
branches=$(git branch --contains "$commit_sha" | sed 's/^/ /')
9595

9696
if [ -n "$branches" ]; then
9797
echo "Contained in branches:"
@@ -105,7 +105,7 @@ get_repo_and_branch_info() {
105105
echo
106106

107107
# Navigate back to the original directory
108-
cd $ROOT_DIR
108+
cd "$ROOT_DIR"
109109
}
110110

111111
trim_commit_message() {
@@ -114,7 +114,7 @@ trim_commit_message() {
114114
# Check if the commit message contains a newline character
115115
if [[ "$commit_message" == *$'\n'* ]]; then
116116
# Extract the first line of the commit message
117-
local first_line=${commit_message%%$'\n'*}
117+
local first_line="${commit_message%%$'\n'*}"
118118
else
119119
# If there's no newline, use the entire commit message
120120
local first_line="$commit_message"
@@ -129,24 +129,24 @@ get_repo_and_branch_info "."
129129

130130
# Handle arguments
131131
case "$1" in
132-
--git-sub)
133-
# Initialize an array to hold the directories
134-
declare -a repo_dirs
135-
136-
cd $ROOT_DIR
137-
138-
# Find directories containing a .github folder and store them in the array, excluding the current directory
139-
while IFS= read -r dir; do
140-
# Check if the directory is not the current directory
141-
if [[ "$dir" != "." ]]; then
142-
repo_dirs+=("$dir")
143-
fi
144-
done < <(find . -type d -name .github | awk -F'/[^/]*$' '{print $1}')
145-
146-
# Iterate through the directories and call the function for each
147-
for dir in "${repo_dirs[@]}"; do
148-
get_repo_and_branch_info "$dir"
149-
done
150-
;;
151-
*) ;;
132+
--git-sub)
133+
# Initialize an array to hold the directories
134+
declare -a repo_dirs
135+
136+
cd "$ROOT_DIR"
137+
138+
# Find directories containing a .github folder and store them in the array, excluding the current directory
139+
while IFS= read -r dir; do
140+
# Check if the directory is not the current directory
141+
if [[ "$dir" != "." ]]; then
142+
repo_dirs+=("$dir")
143+
fi
144+
done < <(find . -type d -name .github | awk -F'/[^/]*$' '{print $1}')
145+
146+
# Iterate through the directories and call the function for each
147+
for dir in "${repo_dirs[@]}"; do
148+
get_repo_and_branch_info "$dir"
149+
done
150+
;;
151+
*) ;;
152152
esac

scripts/sdk-doctor/_version.sh

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18-
ROOT_DIR=$(realpath $(dirname "$0")/../..)
19-
cd $ROOT_DIR
18+
ROOT_DIR=$(realpath "$(dirname "$0")"/../..)
19+
cd "$ROOT_DIR"
2020

21-
SPEC_VERSION=$(head -n 1 $ROOT_DIR/SPECIFICATION_VERSION)
22-
SPEC_SHA=$(head -n 1 $ROOT_DIR/data_model/spec_sha)
23-
SCRAPPER_VERSION=$(head -n 1 $ROOT_DIR/data_model/scraper_version)
21+
SPEC_VERSION=$(head -n 1 "$ROOT_DIR"/SPECIFICATION_VERSION)
22+
SPEC_SHA=$(head -n 1 "$ROOT_DIR"/data_model/spec_sha)
23+
SCRAPPER_VERSION=$(head -n 1 "$ROOT_DIR"/data_model/scraper_version)
2424

25-
echo 'SPEC VERSION:' $SPEC_VERSION
26-
echo 'SPEC SHA:' $SPEC_SHA
27-
echo 'SCRAPER VERSION:' $SCRAPPER_VERSION
25+
echo 'SPEC VERSION:' "$SPEC_VERSION"
26+
echo 'SPEC SHA:' "$SPEC_SHA"
27+
echo 'SCRAPER VERSION:' "$SCRAPPER_VERSION"

scripts/sdk-doctor/sdk-doctor.sh

+23-23
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@
5454
echo "$date_string"
5555
echo
5656

57-
ROOT_DIR=$(realpath $(dirname "$0")/../..)
57+
ROOT_DIR=$(realpath "$(dirname "$0")"/../..)
5858
TH_DEV_SCRIPTS_DIR=$ROOT_DIR/scripts/sdk-doctor
59-
cd $ROOT_DIR
59+
cd "$ROOT_DIR"
6060

6161
# Check for arguments
6262
if [ "$#" -gt 1 ]; then
@@ -79,7 +79,7 @@
7979
max_line_length=$((width - 6)) # Maximum characters in a line before wrapping
8080

8181
# Word-wrap the input text
82-
input_text_wrapped=$(echo -e "$input_text" | fold -w $max_line_length -s)
82+
input_text_wrapped=$(echo -e "$input_text" | fold -w "$max_line_length" -s)
8383

8484
# Calculate height based on the number of lines in the input text
8585
height=$(echo -e "$input_text_wrapped" | wc -l)
@@ -88,26 +88,26 @@
8888
# Print the top border with title
8989
title_with_padding=" $title "
9090
title_padding_left=$(((width - 2 - ${#title_with_padding}) / 2))
91-
[ $title_padding_left -lt 0 ] && title_padding_left=0
91+
[ "$title_padding_left" -lt 0 ] && title_padding_left=0
9292
title_padding_right=$((width - 2 - ${#title_with_padding} - title_padding_left))
93-
[ $title_padding_right -lt 0 ] && title_padding_right=0
94-
echo '+'$(printf "%0.s-" $(seq 1 $title_padding_left))"$title_with_padding"$(printf "%0.s-" $(seq 1 $title_padding_right))'+'
93+
[ "$title_padding_right" -lt 0 ] && title_padding_right=0
94+
echo '+'"$(printf "%0.s-" "$(seq 1 "$title_padding_left")")$title_with_padding""$(printf "%0.s-" "$(seq 1 "$title_padding_right")")"'+'
9595

9696
# Inner top padding
97-
echo "|$(printf ' %.0s' $(seq 1 $((width - 2))))|"
97+
echo "|$(printf ' %.0s' "$(seq 1 $((width - 2)))")|"
9898

9999
# Print each line of wrapped input text with frame borders and padding
100100
echo -e "$input_text_wrapped" | while IFS= read -r line; do
101101
padding_right=$((width - 4 - ${#line} - 2)) # Subtract 4 for the borders and 2 for the left padding
102-
[ $padding_right -lt 0 ] && padding_right=0
103-
echo "| $line$(printf ' %.0s' $(seq 1 $padding_right)) |"
102+
[ "$padding_right" -lt 0 ] && padding_right=0
103+
echo "| $line$(printf ' %.0s' "$(seq 1 "$padding_right")") |"
104104
done
105105

106106
# Inner bottom padding
107-
echo "|$(printf ' %.0s' $(seq 1 $((width - 2))))|"
107+
echo "|$(printf ' %.0s' "$(seq 1 $((width - 2)))")|"
108108

109109
# Print the bottom border
110-
echo '+'$(printf "%0.s-" $(seq 1 $((width - 2))))'+'
110+
echo '+'"$(printf "%0.s-" "$(seq 1 $((width - 2)))")"'+'
111111
echo
112112
}
113113

@@ -136,18 +136,18 @@
136136

137137
# Handle arguments
138138
case "$1" in
139-
--system)
140-
show_system
141-
usage
142-
;;
143-
--complete)
144-
show_system
145-
usage
146-
;;
147-
*)
148-
usage
149-
exit 1
150-
;;
139+
--system)
140+
show_system
141+
usage
142+
;;
143+
--complete)
144+
show_system
145+
usage
146+
;;
147+
*)
148+
usage
149+
exit 1
150+
;;
151151
esac
152152

153153
} 2>&1 | tee sdk-doctor.txt

0 commit comments

Comments
 (0)