mirror of
https://github.com/starship/starship.git
synced 2026-06-24 02:01:36 +07:00
chore: bump msrv, fix new clippy warnings & handle os-info update (#7174)
* chore: bump msrv & handle clippy warnings * chore: handle new os-info symbols
This commit is contained in:
@@ -1200,6 +1200,7 @@
|
||||
"Alpaquita": "🔔 ",
|
||||
"AlmaLinux": "💠 ",
|
||||
"Alpine": "🏔️ ",
|
||||
"ALTLinux": "Ⓐ ",
|
||||
"Amazon": "🙂 ",
|
||||
"Android": "🤖 ",
|
||||
"AOSC": "🐱 ",
|
||||
@@ -1209,6 +1210,7 @@
|
||||
"CachyOS": "🎗️ ",
|
||||
"CentOS": "💠 ",
|
||||
"Debian": "🌀 ",
|
||||
"Elementary": "🍏 ",
|
||||
"DragonFly": "🐉 ",
|
||||
"Emscripten": "🔗 ",
|
||||
"EndeavourOS": "🚀 ",
|
||||
@@ -1218,6 +1220,8 @@
|
||||
"Gentoo": "🗜️ ",
|
||||
"HardenedBSD": "🛡️ ",
|
||||
"Illumos": "🐦 ",
|
||||
"Ios": "📱 ",
|
||||
"InstantOS": "⏲️ ",
|
||||
"Kali": "🐉 ",
|
||||
"Linux": "🐧 ",
|
||||
"Mabox": "📦 ",
|
||||
@@ -1234,6 +1238,7 @@
|
||||
"openEuler": "🦉 ",
|
||||
"openSUSE": "🦎 ",
|
||||
"OracleLinux": "🦴 ",
|
||||
"PikaOS": "🐤 ",
|
||||
"Pop": "🍭 ",
|
||||
"Raspbian": "🍓 ",
|
||||
"Redhat": "🎩 ",
|
||||
@@ -1247,7 +1252,8 @@
|
||||
"Unknown": "❓ ",
|
||||
"Uos": "🐲 ",
|
||||
"Void": " ",
|
||||
"Windows": "🪟 "
|
||||
"Windows": "🪟 ",
|
||||
"Zorin": "🔹 "
|
||||
},
|
||||
"disabled": true
|
||||
}
|
||||
@@ -5035,6 +5041,7 @@
|
||||
"Alpaquita": "🔔 ",
|
||||
"AlmaLinux": "💠 ",
|
||||
"Alpine": "🏔️ ",
|
||||
"ALTLinux": "Ⓐ ",
|
||||
"Amazon": "🙂 ",
|
||||
"Android": "🤖 ",
|
||||
"AOSC": "🐱 ",
|
||||
@@ -5044,6 +5051,7 @@
|
||||
"CachyOS": "🎗️ ",
|
||||
"CentOS": "💠 ",
|
||||
"Debian": "🌀 ",
|
||||
"Elementary": "🍏 ",
|
||||
"DragonFly": "🐉 ",
|
||||
"Emscripten": "🔗 ",
|
||||
"EndeavourOS": "🚀 ",
|
||||
@@ -5053,6 +5061,8 @@
|
||||
"Gentoo": "🗜️ ",
|
||||
"HardenedBSD": "🛡️ ",
|
||||
"Illumos": "🐦 ",
|
||||
"Ios": "📱 ",
|
||||
"InstantOS": "⏲️ ",
|
||||
"Kali": "🐉 ",
|
||||
"Linux": "🐧 ",
|
||||
"Mabox": "📦 ",
|
||||
@@ -5069,6 +5079,7 @@
|
||||
"openEuler": "🦉 ",
|
||||
"openSUSE": "🦎 ",
|
||||
"OracleLinux": "🦴 ",
|
||||
"PikaOS": "🐤 ",
|
||||
"Pop": "🍭 ",
|
||||
"Raspbian": "🍓 ",
|
||||
"Redhat": "🎩 ",
|
||||
@@ -5082,7 +5093,8 @@
|
||||
"Unknown": "❓ ",
|
||||
"Uos": "🐲 ",
|
||||
"Void": " ",
|
||||
"Windows": "🪟 "
|
||||
"Windows": "🪟 ",
|
||||
"Zorin": "🔹 "
|
||||
}
|
||||
},
|
||||
"disabled": {
|
||||
|
||||
Generated
+1
@@ -2423,6 +2423,7 @@ dependencies = [
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
"objc2-ui-kit",
|
||||
"schemars",
|
||||
"serde",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ license = "ISC"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/starship/starship"
|
||||
# Note: MSRV is only intended as a hint, and only the latest version is officially supported in starship.
|
||||
rust-version = "1.85"
|
||||
rust-version = "1.90"
|
||||
description = """
|
||||
The minimal, blazing-fast, and infinitely customizable prompt for any shell! ☄🌌️
|
||||
"""
|
||||
@@ -52,7 +52,7 @@ notify-rust = { version = "4.11.7", optional = true }
|
||||
nu-ansi-term = "0.50.3"
|
||||
open = "5.3.3"
|
||||
# update os module config and tests when upgrading os_info
|
||||
os_info = "3.14.0"
|
||||
os_info = { version = "3.14.0", features = ["schemars"] }
|
||||
# for efficient shared state between `git_status` and `git_metrics`, allowing parallel printing. This is for poison-free locks.
|
||||
parking_lot = "0.12.5"
|
||||
path-slash = "0.2.1"
|
||||
|
||||
@@ -3522,6 +3522,7 @@ AIX = "➿ "
|
||||
Alpaquita = "🔔 "
|
||||
AlmaLinux = "💠 "
|
||||
Alpine = "🏔️ "
|
||||
ALTLinux = "Ⓐ "
|
||||
Amazon = "🙂 "
|
||||
Android = "🤖 "
|
||||
AOSC = "🐱 "
|
||||
@@ -3532,6 +3533,7 @@ CachyOS = "🎗️ "
|
||||
CentOS = "💠 "
|
||||
Debian = "🌀 "
|
||||
DragonFly = "🐉 "
|
||||
Elementary = "🍏 "
|
||||
Emscripten = "🔗 "
|
||||
EndeavourOS = "🚀 "
|
||||
Fedora = "🎩 "
|
||||
@@ -3540,6 +3542,8 @@ Garuda = "🦅 "
|
||||
Gentoo = "🗜️ "
|
||||
HardenedBSD = "🛡️ "
|
||||
Illumos = "🐦 "
|
||||
Ios = "📱 "
|
||||
InstantOS = "⏲️ "
|
||||
Kali = "🐉 "
|
||||
Linux = "🐧 "
|
||||
Mabox = "📦 "
|
||||
@@ -3556,6 +3560,7 @@ OpenCloudOS = "☁️ "
|
||||
openEuler = "🦉 "
|
||||
openSUSE = "🦎 "
|
||||
OracleLinux = "🦴 "
|
||||
PikaOS = "🐤 "
|
||||
Pop = "🍭 "
|
||||
Raspbian = "🍓 "
|
||||
Redhat = "🎩 "
|
||||
@@ -3570,6 +3575,7 @@ Unknown = "❓ "
|
||||
Uos = "🐲 "
|
||||
Void = " "
|
||||
Windows = "🪟 "
|
||||
Zorin = "🔹 "
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
@@ -124,6 +124,7 @@ CachyOS = " "
|
||||
CentOS = " "
|
||||
Debian = " "
|
||||
DragonFly = " "
|
||||
Elementary = " "
|
||||
Emscripten = " "
|
||||
EndeavourOS = " "
|
||||
Fedora = " "
|
||||
@@ -132,6 +133,7 @@ Garuda = " "
|
||||
Gentoo = " "
|
||||
HardenedBSD = " "
|
||||
Illumos = " "
|
||||
Ios = " "
|
||||
Kali = " "
|
||||
Linux = " "
|
||||
Mabox = " "
|
||||
@@ -158,6 +160,7 @@ Ubuntu = " "
|
||||
Unknown = " "
|
||||
Void = " "
|
||||
Windows = " "
|
||||
Zorin = " "
|
||||
|
||||
[package]
|
||||
symbol = " "
|
||||
|
||||
@@ -193,6 +193,7 @@ AIX = "aix "
|
||||
Alpaquita = "alq "
|
||||
AlmaLinux = "alma "
|
||||
Alpine = "alp "
|
||||
ALTLinux = "alt "
|
||||
Amazon = "amz "
|
||||
Android = "andr "
|
||||
AOSC = "aosc "
|
||||
@@ -203,6 +204,7 @@ CachyOS = "cach "
|
||||
CentOS = "cent "
|
||||
Debian = "deb "
|
||||
DragonFly = "dfbsd "
|
||||
Elementary = "elem "
|
||||
Emscripten = "emsc "
|
||||
EndeavourOS = "ndev "
|
||||
Fedora = "fed "
|
||||
@@ -211,6 +213,8 @@ Garuda = "garu "
|
||||
Gentoo = "gent "
|
||||
HardenedBSD = "hbsd "
|
||||
Illumos = "lum "
|
||||
Ios = "ios "
|
||||
InstantOS = "inst "
|
||||
Kali = "kali "
|
||||
Linux = "lnx "
|
||||
Mabox = "mbox "
|
||||
@@ -227,6 +231,7 @@ OpenCloudOS = "ocos "
|
||||
openEuler = "oeul "
|
||||
openSUSE = "osuse "
|
||||
OracleLinux = "orac "
|
||||
PikaOS = "pika "
|
||||
Pop = "pop "
|
||||
Raspbian = "rasp "
|
||||
Redhat = "rhl "
|
||||
@@ -241,6 +246,7 @@ Unknown = "unk "
|
||||
Uos = "uos "
|
||||
Void = "void "
|
||||
Windows = "win "
|
||||
Zorin = "zorn "
|
||||
|
||||
[package]
|
||||
symbol = "pkg "
|
||||
|
||||
+6
-4
@@ -12,7 +12,6 @@ use serde::{Deserialize, Serialize};
|
||||
pub struct OSConfig<'a> {
|
||||
pub format: &'a str,
|
||||
pub style: &'a str,
|
||||
#[cfg_attr(feature = "config-schema", schemars(with = "IndexMap<String, String>"))]
|
||||
pub symbols: IndexMap<Type, &'a str>,
|
||||
pub disabled: bool,
|
||||
}
|
||||
@@ -33,6 +32,7 @@ impl Default for OSConfig<'_> {
|
||||
Type::Alpaquita => "🔔 ",
|
||||
Type::AlmaLinux => "💠 ",
|
||||
Type::Alpine => "🏔️ ",
|
||||
Type::ALTLinux => "Ⓐ ",
|
||||
Type::Amazon => "🙂 ",
|
||||
Type::Android => "🤖 ",
|
||||
Type::AOSC => "🐱 ",
|
||||
@@ -42,6 +42,7 @@ impl Default for OSConfig<'_> {
|
||||
Type::CachyOS => "🎗️ ",
|
||||
Type::CentOS => "💠 ",
|
||||
Type::Debian => "🌀 ",
|
||||
Type::Elementary => "🍏 ",
|
||||
Type::DragonFly => "🐉 ",
|
||||
Type::Emscripten => "🔗 ",
|
||||
Type::EndeavourOS => "🚀 ",
|
||||
@@ -51,6 +52,8 @@ impl Default for OSConfig<'_> {
|
||||
Type::Gentoo => "🗜️ ",
|
||||
Type::HardenedBSD => "🛡️ ",
|
||||
Type::Illumos => "🐦 ",
|
||||
Type::Ios => "📱 ",
|
||||
Type::InstantOS => "⏲️ ",
|
||||
Type::Kali => "🐉 ",
|
||||
Type::Linux => "🐧 ",
|
||||
Type::Mabox => "📦 ",
|
||||
@@ -67,6 +70,7 @@ impl Default for OSConfig<'_> {
|
||||
Type::openEuler => "🦉 ",
|
||||
Type::openSUSE => "🦎 ",
|
||||
Type::OracleLinux => "🦴 ",
|
||||
Type::PikaOS => "🐤 ",
|
||||
Type::Pop => "🍭 ",
|
||||
Type::Raspbian => "🍓 ",
|
||||
Type::Redhat => "🎩 ",
|
||||
@@ -81,12 +85,10 @@ impl Default for OSConfig<'_> {
|
||||
Type::Uos => "🐲 ",
|
||||
Type::Void => " ",
|
||||
Type::Windows => "🪟 ",
|
||||
Type::Zorin => "🔹 ",
|
||||
// Future symbols.
|
||||
//aosc => " ",
|
||||
//artix => " ",
|
||||
//coreos => " ",
|
||||
//devuan => " ",
|
||||
//elementary => " ",
|
||||
//mageia => " ",
|
||||
//mandriva => " ",
|
||||
//sabayon => " ",
|
||||
|
||||
+4
-4
@@ -498,10 +498,10 @@ pub enum Detected {
|
||||
}
|
||||
|
||||
fn home_dir(env: &Env) -> Option<PathBuf> {
|
||||
if cfg!(test) {
|
||||
if let Some(home) = env.get_env("HOME") {
|
||||
return Some(PathBuf::from(home));
|
||||
}
|
||||
if cfg!(test)
|
||||
&& let Some(home) = env.get_env("HOME")
|
||||
{
|
||||
return Some(PathBuf::from(home));
|
||||
}
|
||||
utils::home_dir()
|
||||
}
|
||||
|
||||
@@ -28,10 +28,11 @@ pub fn module<'a>(name: &str, context: &'a Context) -> Option<Module<'a>> {
|
||||
return None;
|
||||
}
|
||||
|
||||
if let Some(os) = config.os {
|
||||
if os != env::consts::OS && !(os == "unix" && cfg!(unix)) {
|
||||
return None;
|
||||
}
|
||||
if let Some(os) = config.os
|
||||
&& os != env::consts::OS
|
||||
&& !(os == "unix" && cfg!(unix))
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
if config.require_repo && context.get_repo().is_err() {
|
||||
|
||||
+13
-13
@@ -348,22 +348,22 @@ fn get_repo_status(
|
||||
let has_ahead_behind = !config.ahead.is_empty() || !config.behind.is_empty();
|
||||
let has_up_to_date_or_diverged =
|
||||
!config.up_to_date.is_empty() || !config.diverged.is_empty();
|
||||
if has_ahead_behind || has_up_to_date_or_diverged {
|
||||
if let Some(branch_name) = gix_repo.head_name().ok().flatten().and_then(|ref_name| {
|
||||
if (has_ahead_behind || has_up_to_date_or_diverged)
|
||||
&& let Some(branch_name) = gix_repo.head_name().ok().flatten().and_then(|ref_name| {
|
||||
Vec::from(gix::bstr::BString::from(ref_name))
|
||||
.into_string()
|
||||
.ok()
|
||||
}) {
|
||||
let output = repo.exec_git(
|
||||
context,
|
||||
["for-each-ref", "--format", "%(upstream) %(upstream:track)"]
|
||||
.into_iter()
|
||||
.map(ToOwned::to_owned)
|
||||
.chain(Some(branch_name)),
|
||||
)?;
|
||||
if let Some(line) = output.stdout.lines().next() {
|
||||
repo_status.set_ahead_behind_for_each_ref(line);
|
||||
}
|
||||
})
|
||||
{
|
||||
let output = repo.exec_git(
|
||||
context,
|
||||
["for-each-ref", "--format", "%(upstream) %(upstream:track)"]
|
||||
.into_iter()
|
||||
.map(ToOwned::to_owned)
|
||||
.chain(Some(branch_name)),
|
||||
)?;
|
||||
if let Some(line) = output.stdout.lines().next() {
|
||||
repo_status.set_ahead_behind_for_each_ref(line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,10 +93,9 @@ fn get_wrapper_properties_file(context: &Context, recursive: bool) -> Option<Str
|
||||
.try_begin_scan()?
|
||||
.set_folders(&["gradle"])
|
||||
.is_match()
|
||||
&& let Some(properties) = read_wrapper_properties(&context.current_dir)
|
||||
{
|
||||
if let Some(properties) = read_wrapper_properties(&context.current_dir) {
|
||||
return Some(properties);
|
||||
}
|
||||
return Some(properties);
|
||||
}
|
||||
|
||||
// Try parent directories if recursive
|
||||
|
||||
@@ -28,11 +28,9 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
||||
.inspect_err(|e| log::warn!("Failed to get hostname: {e}"))
|
||||
.ok()?;
|
||||
|
||||
//rustc doesn't let you do an "if" and an "if let" in the same if statement
|
||||
// if this changes in the future this can become a lot cleaner
|
||||
let mut host = if config.trim_at.is_empty() {
|
||||
host.as_ref()
|
||||
} else if let Some(index) = host.find(config.trim_at) {
|
||||
let mut host = if !config.trim_at.is_empty()
|
||||
&& let Some(index) = host.find(config.trim_at)
|
||||
{
|
||||
host.split_at(index).0
|
||||
} else {
|
||||
host.as_ref()
|
||||
|
||||
@@ -338,6 +338,7 @@ mod tests {
|
||||
Type::AIX => "➿ ",
|
||||
Type::Alpaquita => "🔔 ",
|
||||
Type::Alpine => "🏔️ ",
|
||||
Type::ALTLinux => "Ⓐ ",
|
||||
Type::Amazon => "🙂 ",
|
||||
Type::Android => "🤖 ",
|
||||
Type::AOSC => "🐱 ",
|
||||
@@ -347,6 +348,7 @@ mod tests {
|
||||
Type::Cygwin => "",
|
||||
Type::Debian => "🌀 ",
|
||||
Type::DragonFly => "🐉 ",
|
||||
Type::Elementary => "🍏 ",
|
||||
Type::Emscripten => "🔗 ",
|
||||
Type::EndeavourOS => "🚀 ",
|
||||
Type::Fedora | Type::Nobara | Type::Redhat | Type::RedHatEnterprise => "🎩 ",
|
||||
@@ -355,6 +357,8 @@ mod tests {
|
||||
Type::Gentoo => "🗜️ ",
|
||||
Type::HardenedBSD => "🛡️ ",
|
||||
Type::Illumos => "🐦 ",
|
||||
Type::Ios => "📱 ",
|
||||
Type::InstantOS => "⏲️ ",
|
||||
Type::Kali => "🐉 ",
|
||||
Type::Linux => "🐧 ",
|
||||
Type::Mabox => "📦 ",
|
||||
@@ -370,6 +374,7 @@ mod tests {
|
||||
Type::openEuler => "🦉 ",
|
||||
Type::openSUSE => "🦎 ",
|
||||
Type::OracleLinux => "🦴 ",
|
||||
Type::PikaOS => "🐤 ",
|
||||
Type::Pop => "🍭 ",
|
||||
Type::Raspbian => "🍓 ",
|
||||
Type::Redox => "🧪 ",
|
||||
@@ -381,6 +386,7 @@ mod tests {
|
||||
Type::Uos => "🐲 ",
|
||||
Type::Void => " ",
|
||||
Type::Windows => "🪟 ",
|
||||
Type::Zorin => "🔹 ",
|
||||
_ => "",
|
||||
};
|
||||
}
|
||||
|
||||
+12
-13
@@ -333,19 +333,17 @@ fn find_rust_toolchain_file(context: &Context) -> Option<String> {
|
||||
if context
|
||||
.dir_contents()
|
||||
.is_ok_and(|dir| dir.has_file("rust-toolchain"))
|
||||
&& let Some(toolchain) = read_channel(Path::new("rust-toolchain"), false)
|
||||
{
|
||||
if let Some(toolchain) = read_channel(Path::new("rust-toolchain"), false) {
|
||||
return Some(toolchain);
|
||||
}
|
||||
return Some(toolchain);
|
||||
}
|
||||
|
||||
if context
|
||||
.dir_contents()
|
||||
.is_ok_and(|dir| dir.has_file("rust-toolchain.toml"))
|
||||
&& let Some(toolchain) = read_channel(Path::new("rust-toolchain.toml"), true)
|
||||
{
|
||||
if let Some(toolchain) = read_channel(Path::new("rust-toolchain.toml"), true) {
|
||||
return Some(toolchain);
|
||||
}
|
||||
return Some(toolchain);
|
||||
}
|
||||
|
||||
let mut dir = &*context.current_dir;
|
||||
@@ -365,13 +363,14 @@ fn extract_toolchain_from_rustup_run_rustc_version(output: Output) -> RustupRunR
|
||||
if let Ok(output) = String::from_utf8(output.stdout) {
|
||||
return RustupRunRustcVersionOutcome::RustcVersion(output);
|
||||
}
|
||||
} else if let Ok(stderr) = String::from_utf8(output.stderr) {
|
||||
if stderr.starts_with("error: toolchain '") && stderr.ends_with("' is not installed\n") {
|
||||
let stderr = stderr
|
||||
["error: toolchain '".len()..stderr.len() - "' is not installed\n".len()]
|
||||
.to_owned();
|
||||
return RustupRunRustcVersionOutcome::ToolchainNotInstalled(stderr);
|
||||
}
|
||||
} else if let Ok(stderr) = String::from_utf8(output.stderr)
|
||||
&& stderr.starts_with("error: toolchain '")
|
||||
&& stderr.ends_with("' is not installed\n")
|
||||
{
|
||||
let stderr = stderr
|
||||
["error: toolchain '".len()..stderr.len() - "' is not installed\n".len()]
|
||||
.to_owned();
|
||||
return RustupRunRustcVersionOutcome::ToolchainNotInstalled(stderr);
|
||||
}
|
||||
RustupRunRustcVersionOutcome::Err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user