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:
@@ -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" }
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user