🚑️ shell escape
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
JMARyA 2025-04-08 16:16:19 +02:00
parent f0fb42b6f0
commit b92c2625c2
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
3 changed files with 33 additions and 31 deletions

57
Cargo.lock generated
View file

@ -70,17 +70,6 @@ version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
[[package]]
name = "bstr"
version = "1.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "531a9155a481e2ee699d4f98f43c0ca4ff8ee1bfd55c31e9e98fb29d2b176fe0"
dependencies = [
"memchr",
"regex-automata",
"serde",
]
[[package]] [[package]]
name = "byteorder" name = "byteorder"
version = "1.5.0" version = "1.5.0"
@ -166,6 +155,15 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "enquote"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06c36cb11dbde389f4096111698d8b567c0720e3452fd5ac3e6b4e47e1939932"
dependencies = [
"thiserror",
]
[[package]] [[package]]
name = "equivalent" name = "equivalent"
version = "1.0.2" version = "1.0.2"
@ -196,10 +194,10 @@ version = "0.1.1"
dependencies = [ dependencies = [
"clap", "clap",
"either", "either",
"enquote",
"inquire", "inquire",
"serde", "serde",
"serde_json", "serde_json",
"shell-quote",
"subprocess", "subprocess",
"toml", "toml",
"yansi", "yansi",
@ -355,12 +353,6 @@ dependencies = [
"bitflags 2.9.0", "bitflags 2.9.0",
] ]
[[package]]
name = "regex-automata"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.20" version = "1.0.20"
@ -414,15 +406,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "shell-quote"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb502615975ae2365825521fa1529ca7648fd03ce0b0746604e0683856ecd7e4"
dependencies = [
"bstr",
]
[[package]] [[package]]
name = "signal-hook" name = "signal-hook"
version = "0.3.17" version = "0.3.17"
@ -486,6 +469,26 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "thiserror"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "thread_local" name = "thread_local"
version = "1.1.8" version = "1.1.8"

View file

@ -6,10 +6,10 @@ edition = "2024"
[dependencies] [dependencies]
clap = { version = "4.5.26", features = ["cargo"] } clap = { version = "4.5.26", features = ["cargo"] }
either = { version = "1.15.0", features = ["serde"] } either = { version = "1.15.0", features = ["serde"] }
enquote = "1.1.0"
inquire = "0.7.5" inquire = "0.7.5"
serde = { version = "1.0.219", features = ["derive"] } serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.137" serde_json = "1.0.137"
shell-quote = "0.7.2"
subprocess = "0.2.9" subprocess = "0.2.9"
toml = "0.8.20" toml = "0.8.20"
yansi = "1.0.1" yansi = "1.0.1"

View file

@ -2,7 +2,6 @@ use std::collections::HashMap;
use either::Either; use either::Either;
use serde::Deserialize; use serde::Deserialize;
use shell_quote::{Bash, QuoteRefExt};
use subprocess::Exec; use subprocess::Exec;
use crate::git::switch_branch; use crate::git::switch_branch;
@ -138,11 +137,11 @@ pub fn build_script_vars(expose: Option<Vec<String>>, vars: &[AskValue]) -> Stri
.iter() .iter()
.map(|x| match x { .map(|x| match x {
AskValue::Text(name, text) => { AskValue::Text(name, text) => {
format!("export {name}='{}'", || -> String { text.quoted(Bash) }()) format!("export {name}='{}'", enquote::enquote('\'', text))
} }
AskValue::Number(name, num) => format!("export {name}={num}"), AskValue::Number(name, num) => format!("export {name}={num}"),
AskValue::Selection(name, select) => { AskValue::Selection(name, select) => {
format!("export {name}='{}'", || -> String { select.quoted(Bash) }()) format!("export {name}='{}'", enquote::enquote('\'', select))
} }
AskValue::Bool(name, b) => format!("export {name}='{}'", b.to_string()), AskValue::Bool(name, b) => format!("export {name}='{}'", b.to_string()),
}) })