mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
fix: replace unmaintained crates yaml-rust, dirs-next (#5887)
This commit is contained in:
+1
-2
@@ -201,8 +201,7 @@ fn get_terminal_info() -> TerminalInfo {
|
||||
|
||||
fn get_config_path(shell: &str) -> Option<PathBuf> {
|
||||
if shell == "nu" {
|
||||
return dirs_next::config_dir()
|
||||
.map(|config_dir| config_dir.join("nushell").join("config.nu"));
|
||||
return dirs::config_dir().map(|config_dir| config_dir.join("nushell").join("config.nu"));
|
||||
}
|
||||
|
||||
utils::home_dir().and_then(|home_dir| {
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ pub fn get_log_dir() -> PathBuf {
|
||||
.unwrap_or_else(|| {
|
||||
utils::home_dir()
|
||||
.map(|home| home.join(".cache"))
|
||||
.or_else(dirs_next::cache_dir)
|
||||
.or_else(dirs::cache_dir)
|
||||
.unwrap_or_else(std::env::temp_dir)
|
||||
.join("starship")
|
||||
})
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ fn get_daml_sdk_version(context: &Context) -> Option<String> {
|
||||
|
||||
fn read_sdk_version_from_daml_yaml(context: &Context) -> Option<String> {
|
||||
let file_contents = context.read_file_from_pwd(DAML_YAML)?;
|
||||
let daml_yaml = yaml_rust::YamlLoader::load_from_str(&file_contents).ok()?;
|
||||
let daml_yaml = yaml_rust2::YamlLoader::load_from_str(&file_contents).ok()?;
|
||||
let sdk_version = daml_yaml.first()?[DAML_SDK_VERSION].as_str()?;
|
||||
Some(sdk_version.to_string())
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ fn get_snapshot(context: &Context) -> Option<String> {
|
||||
return None;
|
||||
}
|
||||
let file_contents = context.read_file_from_pwd("stack.yaml")?;
|
||||
let yaml = yaml_rust::YamlLoader::load_from_str(&file_contents).ok()?;
|
||||
let yaml = yaml_rust2::YamlLoader::load_from_str(&file_contents).ok()?;
|
||||
let version = yaml.first()?["resolver"]
|
||||
.as_str()
|
||||
.or_else(|| yaml.first()?["snapshot"].as_str())
|
||||
@@ -105,7 +105,7 @@ mod tests {
|
||||
fn folder_stack() -> io::Result<()> {
|
||||
let cases = vec![
|
||||
("resolver: lts-18.12\n", "lts-18.12"),
|
||||
("snapshot:\tnightly-2011-11-11", "nightly-2011-11-11"),
|
||||
("snapshot: nightly-2011-11-11", "nightly-2011-11-11"),
|
||||
("snapshot: ghc-8.10.7", "ghc-8.10.7"),
|
||||
(
|
||||
"snapshot: https://github.com/whatever/xxx.yaml\n",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use yaml_rust::YamlLoader;
|
||||
use yaml_rust2::YamlLoader;
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::env;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use yaml_rust::YamlLoader;
|
||||
use yaml_rust2::YamlLoader;
|
||||
|
||||
use super::{Context, Module, ModuleConfig};
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ fn get_julia_project_version(context: &Context, config: &PackageConfig) -> Optio
|
||||
|
||||
fn get_helm_package_version(context: &Context, config: &PackageConfig) -> Option<String> {
|
||||
let file_contents = context.read_file_from_pwd("Chart.yaml")?;
|
||||
let yaml = yaml_rust::YamlLoader::load_from_str(&file_contents).ok()?;
|
||||
let yaml = yaml_rust2::YamlLoader::load_from_str(&file_contents).ok()?;
|
||||
let version = yaml.first()?["version"].as_str()?;
|
||||
|
||||
format_version(version, config.version_format)
|
||||
@@ -286,7 +286,7 @@ fn get_nimble_version(context: &Context, config: &PackageConfig) -> Option<Strin
|
||||
fn get_shard_version(context: &Context, config: &PackageConfig) -> Option<String> {
|
||||
let file_contents = context.read_file_from_pwd("shard.yml")?;
|
||||
|
||||
let data = yaml_rust::YamlLoader::load_from_str(&file_contents).ok()?;
|
||||
let data = yaml_rust2::YamlLoader::load_from_str(&file_contents).ok()?;
|
||||
let raw_version = data.first()?["version"].as_str()?;
|
||||
|
||||
format_version(raw_version, config.version_format)
|
||||
@@ -295,7 +295,7 @@ fn get_shard_version(context: &Context, config: &PackageConfig) -> Option<String
|
||||
fn get_daml_project_version(context: &Context, config: &PackageConfig) -> Option<String> {
|
||||
let file_contents = context.read_file_from_pwd("daml.yaml")?;
|
||||
|
||||
let daml_yaml = yaml_rust::YamlLoader::load_from_str(&file_contents).ok()?;
|
||||
let daml_yaml = yaml_rust2::YamlLoader::load_from_str(&file_contents).ok()?;
|
||||
let raw_version = daml_yaml.first()?["version"].as_str()?;
|
||||
|
||||
format_version(raw_version, config.version_format)
|
||||
@@ -304,7 +304,7 @@ fn get_daml_project_version(context: &Context, config: &PackageConfig) -> Option
|
||||
fn get_dart_pub_version(context: &Context, config: &PackageConfig) -> Option<String> {
|
||||
let file_contents = context.read_file_from_pwd("pubspec.yaml")?;
|
||||
|
||||
let data = yaml_rust::YamlLoader::load_from_str(&file_contents).ok()?;
|
||||
let data = yaml_rust2::YamlLoader::load_from_str(&file_contents).ok()?;
|
||||
let raw_version = data.first()?["version"].as_str()?;
|
||||
|
||||
format_version(raw_version, config.version_format)
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::fs::File;
|
||||
use std::io::{BufReader, Read};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use yaml_rust::{Yaml, YamlLoader};
|
||||
use yaml_rust2::{Yaml, YamlLoader};
|
||||
|
||||
use super::{Context, Module, ModuleConfig};
|
||||
use crate::configs::pulumi::PulumiConfig;
|
||||
|
||||
+1
-1
@@ -649,7 +649,7 @@ fn render_time_component((component, suffix): (&u128, &&str)) -> String {
|
||||
}
|
||||
|
||||
pub fn home_dir() -> Option<PathBuf> {
|
||||
dirs_next::home_dir()
|
||||
dirs::home_dir()
|
||||
}
|
||||
|
||||
const HEXTABLE: &[char] = &[
|
||||
|
||||
Reference in New Issue
Block a user