Skip to content

Instantly share code, notes, and snippets.

@hisaac
Last active April 15, 2020 03:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hisaac/f59b19d04a1f3e4e0f2f97a9d802ed4a to your computer and use it in GitHub Desktop.
Save hisaac/f59b19d04a1f3e4e0f2f97a9d802ed4a to your computer and use it in GitHub Desktop.
Some fish shell functions that I use
# A few simple fish functions I use in my config.fish file
function gcd -d "Switches to the develop or development branch, depending on which one is used in this repo"
if git show-ref --verify --quiet refs/heads/develop
git checkout develop
else
git checkout development
end
end
# The `upd` function relies on the `pip_upgrade_outdated` python library
# https://github.com/defjaf/pip_upgrade_outdated
function upd -d "Updates Global Packages"
# Move to the home directory
pushd ~/
echo "🍺 Updating Homebrew"
brew upgrade
echo "πŸ’Ž Updating RubyGems"
gem update --system --no-document
gem update --no-document
echo "🐍 Updating pip"
pip_upgrade_outdated
echo "πŸ›’ Updating Casks"
brew cask upgrade
echo "🍏 Updating Mac App Store Apps"
mas upgrade
echo "πŸš€ Updating Global Node Modules"
npm update -g npm
npm update -g
# Move to whichever directory the script was originally run from
popd
end
function checkup -d "Checks Package Managers for Issues"
# Move to the home directory
pushd ~/
echo "🍺 Checking Homebrew"
brew doctor
echo "πŸ›’ Checking Casks"
brew cask doctor
echo "πŸ’Ž Checking RubyGems"
gem check
echo "🐍 Checking pip"
pip check
echo "πŸš€ Checking npm"
npm cache verify
# Move to whichever directory the script was originally run from
popd
end
function cleanup -d "Cleans Up Package Managers Caches"
# Move to the home directory
pushd ~/
echo "πŸΊπŸ›’ Cleaning Homebrew and Casks"
brew cleanup
echo "πŸ’Ž Cleaning RubyGems"
gem cleanup
echo "πŸš€ Cleaning npm"
npm cache clean --force
# Move to whichever directory the script was originally run from
popd
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment