mirror of
https://github.com/sajenim/rush.git
synced 2025-06-28 09:54:21 +08:00
use shlex to mimic POSIX shell
This commit is contained in:
parent
4eddaade35
commit
40d73ecac0
3 changed files with 12 additions and 2 deletions
9
Cargo.lock
generated
9
Cargo.lock
generated
|
@ -5,3 +5,12 @@ version = 4
|
|||
[[package]]
|
||||
name = "rush"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
|
|
@ -4,3 +4,4 @@ version = "0.1.0"
|
|||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
shlex = "1.3.0"
|
||||
|
|
|
@ -16,8 +16,8 @@ pub fn get_input() -> String {
|
|||
input
|
||||
}
|
||||
|
||||
pub fn parse_input(s: &str) -> Vec<&str> {
|
||||
s.split_whitespace().collect()
|
||||
pub fn parse_input(s: &str) -> Vec<String> {
|
||||
shlex::split(s).unwrap()
|
||||
}
|
||||
|
||||
pub fn get_command(tokens: Vec<&str>) -> &str {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue