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"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"shellwords",
|
||||
"shell-words",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -143,7 +143,6 @@ dependencies = [
|
||||
"linked_hash_set",
|
||||
"rand",
|
||||
"regex",
|
||||
"shellwords",
|
||||
"strum",
|
||||
"strum_macros",
|
||||
]
|
||||
@ -292,14 +291,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf"
|
||||
|
||||
[[package]]
|
||||
name = "shellwords"
|
||||
name = "shell-words"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89e515aa4699a88148ed5ef96413ceef0048ce95b43fbc955a33bde0a70fcae6"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"regex",
|
||||
]
|
||||
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
|
@ -35,7 +35,7 @@ regex = "1"
|
||||
clap = {version = "3", features = ["derive", "env"]}
|
||||
alphanumeric-sort = "1"
|
||||
# shellwords = {version = "1", path = "../../../git/rust-shellwords/"}
|
||||
shellwords = "1"
|
||||
# shellwords = "1"
|
||||
rand = "0.8"
|
||||
evalexpr = "7"
|
||||
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
|
||||
|
||||
[dependencies]
|
||||
shellwords = "1"
|
||||
shell-words = "1"
|
||||
|
@ -68,8 +68,8 @@ impl From<std::io::Error> for KakError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<shellwords::MismatchedQuotes> for KakError {
|
||||
fn from(e: shellwords::MismatchedQuotes) -> Self {
|
||||
impl From<shell_words::ParseError> for KakError {
|
||||
fn from(e: shell_words::ParseError) -> Self {
|
||||
Self::Parse(format!("Shell could not be parsed: {e:?}"))
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
mod errors;
|
||||
pub mod types;
|
||||
pub use errors::KakError;
|
||||
pub use shell_words::ParseError;
|
||||
use std::{
|
||||
env,
|
||||
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",
|
||||
)?)?)?)
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ impl From<&str> for KakMessage {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<shellwords::MismatchedQuotes> for KakMessage {
|
||||
fn from(err: shellwords::MismatchedQuotes) -> Self {
|
||||
impl From<kakplugin::ParseError> for KakMessage {
|
||||
fn from(err: kakplugin::ParseError) -> Self {
|
||||
Self("Corrupt kak response".to_string(), Some(err.to_string()))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user