mirror of
https://github.com/dchakro/alacritty_colors.git
synced 2026-05-17 10:12:17 -07:00
add flexoki, github light2, remedy, rose-pine
This commit is contained in:
parent
7c3b78606d
commit
3430c14f43
14 changed files with 249 additions and 14 deletions
|
|
@ -15,22 +15,74 @@
|
|||
# # Get yj from: https://github.com/sclevine/yj
|
||||
|
||||
# shopt -s globstar
|
||||
cd themes
|
||||
if command -v sd > /dev/null 2>&1; then
|
||||
if command -v yj > /dev/null 2>&1; then
|
||||
# For each .yaml file in the current directory
|
||||
for yaml_file in *.yml; do
|
||||
HELP()
|
||||
{
|
||||
printf 'This script allows you to covnert YAML formatted themes to TOML while changing some keywords
|
||||
to ensure compatibility with contemporary release of alacritty.
|
||||
|
||||
Usage:
|
||||
bash convert_to_toml.sh [options]
|
||||
|
||||
OPTIONS:
|
||||
--help Show help
|
||||
--dir Batch convert all files stored in themes/
|
||||
--file FILE.yaml Convert input file
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
convertDir(){
|
||||
cd themes
|
||||
if command -v sd > /dev/null 2>&1; then
|
||||
if command -v yj > /dev/null 2>&1; then
|
||||
if /bin/ls | grep -Ei "yml$" &> /dev/null ; then
|
||||
# For each .yaml file in the current directory
|
||||
for yaml_file in *.yml; do
|
||||
# Use basename to get the file name without the .yaml extension
|
||||
base_name=$(basename "$yaml_file" .yml)
|
||||
|
||||
# Convert .yaml to .toml using yj
|
||||
cat "$yaml_file" | yj -yt | sd "^.*_background.*\r?\n" "" | sd "^.*_foreground.*\r?\n" "" > "${base_name}.toml"
|
||||
done
|
||||
else
|
||||
echo "No YAML files found in ./themes/"
|
||||
fi
|
||||
else
|
||||
echo "Get yj from: https://github.com/sclevine/yj"
|
||||
fi
|
||||
else
|
||||
echo "Get sd from: https://github.com/chmln/sd"
|
||||
fi
|
||||
}
|
||||
|
||||
convertFile(){
|
||||
# checking for dependencies
|
||||
if command -v sd > /dev/null 2>&1; then
|
||||
if command -v yj > /dev/null 2>&1; then
|
||||
yaml_file=${1}
|
||||
# Use basename to get the file name without the .yaml extension
|
||||
base_name=$(basename "$yaml_file" .yml)
|
||||
|
||||
# Convert .yaml to .toml using yj
|
||||
cat "$yaml_file" | yj -yt | sd "^.*_background.*\r?\n" "" | sd "^.*_foreground.*\r?\n" "" > "${base_name}.toml"
|
||||
done
|
||||
cat "${yaml_file}" | yj -yt | sd "^.*_background.*\r?\n" "" | sd "^.*_foreground.*\r?\n" "" > "${base_name}.toml"
|
||||
else
|
||||
echo "Get yj from: https://github.com/sclevine/yj"
|
||||
fi
|
||||
else
|
||||
echo "Get yj from: https://github.com/sclevine/yj"
|
||||
echo "Get sd from: https://github.com/chmln/sd"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [ "$1" == "--help" ]; then
|
||||
HELP
|
||||
exit 0;
|
||||
elif [ "$1" == "--dir" ]; then
|
||||
convertDir
|
||||
exit 0;
|
||||
elif [ "$1" == "--file" ]; then
|
||||
convertFile $2
|
||||
exit 0;
|
||||
else
|
||||
echo "Get sd from: https://github.com/chmln/sd"
|
||||
fi
|
||||
|
||||
|
||||
HELP
|
||||
exit 0;
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue