update check functions
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
function startship_polyjuice() {
|
||||
if [ ! -n "${STARSHIP_CONFIG_FILE}" ]; then
|
||||
if [ ! -n "${ZSH_POLYJUICE_STARSHIP_CONFIG_FILE}" ]; then
|
||||
echo "STARSHIP_CONFIG_FILE is not set. Please source `\$HOME/.zshrc` first."
|
||||
return
|
||||
fi
|
||||
starship_config_file="$HOME/.config/starship.toml"
|
||||
if [ -f $starship_config_file ]; then
|
||||
if $(file "$starship_config_file" | grep -q "symbolic link") ; then
|
||||
if [[ $(readlink "$starship_config_file") != $(realpath "$STARSHIP_CONFIG_FILE") ]]; then
|
||||
ln -sf "$STARSHIP_CONFIG_FILE" "$starship_config_file"
|
||||
if [[ $(readlink "$starship_config_file") != $(realpath "$ZSH_POLYJUICE_STARSHIP_CONFIG_FILE") ]]; then
|
||||
ln -sf "$ZSH_POLYJUICE_STARSHIP_CONFIG_FILE" "$starship_config_file"
|
||||
fi
|
||||
else
|
||||
if [ ! -f "$starship_config_file.bkp" ]; then
|
||||
mv "$starship_config_file" "$starship_config_file.bkp"
|
||||
ln -s "$STARSHIP_CONFIG_FILE" "$starship_config_file"
|
||||
ln -s "$ZSH_POLYJUICE_STARSHIP_CONFIG_FILE" "$starship_config_file"
|
||||
else
|
||||
echo "Backup file already exists. Please remove $starship_config_file.bkp and try again."
|
||||
return
|
||||
fi
|
||||
fi
|
||||
else
|
||||
ln -sf "$STARSHIP_CONFIG_FILE" "$starship_config_file"
|
||||
ln -sf "$ZSH_POLYJUICE_STARSHIP_CONFIG_FILE" "$starship_config_file"
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user