add convenience script for local setup
This commit is contained in:
parent
b355cb8d70
commit
1f782ea45f
1 changed files with 53 additions and 0 deletions
53
local-install.fish
Normal file
53
local-install.fish
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# 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
|
||||
Loading…
Add table
Reference in a new issue