-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from felipealfonsog/development
Updates in the code for AUR and others
- Loading branch information
Showing
5 changed files
with
103 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import os | ||
|
||
def welcome(): | ||
print("Welcome to GitHub Repository Updater -GitSyncMaster-!") | ||
print("This software was developed by Computer Science Engineer Felipe Alfonso González - Github: github.com/felipealfonsog - Under the BSD 3-clause license.") | ||
print("Developed from Chile with love.") | ||
print("----------------------------------------------------") | ||
print("This software will update all GitHub repositories within the current directory or its subdirectories.") | ||
|
||
def update_github_repositories(main_directory, include_aur): | ||
print("\nUpdating GitHub repositories...\n") | ||
for root, dirs, files in os.walk(main_directory): | ||
if '.git' in dirs: | ||
git_dir = os.path.join(root, '.git') | ||
if os.path.isdir(git_dir): | ||
if include_aur or not root.endswith("-aur"): | ||
print(f"Updating repository in {root}") | ||
os.chdir(root) | ||
os.system('git pull') | ||
os.chdir(main_directory) | ||
|
||
def main(): | ||
welcome() | ||
current_directory = os.getcwd() | ||
main_directory = input(f"Current directory is: {current_directory}\nDo you want to update repositories here? (Y/N, default is Y): ") | ||
if main_directory.lower() != 'n': | ||
exclude_choice = input("Do you want to exclude directories with the '-aur' suffix? (Press Enter for Yes, N for No, default is Yes): ").lower() | ||
if exclude_choice == '' or exclude_choice == 'y': | ||
include_aur = False | ||
else: | ||
include_aur = True | ||
update_github_repositories(current_directory, include_aur) | ||
else: | ||
print("You need to be inside a directory with GitHub repositories to update them.") | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
welcome() { | ||
echo "Welcome to GitHub Repository Updater -GitSyncMaster-!" | ||
echo "This software was developed by Computer Science Engineer Felipe Alfonso González - Github: github.com/felipealfonsog - Under the BSD 3-clause license." | ||
echo "Developed from Chile with love." | ||
echo "----------------------------------------------------" | ||
echo "This software will update all GitHub repositories within the current directory or its subdirectories." | ||
} | ||
|
||
update_github_repositories() { | ||
echo -e "\nUpdating GitHub repositories...\n" | ||
for dir in "$1"/*/; do | ||
if [ -d "$dir/.git" ]; then | ||
if [ "$2" = true ] || [[ ! "$dir" =~ -aur$ ]]; then | ||
echo "Updating repository in $dir" | ||
cd "$dir" || exit | ||
git pull | ||
cd - || exit | ||
fi | ||
fi | ||
done | ||
} | ||
|
||
main() { | ||
welcome | ||
current_directory=$(pwd) | ||
read -p "Current directory is: $current_directory. Do you want to update repositories here? (Press Enter for Yes, N for No, default is Yes): " main_directory | ||
if [[ "$main_directory" == '' || "$main_directory" =~ [Yy] ]]; then | ||
read -p "Do you want to exclude directories with the '-aur' suffix? (Press Enter for Yes, N for No, default is Yes): " exclude_choice | ||
if [[ "$exclude_choice" == '' || "$exclude_choice" =~ [Yy] ]]; then | ||
include_aur=false | ||
else | ||
include_aur=true | ||
fi | ||
update_github_repositories "$current_directory" "$include_aur" | ||
else | ||
echo "You need to be inside a directory with GitHub repositories to update them." | ||
fi | ||
} | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Mantenedor: Felipe Alfonso Gonzalez <[email protected]> | ||
pkgname=gitsync | ||
pkgver=0.0.8 | ||
pkgver=0.0.9 | ||
pkgrel=1 | ||
pkgdesc="GitSyncMaster: Automate updating multiple Git repositories within a directory structure effortlessly." | ||
arch=('x86_64') | ||
|