added git features and brew auto update
This commit is contained in:
parent
3021e5b691
commit
9c587b7fff
4 changed files with 15 additions and 4 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
__pycache__/
|
__pycache__/
|
||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
brew_lists/
|
|
||||||
poetry
|
poetry
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Default directories to store the lists
|
# Default directories to store the lists
|
||||||
BREW_LIST_DIR="$HOME/.local/bin/brew_lists"
|
BREW_LIST_DIR="$HOME/.local/bin/.brew_lists"
|
||||||
CASK_LIST_DIR="$HOME/.local/bin/brew_lists"
|
CASK_LIST_DIR="$HOME/.local/bin/.brew_lists"
|
||||||
BREW_LIST="$BREW_LIST_DIR/brew_list.txt"
|
BREW_LIST="$BREW_LIST_DIR/brew_list.txt"
|
||||||
CASK_LIST="$CASK_LIST_DIR/cask_list.txt"
|
CASK_LIST="$CASK_LIST_DIR/cask_list.txt"
|
||||||
|
|
||||||
|
|
@ -10,8 +10,10 @@ CASK_LIST="$CASK_LIST_DIR/cask_list.txt"
|
||||||
update_lists() {
|
update_lists() {
|
||||||
echo "Updating brew list..."
|
echo "Updating brew list..."
|
||||||
brew list > "$BREW_LIST"
|
brew list > "$BREW_LIST"
|
||||||
|
chmod 664 "$BREW_LIST"
|
||||||
echo "Updating cask list..."
|
echo "Updating cask list..."
|
||||||
brew list --cask > "$CASK_LIST"
|
brew list --cask > "$CASK_LIST"
|
||||||
|
chmod 664 "$CASK_LIST"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install Homebrew and packages
|
# Function to install Homebrew and packages
|
||||||
|
|
@ -48,6 +50,13 @@ save_lists() {
|
||||||
echo "Lists saved successfully."
|
echo "Lists saved successfully."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to commit changes to Git
|
||||||
|
commit_to_git() {
|
||||||
|
git add "$BREW_LIST" "$CASK_LIST"
|
||||||
|
git commit -m "Update brew lists"
|
||||||
|
git push origin main
|
||||||
|
}
|
||||||
|
|
||||||
# Check command-line arguments
|
# Check command-line arguments
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
@ -57,7 +66,7 @@ while [[ $# -gt 0 ]]; do
|
||||||
;;
|
;;
|
||||||
--save-brew-dir)
|
--save-brew-dir)
|
||||||
shift
|
shift
|
||||||
BREW_LIST_DIR="$1"
|
brew autoupdate start
|
||||||
;;
|
;;
|
||||||
--save-cask-dir)
|
--save-cask-dir)
|
||||||
shift
|
shift
|
||||||
|
|
@ -87,5 +96,8 @@ update_lists
|
||||||
if [ -s "$BREW_LIST" ] || [ -s "$CASK_LIST" ]; then
|
if [ -s "$BREW_LIST" ] || [ -s "$CASK_LIST" ]; then
|
||||||
# Lists have changed, save the updated lists
|
# Lists have changed, save the updated lists
|
||||||
save_lists
|
save_lists
|
||||||
|
|
||||||
|
# Commit changes to Git
|
||||||
|
commit_to_git
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue