Increase speed by using shell-words instead of shellwords
This commit is contained in:
parent
6745a8ad5b
commit
b875e09927
11
Cargo.lock
generated
11
Cargo.lock
generated
@ -128,7 +128,7 @@ dependencies = [
|
|||||||
name = "kakplugin"
|
name = "kakplugin"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"shellwords",
|
"shell-words",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -143,7 +143,6 @@ dependencies = [
|
|||||||
"linked_hash_set",
|
"linked_hash_set",
|
||||||
"rand",
|
"rand",
|
||||||
"regex",
|
"regex",
|
||||||
"shellwords",
|
|
||||||
"strum",
|
"strum",
|
||||||
"strum_macros",
|
"strum_macros",
|
||||||
]
|
]
|
||||||
@ -292,14 +291,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf"
|
checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "shellwords"
|
name = "shell-words"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89e515aa4699a88148ed5ef96413ceef0048ce95b43fbc955a33bde0a70fcae6"
|
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
|
||||||
dependencies = [
|
|
||||||
"lazy_static",
|
|
||||||
"regex",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
|
@ -35,7 +35,7 @@ regex = "1"
|
|||||||
clap = {version = "3", features = ["derive", "env"]}
|
clap = {version = "3", features = ["derive", "env"]}
|
||||||
alphanumeric-sort = "1"
|
alphanumeric-sort = "1"
|
||||||
# shellwords = {version = "1", path = "../../../git/rust-shellwords/"}
|
# shellwords = {version = "1", path = "../../../git/rust-shellwords/"}
|
||||||
shellwords = "1"
|
# shellwords = "1"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
evalexpr = "7"
|
evalexpr = "7"
|
||||||
kakplugin = {path = "./kakplugin/"}
|
kakplugin = {path = "./kakplugin/"}
|
||||||
|
@ -6,4 +6,4 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
shellwords = "1"
|
shell-words = "1"
|
||||||
|
@ -68,8 +68,8 @@ impl From<std::io::Error> for KakError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<shellwords::MismatchedQuotes> for KakError {
|
impl From<shell_words::ParseError> for KakError {
|
||||||
fn from(e: shellwords::MismatchedQuotes) -> Self {
|
fn from(e: shell_words::ParseError) -> Self {
|
||||||
Self::Parse(format!("Shell could not be parsed: {e:?}"))
|
Self::Parse(format!("Shell could not be parsed: {e:?}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
mod errors;
|
mod errors;
|
||||||
pub mod types;
|
pub mod types;
|
||||||
pub use errors::KakError;
|
pub use errors::KakError;
|
||||||
|
pub use shell_words::ParseError;
|
||||||
use std::{
|
use std::{
|
||||||
env,
|
env,
|
||||||
fs::{self, File, OpenOptions},
|
fs::{self, File, OpenOptions},
|
||||||
@ -225,7 +226,7 @@ where
|
|||||||
),
|
),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(shellwords::split(&fs::read_to_string(&get_var(
|
Ok(shell_words::split(&fs::read_to_string(&get_var(
|
||||||
"kak_response_fifo",
|
"kak_response_fifo",
|
||||||
)?)?)?)
|
)?)?)?)
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@ impl From<&str> for KakMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<shellwords::MismatchedQuotes> for KakMessage {
|
impl From<kakplugin::ParseError> for KakMessage {
|
||||||
fn from(err: shellwords::MismatchedQuotes) -> Self {
|
fn from(err: kakplugin::ParseError) -> Self {
|
||||||
Self("Corrupt kak response".to_string(), Some(err.to_string()))
|
Self("Corrupt kak response".to_string(), Some(err.to_string()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user