1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-04 19:03:38 +00:00

build(deps): update toml crates (#5842)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
David Knaack 2024-03-20 10:56:20 +01:00 committed by GitHub
parent 7a30163f69
commit 49575e5a55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 51 additions and 47 deletions

74
Cargo.lock generated
View File

@ -10,9 +10,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.8.9" version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d713b3834d76b85304d4d525563c1276e2e30dc97cc67bfb4585a4a29fc2c89f" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"once_cell", "once_cell",
@ -249,7 +249,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -284,7 +284,7 @@ checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -463,7 +463,7 @@ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -802,7 +802,7 @@ checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -1108,7 +1108,7 @@ dependencies = [
"gix-utils", "gix-utils",
"itoa", "itoa",
"thiserror", "thiserror",
"winnow 0.6.0", "winnow 0.6.5",
] ]
[[package]] [[package]]
@ -1161,7 +1161,7 @@ dependencies = [
"smallvec", "smallvec",
"thiserror", "thiserror",
"unicode-bom", "unicode-bom",
"winnow 0.6.0", "winnow 0.6.5",
] ]
[[package]] [[package]]
@ -1329,7 +1329,7 @@ checksum = "1dff438f14e67e7713ab9332f5fd18c8f20eb7eb249494f6c2bf170522224032"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -1348,7 +1348,7 @@ dependencies = [
"itoa", "itoa",
"smallvec", "smallvec",
"thiserror", "thiserror",
"winnow 0.6.0", "winnow 0.6.5",
] ]
[[package]] [[package]]
@ -1435,7 +1435,7 @@ dependencies = [
"gix-validate", "gix-validate",
"memmap2", "memmap2",
"thiserror", "thiserror",
"winnow 0.6.0", "winnow 0.6.5",
] ]
[[package]] [[package]]
@ -1955,7 +1955,7 @@ dependencies = [
"cfg-if", "cfg-if",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -2233,7 +2233,7 @@ dependencies = [
"pest_meta", "pest_meta",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -2395,9 +2395,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.74" version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2de98502f212cfcea8d0bb305bd0f49d7ebdd75b64ba0a68f937d888f4e0d6db" checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -2671,7 +2671,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -2704,7 +2704,7 @@ checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -2899,8 +2899,8 @@ dependencies = [
"systemstat", "systemstat",
"tempfile", "tempfile",
"terminal_size", "terminal_size",
"toml 0.8.10", "toml 0.8.12",
"toml_edit 0.22.6", "toml_edit 0.22.8",
"unicode-segmentation", "unicode-segmentation",
"unicode-width", "unicode-width",
"urlencoding", "urlencoding",
@ -2953,9 +2953,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.46" version = "2.0.53"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e" checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -3085,7 +3085,7 @@ checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -3154,15 +3154,15 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.8.10" version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3"
dependencies = [ dependencies = [
"indexmap 2.2.5", "indexmap 2.2.5",
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"toml_edit 0.22.6", "toml_edit 0.22.8",
] ]
[[package]] [[package]]
@ -3182,20 +3182,20 @@ checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [ dependencies = [
"indexmap 2.2.5", "indexmap 2.2.5",
"toml_datetime", "toml_datetime",
"winnow 0.5.31", "winnow 0.5.40",
] ]
[[package]] [[package]]
name = "toml_edit" name = "toml_edit"
version = "0.22.6" version = "0.22.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" checksum = "c12219811e0c1ba077867254e5ad62ee2c9c190b0d957110750ac0cda1ae96cd"
dependencies = [ dependencies = [
"indexmap 2.2.5", "indexmap 2.2.5",
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"winnow 0.6.0", "winnow 0.6.5",
] ]
[[package]] [[package]]
@ -3217,7 +3217,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
] ]
[[package]] [[package]]
@ -3428,7 +3428,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -3450,7 +3450,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -3687,18 +3687,18 @@ checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.5.31" version = "0.5.40"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97a4882e6b134d6c28953a387571f1acdd3496830d5e36c5e3a1075580ea641c" checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.6.0" version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b1dbce9e90e5404c5a52ed82b1d13fc8cfbdad85033b6f57546ffd1265f8451" checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -3814,7 +3814,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.46", "syn 2.0.53",
] ]
[[package]] [[package]]

