NAME_ENV_DIRNAME = 'BRICKSPLOM_DIR'
NAME_ENV_LDRAW = 'LDRAW_DIR'
NAME_ENV_CONFIG = 'BRICKSPLON_CONFIG'
+ARG_CHECK = 'CHECK'
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',
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__':