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

Loading…
Cancel
Save