fsh/setup.sh

34 lines
918 B
Bash
Raw Normal View History

2022-08-05 11:18:25 +00:00
#!/usr/bin/env bash
2021-11-21 19:42:14 +00:00
echo Compiling with cargo...
cargo build --release
echo Copying to $HOME/.local/bin
mkdir -p $HOME/.local/bin/
2021-11-21 19:42:14 +00:00
cp target/release/fsh $HOME/.local/bin/
2022-08-05 11:18:25 +00:00
enable_hostname="0"
while getopts "h" FLAG
do
case "${FLAG}" in
h) enable_hostname="1";;
esac
done
2021-11-21 19:42:14 +00:00
if [ ! -f $HOME/.config/fish/functions/fish_prompt.fish ]; then
mkdir -p $HOME/.config/fish/functions/
2022-08-05 11:18:25 +00:00
if [ $enable_hostname = "1" ]; then
echo "Creating $HOME/.config/fish/functions/fish_prompt.fish"
echo "function fish_prompt
set FSH_LAST_STATUS \$status
fsh \$FSH_LAST_STATUS
end" > $HOME/.config/fish/functions/fish_prompt.fish
else
echo "Creating $HOME/.config/fish/functions/fish_prompt.fish"
echo "function fish_prompt
2021-11-21 19:42:14 +00:00
set FSH_LAST_STATUS \$status
2022-08-05 11:18:25 +00:00
set -x FSH_NO_HOSTNAME 1
fsh \$FSH_LAST_STATUS
2021-11-21 19:42:14 +00:00
end" > $HOME/.config/fish/functions/fish_prompt.fish
2022-08-05 11:18:25 +00:00
fi
2021-11-21 19:42:14 +00:00
fi