1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Conserve backup system.
// Copyright 2015, 2016, 2018 Martin Pool.

//! Display log messages to stdout with no color or cursor movement,
//! perhaps for a log file.

use super::Report;

#[derive(Debug, Default)]
pub struct PlainUI;

/// A plain text UI that can be used when there is no terminal control.
///
/// Progress updates are just ignored.
impl PlainUI {
    /// Make a PlainUI.
    pub fn new() -> PlainUI {
        PlainUI {}
    }
}

impl super::UI for PlainUI {
    fn show_progress(&mut self, _report: &Report) {}

    fn print(&mut self, s: &str) {
        println!("{}", s);
    }

    fn problem(&mut self, s: &str) {
        self.print(s)
    }

    fn finish(&mut self) {}
}