1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
use indexmap::{indexmap, IndexMap};
use os_info::Type;
use serde::{Deserialize, Serialize};
#[derive(Clone, Deserialize, Serialize)]
#[cfg_attr(
feature = "config-schema",
derive(schemars::JsonSchema),
schemars(deny_unknown_fields)
)]
#[serde(default)]
pub struct OSConfig<'a> {
pub format: &'a str,
pub style: &'a str,
pub symbols: IndexMap<Type, &'a str>,
pub disabled: bool,
}
impl<'a> OSConfig<'a> {
pub fn get_symbol(&self, key: &Type) -> Option<&'a str> {
self.symbols.get(key).copied()
}
}
impl<'a> Default for OSConfig<'a> {
fn default() -> Self {
OSConfig {
format: "[$symbol]($style)",
style: "bold white",
symbols: indexmap! {
Type::Alpine => "๐๏ธ ",
Type::Amazon => "๐ ",
Type::Android => "๐ค ",
Type::Arch => "๐๏ธ ",
Type::CentOS => "๐ ",
Type::Debian => "๐ ",
Type::DragonFly => "๐ ",
Type::Emscripten => "๐ ",
Type::EndeavourOS => "๐ ",
Type::Fedora => "๐ฉ ",
Type::FreeBSD => "๐ ",
Type::Garuda => "๐ฆ
",
Type::Gentoo => "๐๏ธ ",
Type::HardenedBSD => "๐ก๏ธ ",
Type::Illumos => "๐ฆ ",
Type::Linux => "๐ง ",
Type::Macos => "๐ ",
Type::Manjaro => "๐ฅญ ",
Type::Mariner => "๐ ",
Type::MidnightBSD => "๐ ",
Type::Mint => "๐ฟ ",
Type::NetBSD => "๐ฉ ",
Type::NixOS => "โ๏ธ ",
Type::OpenBSD => "๐ก ",
Type::openSUSE => "๐ฆ ",
Type::OracleLinux => "๐ฆด ",
Type::Pop => "๐ญ ",
Type::Raspbian => "๐ ",
Type::Redhat => "๐ฉ ",
Type::RedHatEnterprise => "๐ฉ ",
Type::Redox => "๐งช ",
Type::Solus => "โต ",
Type::SUSE => "๐ฆ ",
Type::Ubuntu => "๐ฏ ",
Type::Unknown => "โ ",
Type::Windows => "๐ช ",
// Future symbols.
//aosc => "๏ ",
//artix => "๏ค ",
//coreos => "๏
",
//devuan => "๏ ",
//elementary => "๏ ",
//mageia => "๏ ",
//mandriva => "๏ ",
//sabayon => "๏ ",
//slackware => "๏ ",
//void => "๎ ",
//solaris => "๏
",
},
disabled: true,
}
}
}
|