Created
April 27, 2016 13:41
-
-
Save dfdgsdfg/d698b0d031d6d116288cc78840cb5a41 to your computer and use it in GitHub Desktop.
uppdate.fish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function uppdate -d "Swiss knife for package update." | |
set -l package_managers "brew" "npm" "pyenv_pip" "gem" "composer" "fisher" "nvim_plug" | |
set -l update_global | |
switch "$argv[1]" | |
case \* | |
update-global-package-managers | |
end | |
function exists | |
command type -t $argv > /dev/null 2>&1 | |
end | |
function update-global-package-managers | |
for manager in $package_managers | |
set update_globals $manager | |
end | |
end | |
switch "$cmd" | |
# case help | |
# case list | |
# case global | |
# case local | |
end | |
switch "$update_global" | |
case brew | |
if exists brew | |
echo "brew udpate" | |
command brew update; brew upgrade; brew cleanup | |
end | |
# case brew-cask | |
case npm | |
if exists npm | |
echo "npm update" | |
command npm -g update | |
end | |
case gem | |
if exists gem | |
command gem update | |
end | |
case pyenv-pip | |
if exists pip; and exists pyenv | |
command pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U | |
end | |
case composer | |
if exists composer | |
command composer global update | |
end | |
case fisher | |
if exists fisher | |
command fisher update | |
end | |
case nvim-plug | |
if exists nvim | |
command nvim +PlugUpdate +qall > /dev/null 2>&1 | |
end | |
end | |
switch "$update_local" | |
case npm | |
if test -f ./package.json; and exists npm | |
command composer update | |
end | |
case bower | |
if test -f ./bower; and exists bower | |
command bower update | |
end | |
case jspm | |
if test -f ./package.json; and exists jspm | |
command jspm update | |
end | |
case bundler | |
if test -f ./Gemfile; and exists bundler | |
command bundler update | |
end | |
case autoenv-pyenv-virtualenv-pip | |
if test -f ./requirement.txt; and test -f ./.env; and exists autoenv; and exists pyenv-virtualenv; and exists pip | |
command pip install --upgrade -r requirements.txt | |
end | |
case composer | |
if test -f ./composer.json; and exists composer | |
composer update | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment