1
0
mirror of https://github.com/jht5945/finding.git synced 2025-12-27 13:20:03 +08:00

add get_term_width

This commit is contained in:
2019-07-23 01:07:58 +08:00
parent bf5e2eee35
commit 7172d3cdc6
2 changed files with 9 additions and 0 deletions

View File

@@ -6,4 +6,5 @@ edition = "2018"
[dependencies]
argparse = "0.2.2"
term_size = "0.3.1"
rust_util = { git = "https://github.com/jht5945/rust_util" }

View File

@@ -1,4 +1,5 @@
extern crate argparse;
extern crate term_size;
extern crate rust_util;
use std::{
@@ -53,6 +54,13 @@ fn find_huge_files(huge_file_size: &String, dir_path: &Path) {
print_lastline("");
}
fn get_term_width() -> Option<usize> {
match term_size::dimensions() {
None => None,
Some((w, _h)) => Some(w),
}
}
fn main() {
let mut version = false;
let mut target = String::from("text");