Specifies how query output is handled
(self, output)
| 378 | return output |
| 379 | |
| 380 | def _output_query(self, output): |
| 381 | """ Specifies how query output is handled """ |
| 382 | if self.interactive_mode: |
| 383 | click.echo_via_pager('\n'.join(output)) |
| 384 | else: |
| 385 | if self.output_file: |
| 386 | try: |
| 387 | with open(self.output_file, 'w', encoding='utf-8') as f: |
| 388 | click.echo('\n'.join(output), file=f) |
| 389 | except IOError as e: |
| 390 | click.secho(str(e), err=True, fg='red') |
| 391 | sys.exit(1) |
| 392 | else: |
| 393 | click.echo('\n'.join(output)) |
| 394 | |
| 395 | def run(self): |
| 396 | """ Spins up CLI. """ |