| 279 | class SingleRowTable(object): |
| 280 | @staticmethod |
| 281 | def note_box(entity, limit): |
| 282 | if limit <= 0: |
| 283 | return None |
| 284 | elif limit == 1: |
| 285 | |
| 286 | if entity == "inquiries": |
| 287 | entity = "inquiry" |
| 288 | else: |
| 289 | entity = entity[:-1] |
| 290 | |
| 291 | message = ( |
| 292 | "Note: Only one %s is displayed. Use -n/--last flag for more results." |
| 293 | % entity |
| 294 | ) |
| 295 | else: |
| 296 | message = ( |
| 297 | "Note: Only first %s %s are displayed. Use -n/--last flag for more results." |
| 298 | % (limit, entity) |
| 299 | ) |
| 300 | # adding default padding |
| 301 | message_length = len(message) + 3 |
| 302 | m = MultiColumnTable() |
| 303 | if m.table_width > message_length: |
| 304 | note = PrettyTable( |
| 305 | [""], right_padding_width=(m.table_width - message_length) |
| 306 | ) |
| 307 | else: |
| 308 | note = PrettyTable([""]) |
| 309 | note.header = False |
| 310 | note.add_row([message]) |
| 311 | sys.stderr.write((str(note) + "\n")) |
| 312 | return |