chore: get rid of pre-0.2.0 helper scripts (-> catppuccin/toolbox)

pull/1/head
winston 2 years ago
parent 8527ff6288
commit 88ad633a6b
No known key found for this signature in database
GPG Key ID: 3786770EDBC2B481

@ -1,14 +0,0 @@
LOG_INFO=$(shell date +"%H:%M:%S") \e[0;34mINFO\e[0m
LOG_ERROR=$(shell date +"%H:%M:%S") \e[1;31mERROR\e[0m
LOG_WARNING=$(shell date +"%H:%M:%S") \e[0;33mWARNING\e[0m
LOG_SUCCESS=$(shell date +"%H:%M:%S") \e[0;32mSUCCESS\e[0m
ROOT_DIR=$(shell git rev-parse --show-toplevel)
dest=/usr/local/bin
export ROOT_DIR
link:
@echo -e "$(LOG_INFO) Linking Catppuccin's resources..."
@for file in * ; do [[ $$file != "Makefile" ]] && [[ $$file != "README.md" ]] && { parsed="$${file/'.sh'/''}" ; echo -e "$(LOG_WARNING) Creating symlink for $${parsed}" ; ln -s $(ROOT_DIR)/resources/$$file $(dest)/$$parsed ; } done
@echo -e "$(LOG_SUCCESS) Finished linking resources 🥳"

@ -1,11 +0,0 @@
# 🦆 Resources
There are small resource scripts usually used by port maintainers to perform automatically several manual tasks.
## Install
You can create symlinks from these scripts to your local bin directory by running:
```bash
make link # dest=/usr/local/bin
```

@ -1,88 +0,0 @@
#!/bin/bash
# ---------- sys ---------
lowercase=false
file=""
prefix=""
this_script=$(basename "$0")
script_help=$( cat << EOF
This script updates colors from Catppuccin v0.1.1 to v0.1.2
You can find previous versions of this script in each release.
Usages:
#0: ${this_script} <flag> [arg]
Flags:
-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
)
declare -A colors=(
# <old> -> new
["C6AAE8"]='DDB6F2' # mauve
["E5B4E2"]='F5C2E7' # pink
["E49CB3"]='E8A2AF' # maroon
["E38C8F"]='F28FAD' # red
["F7BE95"]='F8BD96' # peach
["ECDDAA"]='FAE3B0' # yellow
["B1E1A6"]='ABE9B3' # green
["B7E5E6"]='B5E8E0' # teal
["A3B9EF"]='96CDFB' # blue
["92D2E8"]='89DCEB' # sky
["15121C"]='131020' # black0
["1B1923"]='1A1823' # black1
["1E1E28"]='1E1D2F' # black2
["332E41"]='302D41' # black3
["DFDEF1"]='D9E0EE' # white
)
function update_colors() {
capitalization_char='\U' # uppercase
[[ $lowercase == true ]] && {
capitalization_char='\L' # lowercase
}
for clr in "${!colors[@]}"; do
echo -e " + ${clr} -> ${colors[$clr]}"
sed -i "s/${clr}/${prefix}${capitalization_char}${colors[$clr]}/gI" "$file"
done
}
main() {
if [[ ! "$#" -gt 0 ]]; then
echo -e "INFO: Please provide the file you want to update to Catppuccin v0.1.1"
else
while [ "$1" != "" ]; do
case $1 in
-f | --file)
file=$2
shift
;;
-l | --lowercase)
lowercase=true
;;
-p | --prefix)
prefix=$2
shift
;;
-h | --help)
echo "$script_help"
;;
*)
echo "ERROR: command ($1) not recognized"
;;
esac
shift
done
[[ -f $file ]] && {
echo -e "INFO: Updating colors..."
update_colors "${1}"
} || echo "ERROR: File ${1} does not exist"
fi
}
main "$@"

@ -1,18 +0,0 @@
#!/bin/bash
# update the years in the licenses
old_year="2021"
new_year="2022"
replace_str="s/${old_year}/${new_year}/g"
echo -e "\t---- Updating licenses ----\n"
for file in *; do
[[ -d ${file} ]] && {
[[ -f ${file}/LICENSE ]] && {
echo -e " + Updating \e[0;32m${file}/LICENSE\e[0m..."
grep -rl 2021 "${file}/LICENSE" | xargs sed -i ${replace_str}
}
}
done

@ -1,109 +0,0 @@
#!/bin/bash
# ----- M E O W ----- #
# -------------------- #
BIN_NAME=$(basename "$0")
COMMAND_NAME=$1
COMMAND_ARGS=$2
esc=""
reset="${esc}[0m"
# ----- print kitty ----- #
sub_print() {
local CATLINE1=" /| 、 "
local CATLINE2="(°、 。 7 "
local CATLINE3=" |、 ~ヽ "
local CATLINE4=" じしf_,) "
case $COMMAND_ARGS in
# print coloured version based on input
'-c' | '--colour' | '--color')
echo
echo -e "\033[${2}m$CATLINE1"
echo -e "\033[${2}m$CATLINE2"
echo -e "\033[${2}m$CATLINE3"
echo -e "\033[${2}m$CATLINE4"
echo
;;
# gae af. <3
'-p' | '--pride')
echo -e "\033[0;41m "
echo -e "\033[1m\033[0;103m \033[30m $CATLINE1"
echo -e "\033[1m\033[1;43m \033[30m $CATLINE2"
echo -e "\033[1m\033[0;42m \033[30m $CATLINE3"
echo -e "\033[1m\033[0;44m \033[30m $CATLINE4"
echo -e "\033[0;45m "
;;
# just the regular kitty
*)
echo
echo "$CATLINE1"
echo "$CATLINE2"
echo "$CATLINE3"
echo "$CATLINE4"
echo
;;
esac
echo "${reset}"
}
# ----- print help ----- #
sub_help() {
echo "Usage: $BIN_NAME <command>"
echo
echo "Commands:"
echo " print Prints the default Kitty art (Default)"
echo " --pride Prints a proud Kitty"
echo " --colour <id> Prints a coloured Kitty"
echo -e " Colours: \033[30m30 \033[31m31 \033[93m93 \033[32m32 \033[33m33 \033[34m34 \033[35m35 \033[36m36\033[39m"
echo " source Link to the Github Repos"
echo " help This help message"
}
# ----- link source ----- #
sub_source() {
echo "Catpuccin: https://github.com/catppuccin/catppuccin"
echo "This Script: https://github.com/catppuccin/catppuccin/blob/main/resources/meow"
}
# ----- command handler ----- #
case $COMMAND_NAME in
# print kitty by default
"")
sub_print
;;
# make help available via flags
"-h" | "--help")
sub_help
;;
# parse whatever command
*)
shift
sub_${COMMAND_NAME} $@
if [ $? = 127 ]; then
echo "'$COMMAND_NAME' is not a known command or has errors." >&2
sub_help
exit 1
fi
;;
esac

