Pretty-prints the names and indices of all columns to a file-like object (usually sys.stdout).
(self)
| 433 | return rows, column_names, column_ids |
| 434 | |
| 435 | def print_column_names(self): |
| 436 | """ |
| 437 | Pretty-prints the names and indices of all columns to a file-like object (usually sys.stdout). |
| 438 | """ |
| 439 | if getattr(self.args, 'no_header_row', None): |
| 440 | raise RequiredHeaderError('You cannot use --no-header-row with the -n or --names options.') |
| 441 | |
| 442 | if getattr(self.args, 'zero_based', None): |
| 443 | start = 0 |
| 444 | else: |
| 445 | start = 1 |
| 446 | |
| 447 | rows = agate.csv.reader(self.skip_lines(), **self.reader_kwargs) |
| 448 | column_names = next(rows) |
| 449 | |
| 450 | for i, c in enumerate(column_names, start): |
| 451 | self.output_file.write('%3i: %s\n' % (i, c)) |
| 452 | |
| 453 | def additional_input_expected(self): |
| 454 | return isatty(sys.stdin) and not self.args.input_path |
no test coverage detected