Skip to content

Commit b6d91ef

Browse files
authored
. (#2)
Co-authored-by: Okinea Dev <[email protected]>
1 parent 28cc28a commit b6d91ef

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cli-tips.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ if [ ! -n "$TIPS_FOLDER" ]; then
2020
TIPS_FOLDER="$prefix/share/cli-tips"
2121
fi
2222

23+
SYSTEM_LANGUAGE="$(echo "$LANG" | cut -d'_' -f1)"
24+
2325
# Default language is based on the user's environment
2426
if [ ! -n "$TIPS_LANGUAGE" ]; then
25-
LANGUAGE="$(echo "$LANG" | cut -d'_' -f1)"
27+
LANGUAGE="$SYSTEM_LANGUAGE"
2628
else
2729
LANGUAGE="$TIPS_LANGUAGE"
2830
fi
@@ -56,6 +58,10 @@ while [[ "$#" -gt 0 ]]; do
5658
case $1 in
5759
-l | --language | --lang)
5860
LANGUAGE="$2"
61+
if [[ ! -n "$LANGUAGE" ]]; then
62+
echo "Error: No language specified"
63+
exit 1
64+
fi
5965
shift
6066
;;
6167
--language=* | --lang=*)
@@ -77,6 +83,11 @@ while [[ "$#" -gt 0 ]]; do
7783
shift
7884
done
7985

86+
if [[ ! -n "$LANGUAGE" ]]; then
87+
echo "Error: No language specified"
88+
exit 1
89+
fi
90+
8091
# Find the localized tips file
8192
if [ -f "$TIPS_FOLDER/${LANGUAGE}.txt" ]; then
8293
localized_file="$TIPS_FOLDER/${LANGUAGE}.txt"

0 commit comments

Comments
 (0)