gluesql
gluesql copied to clipboard
Support `.spool FilePath` command in CLI
To resolve #747
Goal
Spool is the easiest way to export data.
gluesql> .spool query.log
gluesql> VALUES (1), (2);
╭─────────╮
│ column1 │
╞═════════╡
│ 1 │
│ 2 │
╰─────────╯
gluesql> .spool off
gluesql> .quit
$> cat query.log
╭─────────╮
│ column1 │
╞═════════╡
│ 1 │
│ 2 │
╰─────────╯
Todo
- [x] Add Command::SpoolOn, CommandError::LackOfFile
- [x] Add Command::SpoolOff
- [x] if Some(spool_file), write to spool_file whenver print payload
Q
- Should we test the contents of created spool_file ?
In Next PR
Support granular options
- set header on | off
- set tabular on | off
- set echo on | off (show executed query or not)
Pull Request Test Coverage Report for Build 2845690810
- 0 of 0 changed or added relevant lines in 0 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage increased (+0.05%) to 97.896%
| Totals | |
|---|---|
| Change from base Build 2833363350: | 0.05% |
| Covered Lines: | 29550 |
| Relevant Lines: | 30185 |
💛 - Coveralls
Should we test the contents of created spool_file ?
It would be good to have one, but currently... it is not easy to make test based on rustyline. We may need to add test using internal function.