feat: specify custome prefix (-p <>) with the color updater script

pull/1/head
Pocco81 3 years ago
parent f4821dcef2
commit 04e7138be2

@ -3,6 +3,7 @@
# ---------- sys ---------
lowercase=false
file=""
prefix=""
this_script=$(basename "$0")
script_help=$( cat << EOF
@ -13,7 +14,8 @@ Usages:
Flags:
-f, --file specify file (mandatory)
-l, --lowercase replaces with lowercased hex code
-l, --lowercase replaces with lowercased hex codes
-p, --prefix specify which prefix to use for the hex codes. Surround it with double quotes if needed.
-h, --help see this message
EOF
)
@ -39,7 +41,7 @@ function update_colors() {
}
for clr in "${!colors[@]}"; do
echo -e " + ${clr} -> ${colors[$clr]}"
sed -i "s/${clr}/${capitalization_char}${colors[$clr]}/gI" "$file"
sed -i "s/${clr}/${prefix}${capitalization_char}${colors[$clr]}/gI" "$file"
done
}
@ -55,6 +57,10 @@ main() {
;;
-l | --lowercase)
lowercase=true
;;
-p | --prefix)
prefix=$2
shift
;;
-h | --help)
echo "$script_help"

Loading…
Cancel
Save