-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy pathget_project.py
More file actions
40 lines (28 loc) · 812 Bytes
/
get_project.py
File metadata and controls
40 lines (28 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'''
Created on Nov 14, 2018
@author: gsnyder
Print a project given its name
'''
from blackduck.HubRestApi import HubInstance
import argparse
import json
parser = argparse.ArgumentParser()
link_choices = [
'versions',
'canonicalVersion',
'assignable-users',
'assignable-usergroups',
'users',
'usergroups',
'tags',
'project-mappings'
]
parser.add_argument("--limit")
parser.add_argument("project_name")
parser.add_argument("--link", default=None, choices = link_choices, help="If provided, will result in a GET on the corresponding project link")
args = parser.parse_args()
hub = HubInstance()
project = hub.get_project_by_name(args.project_name)
print(json.dumps(project, indent=4, sort_keys=True))
if args.link:
print(json.dumps(hub.get_project_info(args.project_name, args.link), indent=4))