Skip to main content

drizzle_cli/
output.rs

1//! CLI output helpers for consistent, drizzle-kit-like formatting.
2
3use colored::Colorize;
4
5#[must_use]
6pub fn heading(text: &str) -> String {
7    format!("{}", text.bright_cyan())
8}
9
10#[must_use]
11pub fn label(text: &str) -> String {
12    format!("{}", text.bright_blue())
13}
14
15#[must_use]
16pub fn muted(text: &str) -> String {
17    format!("{}", text.bright_black())
18}
19
20#[must_use]
21pub fn success(text: &str) -> String {
22    format!("{}", text.bright_green())
23}
24
25#[must_use]
26pub fn warning(text: &str) -> String {
27    format!("{}", text.yellow())
28}
29
30#[must_use]
31pub fn error(text: &str) -> String {
32    format!("{}", text.red())
33}
34
35#[must_use]
36pub fn info(text: &str) -> String {
37    format!("{} {}", "Info:".bright_blue().bold(), text)
38}
39
40#[must_use]
41pub fn warn_line(text: &str) -> String {
42    format!("[{}] {}", "Warning".yellow(), text)
43}
44
45#[must_use]
46pub fn err_line(text: &str) -> String {
47    format!("{} {}", "Error".red().bold(), text)
48}
49
50#[must_use]
51pub fn banner_invalid_input(text: &str) -> String {
52    format!("{} {}", " Invalid input ".white().on_red(), text.red())
53}
54
55#[must_use]
56pub fn banner_warning(text: &str) -> String {
57    format!("{} {}", " Warning ".white().on_bright_black(), text)
58}
59
60#[must_use]
61pub fn banner_error(text: &str) -> String {
62    format!("{} {}", " Error ".white().on_red().bold(), text)
63}
64
65#[must_use]
66pub fn banner_suggestion(text: &str) -> String {
67    format!("{} {}", " Suggestion ".white().on_bright_black(), text)
68}
69
70#[must_use]
71pub fn status_ok() -> String {
72    format!("{}", "OK".green())
73}
74
75#[must_use]
76pub fn status_error() -> String {
77    format!("{}", "ERROR".red())
78}
79
80#[must_use]
81pub fn status_warning(text: &str) -> String {
82    format!("{}", text.yellow())
83}