@ -1,267 +0,0 @@
#!/bin/bash
# ---- sys
NC=" \033[0m"
coerce=false
lowercase=false
file=""
prefix=""
original_palette=""
verbosity=0
script_help=$(
cat <<EOF
Generate missing Catppuccin palettes from a base file (e.g. generate a dawn.conf & a dusk.conf from a storm.conf file)
Usages:
#0: $(basename "$0") <flag> [arg]
Flags:
-f, --file specify file (mandatory)
-v, --verbose increase verbosity by 1
-o, --original-palette the palette used in the based file (given by --file)
-l, --lowercase replaces with lowercased hex codes
-c, --coerce force the creation of new palette files (useful when those files already exist)
-p, --prefix specify which prefix to use for the hex codes. Surround it with double quotes if needed.
-h, --help see this message
EOF
)
palette_names=(
storm
dusk
dawn
)
declare -A dusk=(
[white]='C6D0F5'
[peach]='FAB387'
[gray2]='ADB5D8'
[black0]='101019'
[black1]='181825'
[gray1]='959BBA'
[blue]='90C1FB'
[green]='A6E3A1'
[sapphire]='74C7EC'
[black3]='323044'
[black4]='4B4B62'
[black5]='63657F'
[teal]='94E2D5'
[gray0]='7C809D'
[rosewater]='F5E0DC'
[maroon]='EBA0AC'
[lavender]='C9CBFF'
[yellow]='F9E2AF'
[flamingo]='F2CDCD'
[sky]='89DCEB'
[mauve]='CBA6F7'
[black2]='1E1E2E'
[pink]='F5C2E7'
[red]='F38BA8'
)
declare -A storm=(
[white]='C5CFF5'
[sapphire]='34C3DC'
[pink]='F5BFE7'
[rosewater]='F5DFDA'
[black2]='24273A'
[flamingo]='F2CBCB'
[red]='F67E98'
[maroon]='F1949B'
[peach]='FEA571'
[black1]='1F2233'
[sky]='89DCFD'
[gray1]='8289AA'
[lavender]='C2CBFE'
[black3]='2B3045'
[green]='A1DF8E'
[black4]='3E435E'
[yellow]='F1D8A4'
[gray2]='A6AFD2'
[blue]='83ABF9'
[black0]='1A1B26'
[gray0]='5F6587'
[teal]='85E0D1'
[black5]='4F5473'
[mauve]='C59FF6'
)
declare -A dawn=(
[black4]='CCC9D1'
[peach]='FE640B'
[black3]='E6E3E5'
[pink]='EC83D0'
[black0]='D3D0D2'
[black1]='EDEDED'
[blue]='1D65F5'
[lavender]='7287FD'
[mauve]='822FEE'
[black5]='B5B1BF'
[maroon]='E63B4A'
[rosewater]='DC907F'
[green]='40A02B'
[gray1]='86819C'
[black2]='FBF8F4'
[white]='575279'
[gray2]='6E6A8B'
[sky]='04A5E5'
[sapphire]='209FB5'
[red]='BB0D33'
[teal]='179299'
[gray0]='9D99AE'
[flamingo]='DD7878'
[yellow]='E49320'
)
function prompt() {
local type=${1} # error, success, warning, info
local message=${2}
local modifiers=${3}
case ${type} in
"-e" | "--error")
printf "\033[0;31m${modifiers}ERROR: %s${NC}\n" "${message}"
;;
"-s" | "--success")
printf "\033[0;32m${modifiers}SUCCESS: %s${NC}\n" "${message}"
;;
"-w" | "--warning")
printf "\033[0;33m${modifiers}WARNING: %s${NC}\n" "${message}"
;;
*)
if [[ $1 == "-i" || $1 == "--info" ]]; then
type="${message}"
message=${modifiers}
fi
printf "\033[0;34m${message}INFO: %s${NC}\n" "${type}"
;;
esac
}
function verbose_print() {
# $1 = message
# $2 = modifiers
if [[ $verbosity -gt 0 ]]; then
printf "\033[3;29m${2}%s${NC}\n" "${1}"
fi
}
function make_capitalization_char() {
capitalization_char='\U' # uppercase
[[ $lowercase == true ]] && {
capitalization_char='\L' # lowercase
}
}
function generate_palettes() {
new_array=()
for val in "${palette_names[@]}"; do
[[ "$val" != "$original_palette" ]] && new_array+=("$val")
done
palette_names=("${new_array[@]}")
unset new_array
for palette in "${palette_names[@]}"; do
printf " GENERATING: \033[3;32m%s${NC}\n" "$palette"
local dest_file="${palette}.${file##*.}"
prompt -w "creating $dest_file..." "\t• "
if [[ -f $dest_file ]]; then
if [[ ! $coerce == true ]]; then
prompt -e "file '$dest_file' already exists. Use --coerce to force it's replacement" "\t• "
exit 1
fi
fi
cp "$file" "$dest_file"
prompt -i "replacing colors..." "\t• "
for clr in "${!storm[@]}"; do
local curr_color=$(eval "echo \${${original_palette}[$clr]}")
local dest_color=$(eval "echo \${${palette}[${clr}]}")
verbose_print "modifying ${clr}" "\t + "
sed -i "s/${curr_color}/${prefix}${capitalization_char}${dest_color}/gI" "$dest_file"
done
done
}
function detect_original_palette() {
prompt -w "detecting palette..."
original_palette=""
for palette in "${palette_names[@]}"; do
for clr in "${!storm[@]}"; do
if grep --ignore-case -q $(eval "echo \${${palette}[${clr}]}") "$file"; then
original_palette=$palette
break 2
fi
done
done
if [[ $original_palette == "" ]]; then
prompt -e "couldn't detect the original palette"
exit 1
else
prompt -s "detected '$original_palette'"
fi
}
main() {
if [[ ! "$#" -gt 0 ]]; then
prompt -e "you must provide at least the file you want to generate the missing palettes from"
else
local help_used=false
while [ "$1" != "" ]; do
case $1 in
-v | --verbose)
verbosity=$((verbosity + 1))
;;
-f | --file)
file=$2
shift
;;
-o | --original-palette)
original_palette=$2
shift
;;
-l | --lowercase)
lowercase=true
;;
-c | --coerce)
coerce=true
;;
-p | --prefix)
prefix=$2
shift
;;
-h | --help)
help_used=true
echo "$script_help"
;;
*)
echo "ERROR: command ($1) not recognized"
;;
esac
shift
done
if [[ $help_used != "true" ]]; then
if [[ $file != "" ]]; then
[[ -f $file ]] && {
prompt "updating colors..."
make_capitalization_char
if [[ $original_palette != "storm" && $original_palette != "dusk" && $original_palette != "dawn" ]]; then
detect_original_palette
fi
generate_palettes
} || prompt -e "file ${1} does not exist"
else
prompt -e "please profive a file to use a base using the --file flag"
fi
fi
fi
}
main "$@"

