From aeb29a9ebce88a8d4f9b156f50386c2e0e8dfc76 Mon Sep 17 00:00:00 2001 From: Kamil Winczek Date: Thu, 3 Oct 2013 15:51:18 +0100 Subject: [PATCH] Add ablity to retrieve repositores owned by organization. --- github-backup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/github-backup.py b/github-backup.py index ae95f33..8657663 100755 --- a/github-backup.py +++ b/github-backup.py @@ -30,7 +30,11 @@ def main(): gh = Github(**config) # Get all of the given user's repos - user_repos = gh.repos.list().all() + if args.organization: + user_repos = gh.repos.list_by_org(args.organization).all() + else: + user_repos = gh.repos.list().all() + for repo in user_repos: repo.user = gh.users.get(repo.owner.login) process_repo(repo, args) @@ -50,6 +54,7 @@ def init_parser(): parser.add_argument("-g","--git", help="Pass extra arguments to git", default="", metavar="ARGS") parser.add_argument("-s", "--suffix", help="Add suffix to repository directory names", default="") parser.add_argument("-p", "--password", help="Authenticate with Github API") + parser.add_argument("-o","--organization", help="Backup Organizational repositories") return parser