--- a/ldcheck.py Mon Jun 24 00:54:24 2019 +0300 +++ b/ldcheck.py Mon Jun 24 01:01:45 2019 +0300 @@ -102,12 +102,16 @@ help = 'finds a primitive by name and prints out in which ' 'dimensions it is flat in', ) + parser.add_argument('--description', + action = 'store_true', + help = 'finds a primitive by name and prints out its description', + ) args = parser.parse_args() config = load_config('ldcheck.cfg') for ldconfig_ldr_path in find_ldconfig_ldr_paths(config): with ldconfig_ldr_path.open() as ldconfig_ldr: load_colours(ldconfig_ldr) - if args.flatness: + if args.flatness or args.description: import filecache cache = filecache.SubfileCache( ldraw_directories = config['libraries'], @@ -115,7 +119,7 @@ subfile = cache.prepare_file(args.filename) if not subfile.valid: print(subfile.problem) - else: + elif args.flatness: if subfile.flatness: print(str.format( 'Flatness: {}', @@ -123,6 +127,8 @@ )) else: print('File is not flat in any dimensions') + elif args.description: + print('Description:', repr(subfile.description)) else: with open(args.filename) as file: from os.path import basename