diff options
-rw-r--r-- | src/history.rs | 11 | ||||
-rw-r--r-- | src/main.rs | 1 | ||||
-rw-r--r-- | src/parse.rs | 8 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/history.rs b/src/history.rs index 14e2594..4d1d453 100644 --- a/src/history.rs +++ b/src/history.rs @@ -21,7 +21,7 @@ impl History { } pub async fn run(&mut self, cmd: &str) -> anyhow::Result<usize> { - let (exe, args) = parse_cmd(cmd); + let (exe, args) = crate::parse::cmd(cmd); let mut process = async_std::process::Command::new(&exe); process.args(&args); let mut child = process @@ -364,12 +364,3 @@ impl ExitInfo { } } } - -fn parse_cmd(full_cmd: &str) -> (String, Vec<String>) { - let mut parts = full_cmd.split(' '); - let cmd = parts.next().unwrap(); - ( - cmd.to_string(), - parts.map(std::string::ToString::to_string).collect(), - ) -} diff --git a/src/main.rs b/src/main.rs index 2d7ae38..5c59f08 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,6 +7,7 @@ mod action; mod format; mod history; +mod parse; mod readline; mod state; mod util; diff --git a/src/parse.rs b/src/parse.rs new file mode 100644 index 0000000..84e8daa --- /dev/null +++ b/src/parse.rs @@ -0,0 +1,8 @@ +pub fn cmd(full_cmd: &str) -> (String, Vec<String>) { + let mut parts = full_cmd.split(' '); + let cmd = parts.next().unwrap(); + ( + cmd.to_string(), + parts.map(std::string::ToString::to_string).collect(), + ) +} |