Skip to content

Commit 97203c0

Browse files
committed
ADDED: more control over provider WIP
1 parent e38d731 commit 97203c0

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

src/main.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ def parse_arguments():
105105
parser.add_argument("--exclude-gitlab",
106106
action="store_true",
107107
help="Exclude GitLab repositories from the backup.")
108+
parser.add_argument("--exclude-enterprise",
109+
action="store_true",
110+
help="Exclude \"official\" providers (github.com and gitlab.com).")
108111
# Positional argument for usernames of the profiles to scrap
109112
parser.add_argument("usernames",
110113
nargs="+",
@@ -189,10 +192,16 @@ def parse_arguments():
189192
parser.error("File " + args.json_path + " is not writable.")
190193

191194
# Check if at least one source is included
192-
if args.exclude_github and args.exclude_gitlab and not args.custom_providers:
193-
parser.error("You cannot exclude both GitHub and GitLab and not supply a custom provider. At least one provider"
194-
" must be included.")
195-
195+
if args.exclude_github and args.exclude_gitlab:
196+
parser.error("You cannot exclude both GitHub and GitLab. At least one provider must be included.")
197+
198+
if args.custom_providers:
199+
custom_providers = []
200+
for custom_provider in args.custom_providers:
201+
if args.exclude_github:
202+
custom_providers.append({'url': custom_provider, 'provider': "GitLab"})
203+
if args.exclude_gitlab:
204+
custom_providers.append({'url': custom_provider, 'provider': "GitHub"})
196205
return args
197206

198207

@@ -203,10 +212,13 @@ def print_summary(args):
203212
print(f" - {user}")
204213

205214
print("Using the following providers:")
206-
for provider in args.custom_providers:
207-
print(f" - {provider}")
208-
print(" - GitHub (github.com)")
209-
print(" - GitLab (gitlab.com)")
215+
if args.custom_providers:
216+
for provider in args.custom_providers:
217+
print(f" - {provider['provider']} ({provider['url']})")
218+
if args.exclude_gitlab:
219+
print(" - GitHub (github.com)")
220+
if args.exclude_github:
221+
print(" - GitLab (gitlab.com)")
210222

211223
if args.backup_path:
212224
print("* Backup folder: " + args.backup_path)
@@ -256,6 +268,12 @@ def print_summary(args):
256268

257269

258270
def build_model(args):
271+
272+
model = {args.backup_path: {}}
273+
274+
275+
model[args.backup_path]
276+
'''
259277
# using an access token
260278
auth = Auth.Token("access_token")
261279
@@ -273,7 +291,7 @@ def build_model(args):
273291
274292
# To close connections after use
275293
g.close()
276-
294+
'''
277295

278296
def main():
279297
args = parse_arguments()

0 commit comments

Comments
 (0)