Skip to content

Commit

Permalink
feat: update insomnia installation script
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Oct 4, 2023
1 parent 690a829 commit eaa08e9
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions scripts/insomnia.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,38 @@ main_brew() {
main() {
return 0
}

main_parham() {
mkdir -p "$HOME/.config/Insomnia/" || true

if [ -d "$HOME/.config/Insomnia/version_control" ]; then
cd "$HOME/.config/Insomnia/version_control" || return

url=$(git remote get-url origin 2>/dev/null)
if [[ "$url" =~ .*github.com[:/]1995parham-me/insomnia ]]; then
msg 'valid repository, so fetching it'
git pull origin main

return 0
else
msg "invalid repository $url"

if yes_or_no "insomnia" "do you want to remove current insomnia configuration?"; then
msg 'removing current configuration to replace it with new configuration'
rm -Rf "$HOME/.config/Insomnia/version_control"
else
return 1
fi
fi
fi

if [ -e "$HOME/.config/Insomnia/version_control" ] || [ -L "$HOME/.config/Insomnia/version_control" ]; then
if yes_or_no "insomnia" "do you want to remove current insomnia configuration?"; then
msg 'removing current configuration to replace it with new configuration'
rm -Rf "$HOME/.config/Insomnia/version_control"
else
return 1
fi
fi
git clone [email protected]:1995parham-me/insomnia "$HOME/.config/Insomnia/version_control"
}

0 comments on commit eaa08e9

Please sign in to comment.