diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-11-13 16:58:50 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-11-13 16:58:50 -0500 |
commit | c5515216780c4c34914ac6086bb51298a3c44513 (patch) | |
tree | f099e583b0d851ff4536c9b350f09898cf2b27fe /src/parse.rs | |
parent | 60c974b28c514f179477710810e263fabf206c89 (diff) | |
download | nbsh-c5515216780c4c34914ac6086bb51298a3c44513.tar.gz nbsh-c5515216780c4c34914ac6086bb51298a3c44513.zip |
refactor
Diffstat (limited to 'src/parse.rs')
-rw-r--r-- | src/parse.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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(), + ) +} |