Modify sync to be able to run standalone or in repo

Modify README to reflect changes to sync
This commit is contained in:
Mitchell Simon 2019-08-17 12:19:04 -04:00
parent 02025ce81c
commit a015e6af8d
2 changed files with 31 additions and 16 deletions

View File

@ -15,15 +15,16 @@ Installation dependencies:
- git
- fish
- rsync (for sync script)
- curl (for fisher pkg manager)
- curl
To install all of the configurations:
To install from fish shell: `curl https://raw.githubusercontent.com/mitchell/dotfiles/master/sync | .`
To install all of the configuration from bash and then change default shell:
1. Clone this repo with the `--recurse-submodules` flag.
1. `cd` into your clone and run the `sync` script (requires fish be installed).
1. If you haven't already either run `fish` or change your default shell by appending the result of
`which fish` to `/etc/shells` and running `chsh -s /path/to/fish yourusername`, then restarting
the terminal.
1. Once using fish run `fisher` to install all fish plugins.
1. Enjoy!
Dependencies for fish aliases:

40
sync
View File

@ -2,34 +2,48 @@
echo 'Syncing configuration files to your home dir...'
set_color brgrey
set -l fwd (pwd)
set -l cwd (string match -r '\w+$' $fwd)
if test ! "$cwd" = 'dotfiles'
cd /var/tmp
git clone --recurse-submodules https://github.com/mitchell/dotfiles.git
cd ./dotfiles
echo
end
if ! test -e ~/.config; mkdir ~/.config; end
set_color brgrey
rsync -aP ./.config/fish ~/.config/
rsync -aP ./.gitconfig ~/
rsync -aP ./.tmux* ~/
rsync -aP ./.vim* ~/
set_color normal
echo
echo
fisher
set_color normal
set -l prompt 'Would you like to set your git user name and email?'
read -l -p "set_color red; printf '\n$prompt (Y/n) '; set_color normal" set_git_user
set -l set_git_user (read -p "set_color red; printf '\n$prompt (Y/n) '; set_color normal")
if test -z "$set_git_user"; or test $set_git_user = 'y'; or test $set_git_user = 'Y'
read -l -P 'name: ' first_name last_name
set -l full_name $first_name
if test -z "$set_git_user"; or test "$set_git_user" = 'y'; or test "$set_git_user" = 'Y'
set -l name (read -P 'name: ')
if test -n "$last_name"
set full_name "$full_name $last_name"
end
git config --global user.name $name
git config --global user.name $full_name
read -l -P 'email: ' email
set -l email (read -P 'email: ')
git config --global user.email $email
end
if test ! "$cwd" = 'dotfiles'
cd ..
rm -rf ./dotfiles
cd $fwd
end
echo -s \n 'Done syncing.'