From c80c4a7054b835a4f1ef739fef7511b9c5d0bd1f Mon Sep 17 00:00:00 2001 From: Sloane Perrault Date: Sat, 6 Aug 2022 08:20:23 -0400 Subject: [PATCH] improve brew bundle functions --- .config/fish/functions/brew-save.fish | 15 +++++++++++++++ .config/fish/functions/cask.fish | 4 ---- 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100755 .config/fish/functions/brew-save.fish delete mode 100755 .config/fish/functions/cask.fish diff --git a/.config/fish/functions/brew-save.fish b/.config/fish/functions/brew-save.fish new file mode 100755 index 0000000..e5097c4 --- /dev/null +++ b/.config/fish/functions/brew-save.fish @@ -0,0 +1,15 @@ +function brew-save -d "Install a new homebrew cask and update the global Brewfile" + set -f package $argv + if set -f info_output (brew info $package 2> /dev/null) + if echo $info_output | grep homebrew-cask &> /dev/null + set -f brewfile_keyword cask + else + set -f brewfile_keyword brew + end + echo "$brewfile_keyword \"$package\"" >> ~/.Brewfile + brew bundle --global + else + echo "package not found: $argv" + return 1 + end +end diff --git a/.config/fish/functions/cask.fish b/.config/fish/functions/cask.fish deleted file mode 100755 index 7cbff77..0000000 --- a/.config/fish/functions/cask.fish +++ /dev/null @@ -1,4 +0,0 @@ -function cask -d "Install a new homebrew cask and update the global Brewfile" - echo "cask \"$argv\"" >> ~/.Brewfile - brew bundle --global -end