From b7184ce25e2ef5a39f2f00d9cbacbf4d72892e85 Mon Sep 17 00:00:00 2001 From: jakobst1n Date: Tue, 11 Jun 2024 22:18:33 +0200 Subject: Implement keep_tail, fix refactor typo --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index a8a2786..35ca9f7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,8 +28,11 @@ fn filter(opts: Opts) { let mut gb = graph::GraphBuilder::new(&x_values, &y_values, opts.width, opts.height); gb.axis(opts.axis); gb.graph_type(opts.graph_type.clone()); + if let Some(n) = opts.last_n { + gb.keep_tail(n as usize); + } - print!("\x1B[2J\x1B[H"); + //print!("\x1B[2J\x1B[H"); println!("{}", gb.build()); } @@ -57,6 +60,9 @@ fn graph_file(opts: Opts) { let mut gb = graph::GraphBuilder::new(&x_values, &y_values, opts.width, opts.height); gb.axis(opts.axis); gb.graph_type(opts.graph_type); + if let Some(n) = opts.last_n { + gb.keep_tail(n as usize); + } println!("{}", gb.build()); } -- cgit v1.2.3