mirror of
https://github.com/mrfluffy-dev/kami.git
synced 2026-01-17 12:50:32 +00:00
(feat) Soft wrap text with fold
This commit is contained in:
@@ -1,11 +1,20 @@
|
|||||||
use std::io::Result;
|
use std::io::Result;
|
||||||
use std::process::{Command, ExitStatus};
|
use std::process::{Command, ExitStatus, Stdio};
|
||||||
|
|
||||||
pub fn open_bat() -> Result<ExitStatus> {
|
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")
|
Command::new("bat")
|
||||||
.arg("--paging")
|
.arg("--paging")
|
||||||
.arg("always")
|
.arg("always")
|
||||||
.arg("/tmp/log_e")
|
.stdin(soft_wrap.stdout.unwrap())
|
||||||
.spawn()?
|
.spawn()?
|
||||||
.wait()
|
.wait()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user