assert table_name in self.lookupables
assert (not show_raw) or table_name in self.textfiled_tables()
cls = self.lookupables[table_name]
+ if match_by == '?':
+ return CHAR_NEWLINE.join(cls.matchers().keys())
+ if sort_by == '?':
+ return CHAR_NEWLINE.join(cls.sorters().keys())
table = getattr(self, table_name)
if item_id:
match_by = PARAM_Q_ID + item_id
choices=choices, type=complete, metavar='TABLE', help=msg)
parser = ArgumentParser()
add_abbreviable_table_arg()
+ hint_sortmatch = 'use "?" to see what be available for chosen table'
+ hint_raw = ('only available for tables: '
+ + ', '.join(BricksDb.textfiled_tables().keys()))
parser.add_argument(
'item_id',
nargs='?', metavar='ITEM_ID')
parser.add_argument(
'-m', '--match-by',
- action='store')
+ action='store', help=hint_sortmatch)
parser.add_argument(
'-s', '--sort-by',
- action='store', default=TOK_SORT_ID)
+ action='store', help=hint_sortmatch, default=TOK_SORT_ID)
parser.add_argument(
'-l', '--ldraw',
action='store', default='')
- hint_raw = ('only available for tables: '
- + ', '.join(BricksDb.textfiled_tables().keys()))
action_raw = parser.add_argument(
'-r', '--raw',
action='store_true', help=f'NB: {hint_raw}')