/* * Copyright 2025 Bryson Steck * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use colored::Colorize; pub enum ExitCode { ParseError = 2, FilesystemError = 3, RepositoryError = 4, RemoteError = 5, PushError = 6, FetchError = 7, ConfigError = 8, } pub struct ReturnData { pub code: ExitCode, pub msg: String, } pub fn error(msg: String, code: ExitCode) { eprintln!("{} {}", "error:".red().bold(), msg); quit::with_code(code as u8) } pub fn warning(msg: String) { eprintln!("{} {}", "warning:".yellow().bold(), msg) } pub fn verbose(level: u8, msg_lvl: u8, msg: String) { if level < msg_lvl { return; }; let mut prefix = String::new(); for _ in 0..msg_lvl { prefix += "="; } prefix += "> "; eprintln!("{}{}", prefix.purple().bold(), msg); }