fixed quotations error

This commit is contained in:
ronny abraham 2025-05-05 16:36:51 +03:00
parent 110da95872
commit b5eb0d339d
2 changed files with 8 additions and 4 deletions

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
#config_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" #config_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
config_dir="$HOME/.config/prompt-theme/" config_dir="$HOME/.config/prompt-theme"
config_file="$config_dir/config.yaml" config_file="$config_dir/config.yaml"
shell_colors="$config_dir/dircolors" shell_colors="$config_dir/dircolors"
@ -19,7 +19,7 @@ fi
# If no theme given, attempt to get it from config # If no theme given, attempt to get it from config
if [[ -z "$theme" && -f "$config_file" ]]; then if [[ -z "$theme" && -f "$config_file" ]]; then
theme=$(yq '.default' "$config_file") theme=$(yq -r '.default' "$config_file")
fi fi
# Fail silently if no theme could be determined # Fail silently if no theme could be determined
@ -46,6 +46,10 @@ else
fi fi
fi fi
echo "shell_colors: $shell_colors"
echo "theme: $theme"
echo "dir_colors_cmd: $dircolors_cmd"
# Apply dircolors theme or fallback # Apply dircolors theme or fallback
if [[ -r "$shell_colors/$theme" ]]; then if [[ -r "$shell_colors/$theme" ]]; then
eval "$($dircolors_cmd -b "$shell_colors/$theme")" eval "$($dircolors_cmd -b "$shell_colors/$theme")"
@ -57,7 +61,7 @@ fi
# get prompt from config.yaml if available # get prompt from config.yaml if available
if [[ -f "$config_file" ]]; then if [[ -f "$config_file" ]]; then
prompt=$(yq ".prompts.$theme" "$config_file") prompt=$(yq -r ".prompts.$theme" "$config_file")
else else
prompt="" prompt=""
fi fi

View file

@ -1,4 +1,4 @@
default: bone default: nature
prompts: prompts:
default: '\[\033[01;34m\]\u@\h \[\033[01;32m\]\w\[\033[00m\] \$ ' default: '\[\033[01;34m\]\u@\h \[\033[01;32m\]\w\[\033[00m\] \$ '