Skip to content

Commit

Permalink
cli: Turn on pretty mode by default
Browse files Browse the repository at this point in the history
Fixes #929
  • Loading branch information
penberg committed Feb 8, 2025
1 parent a1a9218 commit 533305a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cli/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,17 @@ pub struct Settings {

impl From<&Opts> for Settings {
fn from(opts: &Opts) -> Self {
let is_stdout = opts.output.is_empty();
let output_mode = if opts.output_mode == OutputMode::Raw && is_stdout {
OutputMode::Pretty
} else {
opts.output_mode
};
Self {
null_value: String::new(),
output_mode: opts.output_mode,
output_mode,
echo: false,
is_stdout: opts.output.is_empty(),
is_stdout,
output_filename: opts.output.clone(),
db_file: opts
.database
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/pragma/test_pragma_stmts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ mod tests {
let mut child = spawn_command(run_cli(), Some(1000))?;
child.exp_regex("limbo>")?; // skip everything until limbo cursor appear
child.exp_regex(".?")?;
child.send_line(".mode raw")?;
child.exp_regex(".?")?;
child.send_line("pragma journal_mode;")?;
child.exp_string("wal")?;
quit(&mut child)
Expand All @@ -22,6 +24,8 @@ mod tests {
let mut child = spawn_command(run_cli(), Some(1000))?;
child.exp_regex("limbo>")?; // skip everything until limbo cursor appear
child.exp_regex(".?")?;
child.send_line(".mode raw")?;
child.exp_regex(".?")?;
child.send_line("pragma wal_checkpoint;")?;
child.exp_string("0|0|0")?;
quit(&mut child)
Expand Down

0 comments on commit 533305a

Please sign in to comment.