summaryrefslogtreecommitdiffstats
path: root/src/parse.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-11-13 16:58:50 -0500
committerJesse Luehrs <doy@tozt.net>2021-11-13 16:58:50 -0500
commitc5515216780c4c34914ac6086bb51298a3c44513 (patch)
treef099e583b0d851ff4536c9b350f09898cf2b27fe /src/parse.rs
parent60c974b28c514f179477710810e263fabf206c89 (diff)
downloadnbsh-c5515216780c4c34914ac6086bb51298a3c44513.tar.gz
nbsh-c5515216780c4c34914ac6086bb51298a3c44513.zip
refactor
Diffstat (limited to 'src/parse.rs')
-rw-r--r--src/parse.rs8
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(),
+ )
+}