-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add warning for using CPU mode (#1219)
* feat: Add warning for using CPU mode * Adjust warning message and create helper function for printing formatted info messages * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * Apply suggestions --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b75f12e
commit a3e3ebc
Showing
5 changed files
with
63 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
pub enum HeaderFormat { | ||
BoldWhite, | ||
BoldBlue, | ||
BoldYellow, | ||
Blue, | ||
} | ||
|
||
impl HeaderFormat { | ||
fn prefix(&self) -> &str { | ||
match self { | ||
HeaderFormat::BoldWhite => "\x1b[1m", | ||
HeaderFormat::BoldBlue => "\x1b[34;1m", | ||
HeaderFormat::BoldYellow => "\x1b[93;1m", | ||
HeaderFormat::Blue => "\x1b[34m", | ||
} | ||
} | ||
|
||
pub fn format(&self, header: &str) -> String { | ||
format!("{}{header}\x1b[0m", self.prefix()) | ||
} | ||
} | ||
|
||
pub fn show_info(header: &str, style: HeaderFormat, content: &[&str]) { | ||
eprintln!(" {}", style.format(header)); | ||
for line in content { | ||
eprintln!(" {line}"); | ||
} | ||
eprintln!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters