feat(Bash): support bash
This commit is contained in:
34
bash/functions/starship.sh
Normal file
34
bash/functions/starship.sh
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user