Skip to content

Commit

Permalink
history output tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcmicu committed Oct 13, 2024
1 parent 78ade3e commit 4ec4240
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ build = "build.rs"
lalrpop = { version = "0.19.9", features = ["lexer"] }

[dependencies]
ansi_term = "0.12"
anyhow = "1.0"
async-std = { version = "1", features = [ "attributes" ] }
async-recursion = "1.0"
Expand Down
13 changes: 7 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod tests;

use crate::tests::{run_api_tests, run_dt_hierarchy_tests};
use ansi_term::Style;
use anyhow::Result;
use clap::{ArgAction, Parser, Subcommand};
use futures::{executor::block_on, TryStreamExt};
Expand Down Expand Up @@ -789,7 +790,7 @@ async fn main() -> Result<()> {
};
if next_redo != 0 {
let last_undo = convert_undo_or_redo_record_to_change(&redo_history[0])?;
println!("+ {}", last_undo.message);
println!(" {} {}", last_undo.history_id, last_undo.message);
};

let undo_history = valve.get_changes_to_undo(0).await?;
Expand All @@ -799,12 +800,12 @@ async fn main() -> Result<()> {
};

for undo in &undo_history {
let marker = if undo.history_id == next_undo {
"* "
if undo.history_id == next_undo {
let line = format!("▼ {} {}", undo.history_id, undo.message);
println!("{}", Style::new().bold().paint(line));
} else {
" "
};
println!("{}{} {}", marker, undo.history_id, undo.message);
println!(" {} {}", undo.history_id, undo.message);
}
}
}
Commands::Load { initial_load } => {
Expand Down

0 comments on commit 4ec4240

Please sign in to comment.