mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-24 13:47:38 +00:00
build: bump toml_edit from 0.6.0 to 0.8.0 (#3225)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
b83f5a45d2
commit
6068bab872
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -1932,9 +1932,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.6.0"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b46c9238346fec3169f99251eda26e918ab71cdf382a660e46076ff1b1b16729"
|
||||
checksum = "8c29c21e11af3c58476a1063cb550e255c45c60928bf7f272462a533e7a2b406"
|
||||
dependencies = [
|
||||
"combine",
|
||||
"indexmap",
|
||||
|
@ -70,7 +70,7 @@ shadow-rs = "0.7.2"
|
||||
versions = "3.0.3"
|
||||
strsim = "0.10.0"
|
||||
sha-1 = "0.9.8"
|
||||
toml_edit = "0.6.0"
|
||||
toml_edit = "0.8.0"
|
||||
|
||||
process_control = { version = "3.1.0", features = ["crossbeam-channel"] }
|
||||
|
||||
|
@ -32,9 +32,17 @@ pub fn update_configuration(name: &str, value: &str) {
|
||||
}
|
||||
|
||||
fn handle_update_configuration(doc: &mut Document, name: &str, value: &str) -> Result<(), String> {
|
||||
let mut current_item = &mut doc.root;
|
||||
let mut keys = name.split('.');
|
||||
|
||||
for key in name.split('.') {
|
||||
let first_key = keys.next().unwrap_or_default();
|
||||
if first_key.is_empty() {
|
||||
return Err("Empty table keys are not supported".to_owned());
|
||||
}
|
||||
|
||||
let table = doc.as_table_mut();
|
||||
let mut current_item = table.entry(first_key).or_insert_with(toml_edit::table);
|
||||
|
||||
for key in keys {
|
||||
if !current_item.is_table_like() {
|
||||
return Err("This command can only index into TOML tables".to_owned());
|
||||
}
|
||||
@ -429,6 +437,7 @@ mod tests {
|
||||
assert!(handle_update_configuration(&mut doc, ".....", "true").is_err());
|
||||
assert!(handle_update_configuration(&mut doc, "a.a.a..a.a", "true").is_err());
|
||||
assert!(handle_update_configuration(&mut doc, "a.a.a.a.a.", "true").is_err());
|
||||
assert!(handle_update_configuration(&mut doc, ".a.a.a.a.a", "true").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user