@ -1,90 +0,0 @@
#!/bin/bash
blue='\033[0;34m'
cyan='\033[0;36m'
nc="\033[0m" # no color
HELP=$(
cat <<EOF
This script helps one check if the remotes have had any changes and do something about it.
Useful if one has a bunch of repos.
Usages:
#0: ${0} <flag(s)>
Arguments:
-h,--help,-?,? See this message.
-v,--verbose Print verbose output in case remotes have had changes.
-p,--pull Pull all changes from all remotes (if any).
-f,--force Force pull.
EOF
)
function parse_args() {
while [[ $# -gt 0 ]]; do
case "${1}" in
-v | --verbose)
verbose=true
shift 1
;;
-p | --pull)
pull=true
shift 1
;;
-f | --force)
force=true
shift 1
;;
-h | --help | -? | ?)
printf "%s\n" "$HELP"
exit 0
;;
*)
printf "Try '%s --help' for more information\n" "${0}"
exit 1
;;
esac
done
}
function perform() {
for file in *; do
[[ -d ${file} ]] && {
printf "${blue}Checking ${cyan}%s${nc}...\t\t" "${file}"
diff_sum="$(git -C ${file} diff --compact-summary origin/main)"
[[ ${?} == 0 ]] && {
state="🟢"
if [[ ${diff_sum} != "" ]]; then
state="🔴"
if [[ ${verbose} == "true" ]]; then state="\\n${diff_sum}"; fi
fi
printf "${state}\n"
[[ ${pull} == "true" ]] && {
if [[ $(git -C ${file} status --porcelain) ]]; then
if [[ "force" == "true" ]]; then
printf "\n-->Force pulling updates...\n"
git -C "${file}" fetch --all
git -C "${file}" reset --hard
else
printf "\n-->Pulling updates...\n"
git -C "${file}" pull --all
fi
fi
}
}
}
done
}
main() {
if [[ "$#" -gt 0 ]]; then
parse_args "$@"
fi
perform
}
main "$@"
Loading…
Cancel
Save