@@ -128,6 +128,12 @@ def review(full_report, bare, file):
128
128
"environment variable. Default: empty" )
129
129
@click .option ("--db" , default = "" ,
130
130
help = "Path to a local license database. Default: empty" )
131
+ @click .option ("--json/--no-json" , default = False ,
132
+ help = "Output packages licenses in JSON format. Default: --no-json" )
133
+ @click .option ("--bare/--not-bare" , default = False ,
134
+ help = 'Output packages licenses names only. '
135
+ 'Useful in combination with other tools. '
136
+ 'Default: --not-bare' )
131
137
@click .option ("--cache/--no-cache" , default = True ,
132
138
help = 'Whether license database file should be cached.'
133
139
'Default: --cache' )
@@ -139,7 +145,7 @@ def review(full_report, bare, file):
139
145
help = "Proxy port number --proxy-port" )
140
146
@click .option ("proxyprotocol" , "--proxy-protocol" , "-pr" , multiple = False , type = str , default = 'http' ,
141
147
help = "Proxy protocol (https or http) --proxy-protocol" )
142
- def license (key , db , cache , files , proxyprotocol , proxyhost , proxyport ):
148
+ def license (key , db , json , bare , cache , files , proxyprotocol , proxyhost , proxyport ):
143
149
144
150
if files :
145
151
packages = list (itertools .chain .from_iterable (read_requirements (f , resolve = True ) for f in files ))
@@ -172,7 +178,12 @@ def license(key, db, cache, files, proxyprotocol, proxyhost, proxyport):
172
178
click .secho ("Unable to load licenses database" , fg = "red" , file = sys .stderr )
173
179
sys .exit (- 1 )
174
180
filtered_packages_licenses = get_packages_licenses (packages , licenses_db )
175
- output_report = license_report (packages = packages , licenses = filtered_packages_licenses )
181
+ output_report = license_report (
182
+ packages = packages ,
183
+ licenses = filtered_packages_licenses ,
184
+ json_report = json ,
185
+ bare_report = bare
186
+ )
176
187
click .secho (output_report , nl = True )
177
188
178
189
0 commit comments