Skip to content

Commit 796a411

Browse files
authored
fix: replace unmaintained crates yaml-rust, dirs-next (starship#5887)
1 parent e4d0c2d commit 796a411

11 files changed

+131
-30
lines changed

Cargo.lock

+116-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ gix-faster = ["gix-features/zlib-stock", "gix/fast-sha1"]
4545
chrono = { version = "0.4.37", default-features = false, features = ["clock", "std", "wasmbind"] }
4646
clap = { version = "4.5.4", features = ["derive", "cargo", "unicode"] }
4747
clap_complete = "4.5.1"
48-
dirs-next = "2.0.0"
48+
dirs = "5.0.1"
4949
dunce = "1.0.4"
5050
gethostname = "0.4.3"
5151
# default feature restriction addresses https://github.com/starship/starship/issues/4251
@@ -87,7 +87,7 @@ unicode-width = "0.1.11"
8787
urlencoding = "2.1.3"
8888
versions = "6.2.0"
8989
which = "6.0.1"
90-
yaml-rust = "0.4.5"
90+
yaml-rust2 = "0.7.0"
9191

9292
process_control = { version = "4.1.0", features = ["crossbeam-channel"] }
9393

src/bug_report.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ fn get_terminal_info() -> TerminalInfo {
201201

202202
fn get_config_path(shell: &str) -> Option<PathBuf> {
203203
if shell == "nu" {
204-
return dirs_next::config_dir()
205-
.map(|config_dir| config_dir.join("nushell").join("config.nu"));
204+
return dirs::config_dir().map(|config_dir| config_dir.join("nushell").join("config.nu"));
206205
}
207206

208207
utils::home_dir().and_then(|home_dir| {

src/logger.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn get_log_dir() -> PathBuf {
2626
.unwrap_or_else(|| {
2727
utils::home_dir()
2828
.map(|home| home.join(".cache"))
29-
.or_else(dirs_next::cache_dir)
29+
.or_else(dirs::cache_dir)
3030
.unwrap_or_else(std::env::temp_dir)
3131
.join("starship")
3232
})

src/modules/daml.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn get_daml_sdk_version(context: &Context) -> Option<String> {
6666

6767
fn read_sdk_version_from_daml_yaml(context: &Context) -> Option<String> {
6868
let file_contents = context.read_file_from_pwd(DAML_YAML)?;
69-
let daml_yaml = yaml_rust::YamlLoader::load_from_str(&file_contents).ok()?;
69+
let daml_yaml = yaml_rust2::YamlLoader::load_from_str(&file_contents).ok()?;
7070
let sdk_version = daml_yaml.first()?[DAML_SDK_VERSION].as_str()?;
7171
Some(sdk_version.to_string())
7272
}

src/modules/haskell.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn get_snapshot(context: &Context) -> Option<String> {
6464
return None;
6565
}
6666
let file_contents = context.read_file_from_pwd("stack.yaml")?;
67-
let yaml = yaml_rust::YamlLoader::load_from_str(&file_contents).ok()?;
67+
let yaml = yaml_rust2::YamlLoader::load_from_str(&file_contents).ok()?;
6868
let version = yaml.first()?["resolver"]
6969
.as_str()
7070
.or_else(|| yaml.first()?["snapshot"].as_str())
@@ -105,7 +105,7 @@ mod tests {
105105
fn folder_stack() -> io::Result<()> {
106106
let cases = vec![
107107
("resolver: lts-18.12\n", "lts-18.12"),
108-
("snapshot:\tnightly-2011-11-11", "nightly-2011-11-11"),
108+
("snapshot: nightly-2011-11-11", "nightly-2011-11-11"),
109109
("snapshot: ghc-8.10.7", "ghc-8.10.7"),
110110
(
111111
"snapshot: https://github.com/whatever/xxx.yaml\n",

src/modules/kubernetes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use yaml_rust::YamlLoader;
1+
use yaml_rust2::YamlLoader;
22

33
use std::borrow::Cow;
44
use std::env;

src/modules/openstack.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use yaml_rust::YamlLoader;
1+
use yaml_rust2::YamlLoader;
22

33
use super::{Context, Module, ModuleConfig};
44

src/modules/package.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ fn get_julia_project_version(context: &Context, config: &PackageConfig) -> Optio
135135

136136
fn get_helm_package_version(context: &Context, config: &PackageConfig) -> Option<String> {
137137
let file_contents = context.read_file_from_pwd("Chart.yaml")?;
138-
let yaml = yaml_rust::YamlLoader::load_from_str(&file_contents).ok()?;
138+
let yaml = yaml_rust2::YamlLoader::load_from_str(&file_contents).ok()?;
139139
let version = yaml.first()?["version"].as_str()?;
140140

141141
format_version(version, config.version_format)
@@ -286,7 +286,7 @@ fn get_nimble_version(context: &Context, config: &PackageConfig) -> Option<Strin
286286
fn get_shard_version(context: &Context, config: &PackageConfig) -> Option<String> {
287287
let file_contents = context.read_file_from_pwd("shard.yml")?;
288288

289-
let data = yaml_rust::YamlLoader::load_from_str(&file_contents).ok()?;
289+
let data = yaml_rust2::YamlLoader::load_from_str(&file_contents).ok()?;
290290
let raw_version = data.first()?["version"].as_str()?;
291291

292292
format_version(raw_version, config.version_format)
@@ -295,7 +295,7 @@ fn get_shard_version(context: &Context, config: &PackageConfig) -> Option<String
295295
fn get_daml_project_version(context: &Context, config: &PackageConfig) -> Option<String> {
296296
let file_contents = context.read_file_from_pwd("daml.yaml")?;
297297

298-
let daml_yaml = yaml_rust::YamlLoader::load_from_str(&file_contents).ok()?;
298+
let daml_yaml = yaml_rust2::YamlLoader::load_from_str(&file_contents).ok()?;
299299
let raw_version = daml_yaml.first()?["version"].as_str()?;
300300

301301
format_version(raw_version, config.version_format)
@@ -304,7 +304,7 @@ fn get_daml_project_version(context: &Context, config: &PackageConfig) -> Option
304304
fn get_dart_pub_version(context: &Context, config: &PackageConfig) -> Option<String> {
305305
let file_contents = context.read_file_from_pwd("pubspec.yaml")?;
306306

307-
let data = yaml_rust::YamlLoader::load_from_str(&file_contents).ok()?;
307+
let data = yaml_rust2::YamlLoader::load_from_str(&file_contents).ok()?;
308308
let raw_version = data.first()?["version"].as_str()?;
309309

310310
format_version(raw_version, config.version_format)

src/modules/pulumi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::fs::File;
77
use std::io::{BufReader, Read};
88
use std::path::{Path, PathBuf};
99
use std::str::FromStr;
10-
use yaml_rust::{Yaml, YamlLoader};
10+
use yaml_rust2::{Yaml, YamlLoader};
1111

1212
use super::{Context, Module, ModuleConfig};
1313
use crate::configs::pulumi::PulumiConfig;

src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ fn render_time_component((component, suffix): (&u128, &&str)) -> String {
649649
}
650650

651651
pub fn home_dir() -> Option<PathBuf> {
652-
dirs_next::home_dir()
652+
dirs::home_dir()
653653
}
654654

655655
const HEXTABLE: &[char] = &[

0 commit comments

Comments
 (0)