aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorjakobst1n <jakob.stendahl@outlook.com>2024-06-11 22:18:33 +0200
committerjakobst1n <jakob.stendahl@outlook.com>2024-06-11 22:18:33 +0200
commitb7184ce25e2ef5a39f2f00d9cbacbf4d72892e85 (patch)
tree5254330748ca814b329059b12c0681efb4f66b11 /src/main.rs
parente1cd1e04aa1eef28fff2e1e03d3f5b3da8a93894 (diff)
downloadtextgraph-b7184ce25e2ef5a39f2f00d9cbacbf4d72892e85.tar.gz
textgraph-b7184ce25e2ef5a39f2f00d9cbacbf4d72892e85.zip
Implement keep_tail, fix refactor typo
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs8
1 files changed, 7 insertions, 1 deletions
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());
}