mirror of
https://github.com/jht5945/rust_util.git
synced 2025-12-30 00:50:05 +08:00
add split_kv
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rust_util"
|
name = "rust_util"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Hatter's Rust Util"
|
description = "Hatter's Rust Util"
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ pub mod util_os;
|
|||||||
pub mod util_env;
|
pub mod util_env;
|
||||||
pub mod util_cmd;
|
pub mod util_cmd;
|
||||||
pub mod util_msg;
|
pub mod util_msg;
|
||||||
|
pub mod util_str;
|
||||||
pub mod util_size;
|
pub mod util_size;
|
||||||
pub mod util_file;
|
pub mod util_file;
|
||||||
pub mod util_time;
|
pub mod util_time;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use std::{
|
|||||||
use super::{ XResult, new_box_ioerror, };
|
use super::{ XResult, new_box_ioerror, };
|
||||||
use super::util_size::get_display_size;
|
use super::util_size::get_display_size;
|
||||||
use super::util_msg::print_lastline;
|
use super::util_msg::print_lastline;
|
||||||
|
use super::util_file::resolve_file_path;
|
||||||
|
|
||||||
pub const DEFAULT_BUF_SIZE: usize = 8 * 1024;
|
pub const DEFAULT_BUF_SIZE: usize = 8 * 1024;
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ pub fn get_read_stdin_or_file(file: &str) -> XResult<Box<dyn Read>> {
|
|||||||
if file.is_empty() {
|
if file.is_empty() {
|
||||||
Ok(Box::new(io::stdin()))
|
Ok(Box::new(io::stdin()))
|
||||||
} else {
|
} else {
|
||||||
match File::open(file) {
|
match File::open(&resolve_file_path(file)) {
|
||||||
Ok(f) => Ok(Box::new(f)),
|
Ok(f) => Ok(Box::new(f)),
|
||||||
Err(err) => Err(new_box_ioerror(&format!("Open file {}, erorr: {}", file, err))),
|
Err(err) => Err(new_box_ioerror(&format!("Open file {}, erorr: {}", file, err))),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user