-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmascot.rs
More file actions
174 lines (153 loc) · 5.3 KB
/
mascot.rs
File metadata and controls
174 lines (153 loc) · 5.3 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
//! Cortex Mascot - ASCII art brain character
//!
//! The official Cortex CLI mascot with various expressions.
/// The default Cortex mascot (minimal brain).
pub const MASCOT: &str = r#" ░▒▓████▓▒░
▓██▀▀▀▀██▓
██ ▌ ▐ ██
▓█▄▄▄▄▄▄█▓
░▒▓██▓▒░"#;
/// Mascot thinking (processing).
pub const MASCOT_THINKING: &str = r#" ░▒▓████▓▒░ ✦
▓██▀▀▀▀██▓ ...
██ ▌ ▐ ██
▓█▄▄▄▄▄▄█▓
░▒▓██▓▒░"#;
/// Mascot happy (success).
pub const MASCOT_HAPPY: &str = r#" ░▒▓████▓▒░ *
▓██▀▀▀▀██▓ *
██ ^ ^ ██
▓█▄▄◡▄▄▄█▓ *
░▒▓██▓▒░"#;
/// Mascot working (busy).
pub const MASCOT_WORKING: &str = r#" ░▒▓████▓▒░ ⚡
▓██▀▀▀▀██▓ >>>
██ ▌ ▐ ██
▓█▄▄══▄▄█▓
░▒▓██▓▒░"#;
/// Mascot error (failure).
pub const MASCOT_ERROR: &str = r#" ░▒▓████▓▒░ ✗
▓██▀▀▀▀██▓ !
██ × × ██
▓█▄▄▄▄▄▄█▓
░▒▓██▓▒░"#;
/// Mascot success (completed).
pub const MASCOT_SUCCESS: &str = r#" ░▒▓████▓▒░ ✓
▓██▀▀▀▀██▓ *
██ ▌ ▐ ██
▓█▄▄‿▄▄▄█▓ *
░▒▓██▓▒░"#;
/// Mascot sleeping (idle).
pub const MASCOT_SLEEPING: &str = r#" ░▒▓████▓▒░ z
▓██▀▀▀▀██▓ zZ
██ ─ ─ ██
▓█▄▄▄▄▄▄█▓
░▒▓██▓▒░"#;
/// Mascot loading (waiting).
pub const MASCOT_LOADING: &str = r#" ░▒▓████▓▒░ ◐
▓██▀▀▀▀██▓ ···
██ ▌ ▐ ██
▓█▄▄▄▄▄▄█▓
░▒▓██▓▒░"#;
/// Mascot question (asking).
pub const MASCOT_QUESTION: &str = r#" ░▒▓████▓▒░ ?
▓██▀▀▀▀██▓
██ ▌ ▐ ██
▓█▄▄▄▄▄▄█▓
░▒▓██▓▒░"#;
/// Mascot idea (eureka).
pub const MASCOT_IDEA: &str = r#" ░▒▓████▓▒░ 💡
▓██▀▀▀▀██▓ !
██ ▌ ▐ ██
▓█▄▄▄▄▄▄█▓ *
░▒▓██▓▒░"#;
/// Mascot wink (playful).
pub const MASCOT_WINK: &str = r#" ░▒▓████▓▒░ *
▓██▀▀▀▀██▓ *
██ ▌ ─ ██
▓█▄▄▄▄▄▄█▓ *
░▒▓██▓▒░"#;
/// Minimal mascot for welcome screens (4 lines).
pub const MASCOT_MINIMAL: &str = r#" ▄█▀▀▀▀█▄
██ ▌ ▐ ██
█▄▄▄▄▄▄█
█ █"#;
/// Minimal mascot lines for inline rendering (12 chars wide each).
pub const MASCOT_MINIMAL_LINES: [&str; 4] =
[" ▄█▀▀▀▀█▄ ", "██ ▌ ▐ ██ ", " █▄▄▄▄▄▄█ ", " █ █ "];
/// Mascot sparkle (special).
pub const MASCOT_SPARKLE: &str = r#" ✦ ░▒▓████▓▒░ ✦
▓██▀▀▀▀██▓
* ██ ▌ ▐ ██ *
▓█▄▄▄▄▄▄█▓
✦ ░▒▓██▓▒░ ✦"#;
/// Mascot expression variants.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum MascotExpression {
/// Default neutral expression
#[default]
Normal,
/// Thinking/processing
Thinking,
/// Happy/cheerful
Happy,
/// Working/busy
Working,
/// Error/failure
Error,
/// Success/completed
Success,
/// Sleeping/idle
Sleeping,
/// Loading/waiting
Loading,
/// Question/asking
Question,
/// Idea/eureka
Idea,
/// Wink/playful
Wink,
/// Sparkle/special
Sparkle,
}
impl MascotExpression {
/// Returns the ASCII art for this expression.
pub fn art(&self) -> &'static str {
match self {
MascotExpression::Normal => MASCOT,
MascotExpression::Thinking => MASCOT_THINKING,
MascotExpression::Happy => MASCOT_HAPPY,
MascotExpression::Working => MASCOT_WORKING,
MascotExpression::Error => MASCOT_ERROR,
MascotExpression::Success => MASCOT_SUCCESS,
MascotExpression::Sleeping => MASCOT_SLEEPING,
MascotExpression::Loading => MASCOT_LOADING,
MascotExpression::Question => MASCOT_QUESTION,
MascotExpression::Idea => MASCOT_IDEA,
MascotExpression::Wink => MASCOT_WINK,
MascotExpression::Sparkle => MASCOT_SPARKLE,
}
}
/// Returns the number of lines in the mascot art.
pub fn height(&self) -> usize {
5
}
/// Returns the approximate width of the mascot art.
pub fn width(&self) -> usize {
22
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_mascot_art() {
assert!(!MASCOT.is_empty());
assert_eq!(MASCOT.lines().count(), 5);
}
#[test]
fn test_expression_art() {
let expr = MascotExpression::default();
assert_eq!(expr.art(), MASCOT);
}
}