feat(Bash): support bash
This commit is contained in:
26
bash/functions/check.sh
Normal file
26
bash/functions/check.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
pj_check() {
|
||||
local missing=0
|
||||
local cmd
|
||||
|
||||
for cmd in zoxide fzf starship python3 jq; do
|
||||
if ! command -v "$cmd" >/dev/null 2>&1; then
|
||||
echo "$cmd is not installed."
|
||||
missing=1
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$missing" -eq 0 ]]; then
|
||||
echo "All core tools are available."
|
||||
fi
|
||||
}
|
||||
|
||||
pj_check_tools() {
|
||||
local cmd
|
||||
for cmd in git python cargo verilator iverilog javac sbt; do
|
||||
if ! command -v "$cmd" >/dev/null 2>&1; then
|
||||
echo "$cmd is not installed."
|
||||
fi
|
||||
done
|
||||
}
|
||||
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