From 643952f7c44602e734565ddb223c4bd8ae430867 Mon Sep 17 00:00:00 2001 From: Charles Gould Date: Tue, 28 Apr 2020 21:24:20 -0500 Subject: [PATCH] fish: add npm upgrade function --- fish/functions/npm_upgrade.fish | 12 ++++++++++++ fish/functions/pip_upgrade.fish | 7 +++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 fish/functions/npm_upgrade.fish diff --git a/fish/functions/npm_upgrade.fish b/fish/functions/npm_upgrade.fish new file mode 100644 index 0000000..4598b0b --- /dev/null +++ b/fish/functions/npm_upgrade.fish @@ -0,0 +1,12 @@ +function npm_upgrade --description "Upgrade npm packages" + set --local npm_pkgs_outdated (npm outdated -g --depth=0) + + if test (count $py_pkgs_outdated) = 0 + echo "All packages up-to-date." + else + echo "Outdated packages: $npm_pkgs_outdated" + if confirm + npm update -g + end + end +end diff --git a/fish/functions/pip_upgrade.fish b/fish/functions/pip_upgrade.fish index a0f8517..b3b35f8 100644 --- a/fish/functions/pip_upgrade.fish +++ b/fish/functions/pip_upgrade.fish @@ -4,8 +4,11 @@ function pip_upgrade --description "Upgrade python packages" if test (count $py_pkgs_outdated) = 0 echo "All packages up-to-date." else - for py_pkg in $py_pkgs_outdated - pip3 install $py_pkg -U + echo "Outdated packages: $py_pkgs_outdated" + if confirm + for py_pkg in $py_pkgs_outdated + pip3 install -U $py_pkg + end end end end