2021-03-31 12:15:08 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Clone or update alacritty to $HOME/dev/alacritty, build and install to $HOME/bin
|
|
|
|
# Note: run from ZSH in a different terminal emulator.
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if ! [ -x "$(command -v cargo)" ]; then
|
|
|
|
echo "Install Rust toolchain first"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p $HOME/dev $HOME/bin
|
|
|
|
destdir=$HOME/dev/alacritty
|
|
|
|
if [ -d $destdir ]; then
|
|
|
|
echo "Updating alacritty..."
|
|
|
|
cd $destdir
|
|
|
|
git pull --rebase
|
|
|
|
else
|
|
|
|
echo "Cloning alacritty..."
|
|
|
|
cd $HOME/dev
|
|
|
|
git clone -q https://github.com/alacritty/alacritty.git alacritty
|
|
|
|
fi
|
2021-04-06 15:35:06 +00:00
|
|
|
|
2021-03-31 12:15:08 +00:00
|
|
|
cd $destdir
|
|
|
|
echo "Building alacritty..."
|
2021-04-06 15:35:06 +00:00
|
|
|
if [ $(uname -s) = "Darwin" ]; then
|
|
|
|
make app
|
|
|
|
echo "To install: cp -r $destdir/target/release/osx/Alacritty.app /Applications/"
|
|
|
|
else
|
|
|
|
cargo build --release
|
|
|
|
echo "Installing alacritty..."
|
|
|
|
cp $destdir/target/release/alacritty $HOME/bin/alacritty
|
|
|
|
fi
|
2021-03-31 12:15:08 +00:00
|
|
|
|
|
|
|
if [ -z "$ZDOTDIR" ]; then
|
|
|
|
echo "WARNING: ZDOTDIR blank so not installing ZSH completions"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Installing ZSH completions..."
|
|
|
|
funcdir=$ZDOTDIR/functions
|
|
|
|
mkdir -p $funcdir
|
|
|
|
cp $destdir/extra/completions/_alacritty $funcdir/_alacritty
|
|
|
|
echo "Done"
|