@@ -263,9 +263,12 @@ def validate_formats(ctx, param, value):
263263@click .argument ('input' , metavar = '<input>' , type = click .Path (exists = True , readable = True ))
264264@click .argument ('output_file' , default = '-' , metavar = '<output_file>' , type = click .File ('w' , encoding = 'utf-8' ))
265265
266+ # Note that click's 'default' option is set to 'false' here despite these being documented to be enabled by default in
267+ # order to more elegantly enable all of these (see code below) if *none* of the command line options are specified.
266268@click .option ('-c' , '--copyright' , is_flag = True , default = False , help = 'Scan <input> for copyrights. [default]' )
267269@click .option ('-l' , '--license' , is_flag = True , default = False , help = 'Scan <input> for licenses. [default]' )
268270@click .option ('-p' , '--package' , is_flag = True , default = False , help = 'Scan <input> for packages. [default]' )
271+
269272@click .option ('-e' , '--email' , is_flag = True , default = False , help = 'Scan <input> for emails.' )
270273@click .option ('-u' , '--url' , is_flag = True , default = False , help = 'Scan <input> for urls.' )
271274@click .option ('-i' , '--info' , is_flag = True , default = False , help = 'Include information such as size, type, etc.' )
@@ -300,8 +303,9 @@ def scancode(ctx, input, output_file, copyright, license, package,
300303 The scan results are printed to stdout if <output_file> is not provided.
301304 Error and progress is printed to stderr.
302305 """
306+
307+ # Use default scan options when no options are provided on the command line.
303308 possible_scans = [copyright , license , package , email , url , info ]
304- # Default scan when no options is provided
305309 if not any (possible_scans ):
306310 copyright = True
307311 license = True
0 commit comments