(self)
| 37 | help='After cutting, delete rows which are completely empty.') |
| 38 | |
| 39 | def main(self): |
| 40 | if self.args.names_only: |
| 41 | self.print_column_names() |
| 42 | return |
| 43 | |
| 44 | if self.additional_input_expected(): |
| 45 | sys.stderr.write('No input file or piped data provided. Waiting for standard input:\n') |
| 46 | |
| 47 | rows, column_names, column_ids = self.get_rows_and_column_names_and_column_ids(**self.reader_kwargs) |
| 48 | |
| 49 | output = agate.csv.writer(self.output_file, **self.writer_kwargs) |
| 50 | output.writerow([column_names[column_id] for column_id in column_ids]) |
| 51 | |
| 52 | for row in rows: |
| 53 | out_row = [row[column_id] if column_id < len(row) else None for column_id in column_ids] |
| 54 | |
| 55 | if not self.args.delete_empty or any(out_row): |
| 56 | output.writerow(out_row) |
| 57 | |
| 58 | |
| 59 | def launch_new_instance(): |
nothing calls this directly
no test coverage detected