Skip to content

Instantly share code, notes, and snippets.

@dfdgsdfg
Created April 28, 2016 10:01
Show Gist options
  • Save dfdgsdfg/a050a0e5a716b469d6066bed5a3bcf4f to your computer and use it in GitHub Desktop.
Save dfdgsdfg/a050a0e5a716b469d6066bed5a3bcf4f to your computer and use it in GitHub Desktop.
noob_question.fish
function uppdate -d "Swiss knife for package update."
set -g global_package_managers "brew" "npm" "pyenv_pip" "gem" "composer" "fisher" "nvim_plug"
switch "$argv[1]"
case \*
check global
update global
end
function brew
set -g brew_exists "false"
set -l manager "brew"
switch $argv
case check
if exists brew
set brew_exists "true"
echo "$manager exists"
else
echo "$manager does not exist"
end
case update
command brew update; brew upgrade; brew cleanup
end
end
function check
echo "================= check - is package managers are exists or not"
switch $argv
case global
for manager in $global_package_managers
eval $manager "check"
end
# case local
end
end
function update
echo "================= update"
switch $argv
case global
for manager in $global_package_managers
// What should I do?
if test "$manager"_exist = "true"
eval $manager "update"
end
end
# case local
end
end
function exists
command type -t $argv > /dev/null 2>&1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment