From 56c1ed28cb580326a9602f639eda10c2c4b0b6ee Mon Sep 17 00:00:00 2001 From: Bruno 21 Date: Fri, 3 Aug 2018 13:40:08 +0200 Subject: [PATCH] make-brew-installer.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -ajout d’options (courtes ou longues) pour choisir quoi installer: -b (brew) -c (casks) -m (mas) --- _test/usage.sh | 31 ---------------- make-brew-installer.sh | 83 ++++++++++++++++++++++++++++++------------ 2 files changed, 60 insertions(+), 54 deletions(-) delete mode 100755 _test/usage.sh diff --git a/_test/usage.sh b/_test/usage.sh deleted file mode 100755 index f034500..0000000 --- a/_test/usage.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -help=0 -latest=0 -verbose=0 -status=0 - -usage() { - cat <<-EOF - ${0##*/} [options] - options: - -h show help dialog - -l reinstall packages with version "latest" - -v verbose output - EOF - exit "$status" -} - -for opt -do case "$opt" in - '-h') usage ;; - '-l') latest=1 ;; - '-v') verbose=1 ;; - *) status=1 usage ;; -esac -done - - -echo "toto" - -exit "$status" diff --git a/make-brew-installer.sh b/make-brew-installer.sh index 8792739..d996d94 100755 --- a/make-brew-installer.sh +++ b/make-brew-installer.sh @@ -1,17 +1,5 @@ #!/bin/bash -if [ "$1" == "-h" ]; then - echo "Create Homebrew 's packages and Casks installed list:" - echo " a brew-install.sh script is created next to this script..." - echo - echo "USAGE: brew-list [-p]" - echo - echo " -p just packages (not Casks)" - echo " -h display this help" - echo - exit 0 -fi - <> brew-install.sh -echo -e "\n# Brew tap list.\n" >> brew-install.sh -echo -e "🍺 Get Homebrew \033[3m\033[93mtap\033[0m list" -brew tap | sed -e 's/^/brew tap /' >> brew-install.sh +if [[ "$brew" -eq 1 ]] || [[ "$casks" -eq 1 ]] || [[ "$mas" -eq 1 ]]; then + echo -e "\n# Brew tap list.\n" >> brew-install.sh + echo -e "🍺 Get Homebrew \033[3m\033[93mtap\033[0m list" + brew tap | sed -e 's/^/brew tap /' >> brew-install.sh +fi -echo -e "\n# Brew packages that I use alot.\n" >> brew-install.sh -echo -e "🍺 Get Homebrew \033[3m\033[93mpackages\033[0m installed list" -brew list | sed -e 's/^/brew install /' >> brew-install.sh +if [ "$brew" -eq 1 ]; then + echo -e "\n# Brew packages that I use alot.\n" >> brew-install.sh + echo -e "🍺 Get Homebrew \033[3m\033[93mpackages\033[0m installed list" + brew list | sed -e 's/^/brew install /' >> brew-install.sh +fi -if [ "$1" != "-p" ]; then +if [ "$casks" -eq 1 ]; then echo -e "\n# Some casks packages that I like.\n" >> brew-install.sh echo -e "🍺 Get Homebrew \033[3m\033[93mCask\033[0m installed list" brew cask list | sed -e 's/^/brew cask install /' >> brew-install.sh fi -echo -e "\n# Mac App Store applications list.\n" >> brew-install.sh -echo -e "🍏 Get Mac App Store \033[3m\033[93mapplications\033[0m list" -mas list | awk '{print $1}' | sed -e 's/^/mas install /' >> brew-install.sh +# https://github.com/mas-cli/mas +if [ "$mas" -eq 1 ]; then + echo -e "\n# Mac App Store applications list.\n" >> brew-install.sh + echo -e "🍏 Get Mac App Store \033[3m\033[93mapplications\033[0m list" + mas list | awk '{print $1}' | sed -e 's/^/mas install /' >> brew-install.sh +fi chmod +x brew-install.sh