Skip to content

Commit dcc90b7

Browse files
authored
Merge pull request #204 from Assimila/exclude_repositories
Add option to exclude repositories
2 parents f414fac + 753a26d commit dcc90b7

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
@@ -328,6 +328,10 @@ def parse_args(args=None):
328328
type=float,
329329
default=30.0,
330330
help='wait this amount of seconds when API request throttling is active (default: 30.0, requires --throttle-limit to be set)')
331+
parser.add_argument('--exclude',
332+
dest='exclude',
333+
help='names of repositories to exclude',
334+
nargs="*")
331335
return parser.parse_args(args)
332336

333337

@@ -753,6 +757,8 @@ def filter_repositories(args, unfiltered_repositories):
753757
repositories = [r for r in repositories if name_regex.match(r['name'])]
754758
if args.skip_archived:
755759
repositories = [r for r in repositories if not r.get('archived')]
760+
if args.exclude:
761+
repositories = [r for r in repositories if r['name'] not in args.exclude]
756762

757763
return repositories
758764

0 commit comments

Comments
 (0)