Skip to content

Commit 753a26d

Browse files
committed
add option to exclude repositories
1 parent 63441eb commit 753a26d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ CLI Usage is as follows::
4141
[-P] [-F] [--prefer-ssh] [-v]
4242
[--keychain-name OSX_KEYCHAIN_ITEM_NAME]
4343
[--keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT]
44-
[--releases] [--assets] [--throttle-limit THROTTLE_LIMIT]
45-
[--throttle-pause THROTTLE_PAUSE]
44+
[--releases] [--assets] [--exclude [REPOSITORY [REPOSITORY ...]]
45+
[--throttle-limit THROTTLE_LIMIT] [--throttle-pause THROTTLE_PAUSE]
4646
USER
4747

4848
Backup a github account
@@ -112,6 +112,8 @@ CLI Usage is as follows::
112112
binaries
113113
--assets include assets alongside release information; only
114114
applies if including releases
115+
--exclude [REPOSITORY [REPOSITORY ...]]
116+
names of repositories to exclude from backup.
115117
--throttle-limit THROTTLE_LIMIT
116118
start throttling of GitHub API requests after this
117119
amount of API requests remain

github_backup/github_backup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ def parse_args(args=None):
324324
type=float,
325325
default=30.0,
326326
help='wait this amount of seconds when API request throttling is active (default: 30.0, requires --throttle-limit to be set)')
327+
parser.add_argument('--exclude',
328+
dest='exclude',
329+
help='names of repositories to exclude',
330+
nargs="*")
327331
return parser.parse_args(args)
328332

329333

@@ -750,6 +754,8 @@ def filter_repositories(args, unfiltered_repositories):
750754
repositories = [r for r in repositories if name_regex.match(r['name'])]
751755
if args.skip_archived:
752756
repositories = [r for r in repositories if not r.get('archived')]
757+
if args.exclude:
758+
repositories = [r for r in repositories if r['name'] not in args.exclude]
753759

754760
return repositories
755761

0 commit comments

Comments
 (0)