ldcheck.py

changeset 92
b8d72909d593
parent 85
4438502fd3e0
child 94
109fb7cf658f
--- a/ldcheck.py	Mon Jun 24 11:48:52 2019 +0300
+++ b/ldcheck.py	Mon Jun 24 17:31:47 2019 +0300
@@ -97,21 +97,16 @@
         help = 'parses the part file and prints it back out, used for '
             'testing whether the program interprets part files correctly',
     )
-    parser.add_argument('--flatness',
+    parser.add_argument('--subfile',
         action = 'store_true',
-        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',
+        help = 'finds a subfile by name and prints out information about it'
     )
     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 or args.description:
+    if args.subfile:
         import filecache
         cache = filecache.SubfileCache(
             ldraw_directories = config['libraries'],
@@ -119,16 +114,10 @@
         subfile = cache.prepare_file(args.filename)
         if not subfile.valid:
             print(subfile.problem)
-        elif args.flatness:
-            if subfile.flatness:
-                print(str.format(
-                    'Flatness: {}',
-                    ', '.join(subfile.flatness),
-                ))
-            else:
-                print('File is not flat in any dimensions')
-        elif args.description:
+        else:
+            print('Flat dimensions:', repr(subfile.flatness))
             print('Description:', repr(subfile.description))
+            print('Contains studs:', repr(subfile.has_studs))
     else:
         with open(args.filename) as file:
             from os.path import basename

mercurial