From: Plom Heller Date: Mon, 10 Aug 2026 22:25:41 +0000 (+0200) Subject: Add check-only mode with TABLE=CHECK. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/static/foo.html?a=commitdiff_plain;h=0d5db2384651f21cfcc6de8b44c569381ee09c26;p=bricksplom Add check-only mode with TABLE=CHECK. --- diff --git a/src/run.py b/src/run.py index ce8fe2a..0e66d53 100755 --- a/src/run.py +++ b/src/run.py @@ -23,6 +23,7 @@ from bricksplom.misc import ( NAME_ENV_DIRNAME = 'BRICKSPLOM_DIR' NAME_ENV_LDRAW = 'LDRAW_DIR' NAME_ENV_CONFIG = 'BRICKSPLON_CONFIG' +ARG_CHECK = 'CHECK' def main( @@ -41,8 +42,9 @@ def main( action, f'{arg} – ambiguous, matches: {", ".join(candidates)}') return (candidates + (arg, ))[0] - choices = BricksDb.lookupables.keys() + choices = tuple(BricksDb.lookupables.keys()) + (ARG_CHECK,) msg = 'one of: ' + ', '.join(sorted(list(choices))) + msg += f' (use "{ARG_CHECK}" to only run consistency checks)' msg += '; NB: abbreviable to first unambiguous character sequence' action = parser.add_argument( 'table', @@ -87,13 +89,14 @@ def main( path_tables = environ.get(NAME_ENV_DIRNAME, config.get('path_tables', '')) path_ldraw = environ.get(NAME_ENV_LDRAW, config.get('path_ldraw', '')) db = BricksDb(path_tables, path_ldraw, args.ldraw) - print( - db.lookup( - table_name=args.table, - formatter=args.format, - match_by=args.match, - sort_by=args.sort - ).rstrip()) + if not args.table == ARG_CHECK: + print( + db.lookup( + table_name=args.table, + formatter=args.format, + match_by=args.match, + sort_by=args.sort + ).rstrip()) if __name__ == '__main__':