-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.sh
28 lines (22 loc) · 768 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# Alias for the json tool, ensure it points to the correct installation path
alias json=./node_modules/.bin/json
# File path to the manifest.json file
MANIFEST_FILE="manifest.json"
# Function to check the description length
check_description_length() {
# Extracting the description field from the manifest.json file
description=$(json description < "$MANIFEST_FILE")
# Calculate the length of the description
len=${#description}
# Check if the description length is greater than 132 characters
if [ "$len" -gt 132 ]; then
echo $len characters
echo -e "\e[31mError: The description field exceeds 132 characters.\e[0m"
exit 1
else
exit 0
fi
}
# Run the check
check_description_length