feat: Store dotfiles path
This commit is contained in:
parent
d03aa4c382
commit
43401eeb1e
3 changed files with 31 additions and 1 deletions
25
.local/bin/setup-dotfiles
Executable file
25
.local/bin/setup-dotfiles
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/zsh
|
||||
|
||||
printf "Experimental script! Run it anyway? (y/N) "
|
||||
read choice
|
||||
[ "$choice" = "y" ] || exit 1
|
||||
|
||||
[ ! $1 ] && >&2 echo "Usage: setup-dotfiles [PATH]" && exit 1
|
||||
|
||||
cd $1 || { >&2 echo "Invalid path" && exit 1 }
|
||||
|
||||
git status 2>/dev/null || { >&2 echo "Directory is not a git directory!" && exit 1 }
|
||||
|
||||
cat << EOF
|
||||
#!/bin/zsh
|
||||
|
||||
export DOTFILES="${PWD}"
|
||||
|
||||
[ ! \$DOTFILES ] && unset DOTFILES
|
||||
EOF
|
||||
|
||||
echo ""
|
||||
echo "##############################################################"
|
||||
echo "# Please replace ~/.config/zsh/dotfiles with the code above. #"
|
||||
echo "# TIPS: Run 'setup-dotfiles > ~/.config/zsh/dotfiles' #"
|
||||
echo "##############################################################"
|
Loading…
Add table
Add a link
Reference in a new issue