File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,12 +73,13 @@ bootstrap() {
7373usage () {
7474 cat << EOS
7575Usage: cfgmanager.sh [options]
76- --brew-bundle Update brew, install packages, upgrade packages
77- --create-links Create links to cofiguration files
78- --prune-links Prune broken links
79- --remove-links Remove all links to configuration files
80- --bootstrap Bootstrap configuration (default)
81- -h, --help Display this message
76+ --brew-bundle Update brew, install packages, upgrade packages
77+ --bundle-cleanup Uninstall all dependencies not present Brewfile
78+ --create-links Create links to cofiguration files
79+ --prune-links Prune broken links
80+ --remove-links Remove all links to configuration files
81+ --bootstrap Bootstrap configuration (default)
82+ -h, --help Display this message
8283EOS
8384}
8485
@@ -87,6 +88,10 @@ case $1 in
8788 source $DOTFILES_REPO_DIR /scripts/brew.sh
8889 brew_bundle
8990 ;;
91+ --bundle-cleanup)
92+ source $DOTFILES_REPO_DIR /scripts/brew.sh
93+ bundle_cleanup
94+ ;;
9095--create-links)
9196 source $DOTFILES_REPO_DIR /scripts/links.sh
9297 create_links
Original file line number Diff line number Diff line change 1+ abbr cmbc " cfgmanager --bundle-cleanup"
12abbr cmbb " cfgmanager --brew-bundle"
23abbr cmcl " cfgmanager --create-links"
34abbr cmpl " cfgmanager --prune-links"
Original file line number Diff line number Diff line change 55source ~ /.env || { echo " Unable to source .env" && exit 1; }
66
77if ! which brew > /dev/null; then
8- case $( uname -sm) in
9- " Darwin arm64" )
10- brew=/opt/homebrew/bin/brew
11- ;;
12- * )
13- brew=/usr/local/bin/brew
14- ;;
15- esac
8+ case $( uname -sm) in
9+ " Darwin arm64" )
10+ brew=/opt/homebrew/bin/brew
11+ ;;
12+ * )
13+ brew=/usr/local/bin/brew
14+ ;;
15+ esac
1616
17- ! [ -x $brew ] && echo " Unable to find brew" && exit 1
18- eval " $( $brew shellenv) "
17+ ! [ -x $brew ] && echo " Unable to find brew" && exit 1
18+ eval " $( $brew shellenv) "
1919fi
2020
2121case $CONFIG_ENV in
2222personal)
23- brewfile=~ /.config/Brewfile
24- ;;
23+ brewfile=~ /.config/Brewfile
24+ ;;
2525work)
26- brewfile=~ /.config/Brewfile_work
27- ;;
26+ brewfile=~ /.config/Brewfile_work
27+ ;;
2828esac
2929
3030brew_bundle () {
31- echo " Running brew bundle"
32- echo " Using brewfile: $brewfile "
33- brew update
34- brew bundle --file $brewfile --verbose --force --no-lock
31+ echo " Running brew bundle"
32+ echo " Using brewfile: $brewfile "
33+ brew update
34+ brew bundle --file $brewfile --verbose --force --no-lock
35+ }
36+
37+ bundle_cleanup () {
38+ echo " Running brew bundle cleanup"
39+ echo " Using brewfile: $brewfile "
40+ brew update
41+ brew bundle cleanup --file $brewfile --verbose --force --no-lock
3542}
You can’t perform that action at this time.
0 commit comments