devbox/local-install.fish
2026-03-29 22:16:00 -07:00

53 lines
1.7 KiB
Fish

# Install dotfiles (and optionally tools) to the current macOS host,
# for example when provisioning within a VM.
set -f DEFAULT_FULL_NAME 'Brent Schroeter'
argparse -S 'email=' 'full-name=' install-mise overwrite -- $argv
if not set -ql _flag_full_name
set -f _flag_full_name "$DEFAULT_FULL_NAME"
end
if not set -ql _flag_email
echo '--email is required for VCS configuration' >&2
return 1
end
mkdir -p ~/.config
if set -ql _flag_overwrite; or not test -e ~/.gitconfig
cp ./assets/git/gitconfig ~/.gitconfig
sed -i '' "s/{{ VCS_EMAIL }}/$_flag_email/" ~/.gitconfig
sed -i '' "s/{{ VCS_NAME }}/$_flag_full_name/" ~/.gitconfig
else
echo 'Git config already exists. Use --overwrite to replace it.' >&2
end
if set -ql _flag_overwrite; or not test -e ~/.config/jj/config.toml
mkdir -p ~/.config/jj
cp ./assets/jj/config.toml ~/.config/jj/
sed -i '' "s/{{ VCS_EMAIL }}/$_flag_email/" ~/.config/jj/config.toml
sed -i '' "s/{{ VCS_NAME }}/$_flag_full_name/" ~/.config/jj/config.toml
else
echo 'JJ config already exists. Use --overwrite to replace it.' >&2
end
if set -ql _flag_overwrite; or not test -e ~/.config/helix
if test -e ~/.config/helix
rm -r ~/.config/helix
end
cp -r ./assets/helix ~/.config/helix
else
echo 'Helix configs already exist. Use --overwrite to replace them.' >&2
end
if set -ql _flag_install_mise
brew install mise
if set -ql _flag_overwrite; or not test -e ~/.config/mise/config.toml
mkdir -p ~/.config/mise
cp ./assets/mise/config.toml ~/.config/mise/
else
echo 'Mise config already exists. Use --overwrite to replace it.' >&2
end
mise install
end