@@ -271,6 +271,8 @@ def validate_formats(ctx, param, value):
271271@click .option ('-i' , '--info' , is_flag = True , default = False , help = 'Include information such as size, type, etc.' )
272272@click .option ('--license-score' , is_flag = False , default = 0 , type = int , show_default = True ,
273273 help = 'Do not return license matches with scores lower than this score. A number between 0 and 100.' )
274+ @click .option ('--license-text' , is_flag = True , default = False ,
275+ help = 'Include the detected licenses matched text. Has no effect unless --license is requested.' )
274276
275277@click .option ('-f' , '--format' , is_flag = False , default = 'json' , show_default = True , metavar = '<style>' ,
276278 help = ('Set <output_file> format <style> to one of the standard formats: %s '
@@ -289,14 +291,14 @@ def validate_formats(ctx, param, value):
289291@click .option ('--max-memory' , is_flag = False , default = DEFAULT_MAX_MEMORY , type = int , show_default = True , help = 'Stop scanning a file if scanning requires more than a maximum amount of memory in megabytes.' )
290292
291293def scancode (ctx , input , output_file , copyright , license , package ,
292- email , url , info , license_score , format ,
294+ email , url , info , license_score , license_text , format ,
293295 verbose , quiet , processes ,
294296 diag , timeout , max_memory ,
295297 * args , ** kwargs ):
296298 """scan the <input> file or directory for origin clues and license and save results to the <output_file>.
297299
298300 The scan results are printed to stdout if <output_file> is not provided.
299- Error and progress is printed to stderr.
301+ Error and progress is printed to stderr.
300302 """
301303 possible_scans = [copyright , license , package , email , url , info ]
302304 # Default scan when no options is provided
@@ -307,9 +309,22 @@ def scancode(ctx, input, output_file, copyright, license, package,
307309
308310 scans_cache_class = get_scans_cache_class ()
309311 try :
310- files_count , results = scan (input , copyright , license , package , email , url , info , license_score ,
311- verbose , quiet , processes , scans_cache_class ,
312- diag , timeout , max_memory )
312+ files_count , results = scan (input_path = input ,
313+ copyright = copyright ,
314+ license = license ,
315+ package = package ,
316+ email = email ,
317+ url = url ,
318+ info = info ,
319+ license_score = license_score ,
320+ license_text = license_text ,
321+ verbose = verbose ,
322+ quiet = quiet ,
323+ processes = processes ,
324+ timeout = timeout , max_memory = max_memory ,
325+ diag = diag ,
326+ scans_cache_class = scans_cache_class ,
327+ )
313328 if not quiet :
314329 echo_stderr ('Saving results.' , fg = 'green' )
315330 save_results (files_count , results , format , input , output_file )
@@ -323,10 +338,14 @@ def scancode(ctx, input, output_file, copyright, license, package,
323338 # ctx.exit(rc)
324339
325340
326- def scan (input_path , copyright = True , license = True , package = True ,
327- email = False , url = False , info = True , license_score = 0 ,
328- verbose = False , quiet = False , processes = 1 , scans_cache_class = None ,
329- diag = False , timeout = DEFAULT_TIMEOUT , max_memory = DEFAULT_MAX_MEMORY ):
341+ def scan (input_path ,
342+ copyright = True , license = True , package = True ,
343+ email = False , url = False , info = True ,
344+ license_score = 0 , license_text = False ,
345+ verbose = False , quiet = False ,
346+ processes = 1 , timeout = DEFAULT_TIMEOUT , max_memory = DEFAULT_MAX_MEMORY ,
347+ diag = False ,
348+ scans_cache_class = None ):
330349 """
331350 Return a tuple of (file_count, indexing_time, scan_results) where
332351 scan_results is an iterable. Run each requested scan proper: each individual file
@@ -337,7 +356,7 @@ def scan(input_path, copyright=True, license=True, package=True,
337356 scan_summary = OrderedDict ()
338357 scan_summary ['scanned_path' ] = input_path
339358 scan_summary ['processes' ] = processes
340- get_licenses_with_score = partial (get_licenses , min_score = license_score , diag = diag )
359+ get_licenses_with_score = partial (get_licenses , min_score = license_score , include_text = license_text , diag = diag )
341360
342361 # note: "flag and function" expressions return the function if flag is True
343362 # note: the order of the scans matters to show things in logical order
0 commit comments