Files
TerminalPolyjuice/zsh/functions/config_starship.sh
2026-01-26 14:25:36 +08:00

28 lines
1.0 KiB
Bash

function starship_polyjuice() {
local config_file_dir="$(dirname "$ZSH_POLYJUICE_STARSHIP_CONFIG_FILE")"
case "$1" in
list)
ls $config_file_dir
;;
set)
local _target="$config_file_dir/starship_$2.toml"
if [ -f "$_target" ]; then
export STARSHIP_CONFIG=$_target
echo "Starship config set to '$_target'"
else
echo "Config '$_target' does not exist."
fi
;;
reset)
export STARSHIP_CONFIG="$ZSH_POLYJUICE_STARSHIP_CONFIG_FILE"
;;
*)
echo "Usage: starship_polyjuice <command> [args]"
echo "Commands:"
echo " list List available Starship configs in the polyjuice directory."
echo " set <name> Select a config by base name (omit the .toml extension)."
echo " reset Reset the Starship configuration to the default polyjuice configuration."
;;
esac
}