Print ok-ish stuff to stdout

This commit is contained in:
2022-06-13 22:47:49 +02:00
parent 6f4ae88260
commit 73158e3d47
2 changed files with 6 additions and 7 deletions

View File

@@ -303,7 +303,6 @@ def test_repos_sync_root_is_file(configtype):
cmd = grm(["repos", "sync", "config", "--config", config.name])
assert cmd.returncode != 0
assert len(cmd.stdout) == 0
assert "not a directory" in cmd.stderr.lower()

View File

@@ -20,12 +20,12 @@ pub fn print_repo_action(repo: &str, message: &str) {
}
pub fn print_action(message: &str) {
let stderr = Term::stderr();
let stdout = Term::stdout();
let mut style = Style::new().yellow();
if stderr.is_term() {
if stdout.is_term() {
style = style.force_styling(true);
}
stderr
stdout
.write_line(&format!("[{}] {}", style.apply_to('\u{2699}'), &message))
.unwrap();
}
@@ -46,13 +46,13 @@ pub fn print_repo_success(repo: &str, message: &str) {
}
pub fn print_success(message: &str) {
let stderr = Term::stderr();
let stdout = Term::stdout();
let mut style = Style::new().green();
if stderr.is_term() {
if stdout.is_term() {
style = style.force_styling(true);
}
stderr
stdout
.write_line(&format!("[{}] {}", style.apply_to('\u{2714}'), &message))
.unwrap();
}