feat(Bash): support bash

This commit is contained in:
2026-04-03 16:15:31 +08:00
parent e384a4ad0c
commit d6e7b8b81f
13 changed files with 409 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
pj_starship() {
local config_file_dir
config_file_dir="$(dirname "$BASH_POLYJUICE_STARSHIP_CONFIG_FILE")"
case "$1" in
list)
ls "$config_file_dir"
;;
set)
local target
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."
return 1
fi
;;
reset)
export STARSHIP_CONFIG="$BASH_POLYJUICE_STARSHIP_CONFIG_FILE"
;;
*)
echo "Usage: pj_starship <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 Starship to the default polyjuice configuration."
return 1
;;
esac
}