From ae3d0197e6bf02a1ba8a35ebb15f9101484f6b7c Mon Sep 17 00:00:00 2001 From: Marley Rae Date: Mon, 29 Jan 2024 21:20:47 -0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=20Make=20OS=20update=20op?= =?UTF-8?q?t-in?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fish/.config/fish/functions/up.fish.symlink | 22 ++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/fish/.config/fish/functions/up.fish.symlink b/fish/.config/fish/functions/up.fish.symlink index 01f08e5..3543846 100644 --- a/fish/.config/fish/functions/up.fish.symlink +++ b/fish/.config/fish/functions/up.fish.symlink @@ -3,16 +3,28 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function up -d "Update all software across all package managers" - brew update && brew upgrade && brew cleanup - npm install npm -g && npm update -g + argparse 'h/help' 'o/update-os' -- $argv + or return - if command -v gem &>/dev/null - sudo gem update --system && sudo gem update && sudo gem cleanup + if set -q _flag_h + printf '%b' \ + "Update all software across all package managers, and " \ + "optionally the OS itself on macOS.\n" \ + "\n" \ + "Options:\n" \ + "-h|--help: Show this help message.\n" \ + "-o|--update-os: Update macOS, using softwareupdate. Has no effect on " \ + "Linux.\n" + + return end - if [ "$(uname)" = "Darwin" ] + if set -q _flag_o && [ "$(uname)" = "Darwin" ] sudo softwareupdate --install --all else if [ "$(uname)" = "Linux" ] sudo apt update && sudo apt upgrade end + + brew update && brew upgrade && brew cleanup + npm install npm -g && npm update -g end