mirror of
				https://github.com/mitchell/dotfiles.git
				synced 2025-11-03 21:25:26 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			51 lines
		
	
	
		
			1 KiB
		
	
	
	
		
			Fish
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1 KiB
		
	
	
	
		
			Fish
		
	
	
		
			Executable file
		
	
	
	
	
#!/usr/bin/env fish
 | 
						|
 | 
						|
echo 'Syncing configuration files to your home dir...'
 | 
						|
 | 
						|
set_color grey
 | 
						|
 | 
						|
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
 | 
						|
 | 
						|
rsync -aP ./.config/fish ~/.config/
 | 
						|
rsync -aP ./.gitconfig ~/
 | 
						|
rsync -aP ./.tmux* ~/
 | 
						|
rsync -aP ./.vim* ~/
 | 
						|
rsync -aP ./.ideavimrc ~/
 | 
						|
 | 
						|
echo
 | 
						|
fisher
 | 
						|
 | 
						|
set_color normal
 | 
						|
 | 
						|
 | 
						|
set -l prompt 'Would you like to set your git user name and email?'
 | 
						|
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'
 | 
						|
   set -l name (read -P 'name: ')
 | 
						|
 | 
						|
   git config --global user.name $name
 | 
						|
 | 
						|
   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.'
 |