Skip to content

Commit

Permalink
feat: generate jqp theme file (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
bezhermoso authored Oct 22, 2024
1 parent 925f28e commit 60c80f5
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions hooks/tinted-jqp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

# ----------------------------------------------------------------------
# Setup config variables and env
# ----------------------------------------------------------------------
#

# Users can supply the path to where they cloned the tinted-theming/tinted-jqp repo.
# By default, we'll look for it under the tinted-theming config dir.

TINTED_JQP_PATH="${TINTED_JQP_PATH:-$BASE16_CONFIG_PATH/tinted-jqp}"

# If TINTED_HEXCHAT_PATH doesn't exist, stop hook
if [ ! -d "$TINTED_JQP_PATH" ]; then
return 2
fi

TINTED_JQP_CONFIG_FILE="${TINTED_JQP_CONFIG_FILE:-$BASE16_CONFIG_PATH/jqp_theme.yaml}"

if [[ -d "$TINTED_JQP_CONFIG_FILE" ]]; then
2>&1 echo "${TINTED_JQP_CONFIG_FILE} exists but is a directory. It should either be non-existent, or a file."
return 1
fi

if [ ! -e "$TINTED_JQP_CONFIG_FILE" ]; then
touch "$TINTED_JQP_CONFIG_FILE"
fi

# Set current theme name
read current_theme_name < "$BASE16_SHELL_THEME_NAME_PATH"

jqp_theme_path="$TINTED_JQP_PATH/themes/base16-$current_theme_name.yaml"

if [ ! -f "$jqp_theme_path" ]; then
cat <<EOF 2>&1
${current_theme_name} theme doesn't exist in tinted-jqp. Make sure you have the latest commits:
cd ${TINTED_JQP_PATH}
git pull
EOF

return 3
fi

# ----------------------------------------------------------------------
# Execution
# ----------------------------------------------------------------------

command cp -f "$jqp_theme_path" "$TINTED_JQP_CONFIG_FILE"

0 comments on commit 60c80f5

Please sign in to comment.