website
website copied to clipboard
check for writable files
I am using fresh to manage dotfiles. This patch will make sure the dotfile is writable before attempting to modify, and will exit with instructions for adding yarn to path if script cannot modify dotfile. I have only tested this for .bashrc on my laptop.
@Daniel15 what do you think?
I think yarn should check if write permission is granted to the profile files but I think the message should be changed a little bit (To say it doesn't have write permission instead of profile not found when it's available!)
and
if [ -z "${YARN_PROFILE-}" ] ; then
printf "$red> Profile not found. Tried ${YARN_PROFILE} (as defined in \$PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile.\n"
echo "> Create one of them and run this script again"
doesn't seem alright to me because the if
checks if the variable is empty then it tries to print it! Will discuss this in my other PR where we work on using sh
syntax. (not sure & I don't know what -
is doing in ${YARN_PROFILE-}
...)