(feat) Soft wrap text with fold

This commit is contained in:
newbee1905
2022-07-12 12:55:35 +07:00
parent 2478802e21
commit 62288ea334

View File

@@ -1,11 +1,20 @@
use std::io::Result;
use std::process::{Command, ExitStatus};
use std::process::{Command, ExitStatus, Stdio};
pub fn open_bat() -> Result<ExitStatus> {
let soft_wrap = match Command::new("fold")
.arg("-s")
.arg("/tmp/log_e")
.stdout(Stdio::piped())
.spawn()
{
Err(why) => panic!("couldn't spawn wc: {}", why),
Ok(soft_wrap) => soft_wrap,
};
Command::new("bat")
.arg("--paging")
.arg("always")
.arg("/tmp/log_e")
.stdin(soft_wrap.stdout.unwrap())
.spawn()?
.wait()
}