From a015e6af8d17d16a662850587300d010a8a403a2 Mon Sep 17 00:00:00 2001 From: Mitchell Simon Date: Sat, 17 Aug 2019 12:19:04 -0400 Subject: [PATCH] Modify sync to be able to run standalone or in repo Modify README to reflect changes to sync --- README.md | 7 ++++--- sync | 40 +++++++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 8dc82e2..5774a7b 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/sync b/sync index e4abb8b..1128f7d 100755 --- a/sync +++ b/sync @@ -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.'