View File

@ -80,8 +80,8 @@ starship-battery = { version = "0.8.2", optional = true }
strsim = "0.11.0" strsim = "0.11.0"
systemstat = "=0.2.3" systemstat = "=0.2.3"
terminal_size = "0.3.0" terminal_size = "0.3.0"
toml = { version = "0.8.10", features = ["preserve_order"] } toml = { version = "0.8.12", features = ["preserve_order"] }
toml_edit = "0.22.6" toml_edit = "0.22.8"
unicode-segmentation = "1.11.0" unicode-segmentation = "1.11.0"
unicode-width = "0.1.11" unicode-width = "0.1.11"
urlencoding = "2.1.3" urlencoding = "2.1.3"

View File

@ -10,7 +10,7 @@ use crate::context::Context;
use crate::utils; use crate::utils;
use std::fs::File; use std::fs::File;
use std::io::Write; use std::io::Write;
use toml_edit::Document; use toml_edit::DocumentMut;
#[cfg(not(windows))] #[cfg(not(windows))]
const STD_EDITOR: &str = "vi"; const STD_EDITOR: &str = "vi";
@ -29,7 +29,11 @@ pub fn update_configuration(context: &Context, name: &str, value: &str) {
} }
} }
fn handle_update_configuration(doc: &mut Document, name: &str, value: &str) -> Result<(), String> { fn handle_update_configuration(
doc: &mut DocumentMut,
name: &str,
value: &str,
) -> Result<(), String> {
let mut keys = name.split('.'); let mut keys = name.split('.');
let first_key = keys.next().unwrap_or_default(); let first_key = keys.next().unwrap_or_default();
@ -190,7 +194,7 @@ pub fn toggle_configuration(context: &Context, name: &str, key: &str) {
} }
} }
fn handle_toggle_configuration(doc: &mut Document, name: &str, key: &str) -> Result<(), String> { fn handle_toggle_configuration(doc: &mut DocumentMut, name: &str, key: &str) -> Result<(), String> {
if name.is_empty() || key.is_empty() { if name.is_empty() || key.is_empty() {
return Err("Empty table keys are not supported".to_owned()); return Err("Empty table keys are not supported".to_owned());
} }
@ -225,17 +229,17 @@ pub fn get_configuration(context: &Context) -> toml::Table {
starship_config.config.unwrap_or_default() starship_config.config.unwrap_or_default()
} }
pub fn get_configuration_edit(context: &Context) -> Document { pub fn get_configuration_edit(context: &Context) -> DocumentMut {
let config_file_path = context.get_config_path_os(); let config_file_path = context.get_config_path_os();
let toml_content = StarshipConfig::read_config_content_as_str(&config_file_path); let toml_content = StarshipConfig::read_config_content_as_str(&config_file_path);
toml_content toml_content
.unwrap_or_default() .unwrap_or_default()
.parse::<Document>() .parse::<DocumentMut>()
.expect("Failed to load starship config") .expect("Failed to load starship config")
} }
pub fn write_configuration(context: &Context, doc: &Document) { pub fn write_configuration(context: &Context, doc: &DocumentMut) {
let config_path = context.get_config_path_os().unwrap_or_else(|| { let config_path = context.get_config_path_os().unwrap_or_else(|| {
eprintln!("config path required to write configuration"); eprintln!("config path required to write configuration");
process::exit(1); process::exit(1);
@ -430,7 +434,7 @@ mod tests {
assert_eq!(toml::Value::Table(expected_config), actual_config); assert_eq!(toml::Value::Table(expected_config), actual_config);
} }
fn create_doc() -> Document { fn create_doc() -> DocumentMut {
let config = concat!( let config = concat!(
" # comment\n", " # comment\n",
" [status] # comment\n", " [status] # comment\n",
@ -439,7 +443,7 @@ mod tests {
"\n" "\n"
); );
config.parse::<Document>().unwrap() config.parse::<DocumentMut>().unwrap()
} }
#[test] #[test]