From 04e7138be28331af298d13bdad2b7426347c00cb Mon Sep 17 00:00:00 2001 From: Pocco81 Date: Wed, 22 Dec 2021 10:21:19 -0500 Subject: [PATCH] feat: specify custome prefix (-p <>) with the color updater script --- resources/color_updater.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/resources/color_updater.sh b/resources/color_updater.sh index b41db15..5f6d3f5 100755 --- a/resources/color_updater.sh +++ b/resources/color_updater.sh @@ -3,6 +3,7 @@ # ---------- sys --------- lowercase=false file="" +prefix="" this_script=$(basename "$0") script_help=$( cat << EOF @@ -12,9 +13,10 @@ Usages: #0: ${this_script} [arg] Flags: - -f, --file specify file (mandatory) - -l, --lowercase replaces with lowercased hex code - -h, --help see this message + -f, --file specify file (mandatory) + -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 } @@ -56,6 +58,10 @@ main() { -l | --lowercase) lowercase=true ;; + -p | --prefix) + prefix=$2 + shift + ;; -h | --help) echo "$script_help" ;;