mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 16:39:37 +00:00
refactor: the style system has been changed and replaced functions (printc, colored) have been removed in src/utils/cli_styles.rs. Most files in src/cli have been heavily modified to migrate to the new system
This commit is contained in:
@@ -15,43 +15,33 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
pub use owo_colors::{OwoColorize as Colorize, Style};
|
||||
|
||||
// Сli theme styles
|
||||
// Main
|
||||
#[allow(dead_code)]
|
||||
pub const RESET: &str = "\x1b[0m";
|
||||
pub const BOLD_RED: Style = Style::new().bright_red().bold();
|
||||
#[allow(dead_code)]
|
||||
pub const BOLD_GREEN: Style = Style::new().bright_green().bold();
|
||||
#[allow(dead_code)]
|
||||
pub const BOLD_YELLOW: Style = Style::new().bright_yellow().bold();
|
||||
#[allow(dead_code)]
|
||||
pub const BOLD_CYAN: Style = Style::new().bright_cyan().bold();
|
||||
#[allow(dead_code)]
|
||||
pub const BOLD_BLUE: Style = Style::new().bright_blue().bold();
|
||||
|
||||
// Help
|
||||
#[allow(dead_code)]
|
||||
pub const BOLD: &str = "\x1b[1m";
|
||||
pub const HELP_SECTION_TITLE_ST: Style = BOLD_GREEN;
|
||||
#[allow(dead_code)]
|
||||
pub const HELP_EXAMPLES_ST: Style = BOLD_CYAN;
|
||||
|
||||
// Other
|
||||
#[allow(dead_code)]
|
||||
pub const BRIGHT_RED: &str = "\x1b[91m";
|
||||
pub const ERROR_ST: Style = BOLD_RED;
|
||||
#[allow(dead_code)]
|
||||
pub const BRIGHT_GREEN: &str = "\x1b[92m";
|
||||
pub const SUCCESS_ST: Style = BOLD_GREEN;
|
||||
#[allow(dead_code)]
|
||||
pub const BRIGHT_YELLOW: &str = "\x1b[93m";
|
||||
pub const ALERT_ST: Style = BOLD_YELLOW;
|
||||
#[allow(dead_code)]
|
||||
pub const BRIGHT_CYAN: &str = "\x1b[96m";
|
||||
#[allow(dead_code)]
|
||||
pub const BOLD_RED: &str = "\x1b[1m\x1b[91m";
|
||||
#[allow(dead_code)]
|
||||
pub const BOLD_GREEN: &str = "\x1b[1m\x1b[92m";
|
||||
#[allow(dead_code)]
|
||||
pub const BOLD_YELLOW: &str = "\x1b[1m\x1b[93m";
|
||||
#[allow(dead_code)]
|
||||
pub const BOLD_CYAN: &str = "\x1b[1m\x1b[96m";
|
||||
|
||||
/// Applies ANSI escape codes to format the message with the given style.
|
||||
///
|
||||
/// This is a utility for colored output in terminal applications.
|
||||
#[allow(dead_code)]
|
||||
pub fn colored(msg: &str, style: &str) -> String {
|
||||
format!("{style}{msg}{RESET}")
|
||||
}
|
||||
|
||||
/// Prints `msg` to stdout with the given ANSI `style`.
|
||||
#[allow(dead_code)]
|
||||
pub fn printc(msg: &str, style: &str) {
|
||||
println!("{style}{msg}{RESET}");
|
||||
}
|
||||
pub const SKIP_ST: Style = BOLD_BLUE;
|
||||
|
||||
Reference in New Issue
Block a user