pub fn print_changes(&self, old_snapshot: Option<&Snapshot>) {
        if let Some(value) = self.metadata.get("source") {
            println!("Source: {}", style(value).cyan());
        }
        if let Some(value) = self.metadata.get("created") {
            println!("New: {}", style(value).cyan());
        }
        let changeset = Changeset::new(
            old_snapshot.as_ref().map_or("", |x| x.contents()),
            &self.snapshot,
            "\n",
        );
        if let Some(old_snapshot) = old_snapshot {
            if let Some(value) = old_snapshot.metadata.get("created") {
                println!("Old: {}", style(value).cyan());
            }
            println!();
            println!("{}", style("-old snapshot").red());
            println!("{}", style("+new results").green());
        } else {
            println!("Old: {}", style("n.a.").red());
            println!();
            println!("{}", style("+new results").green());
        }
        print_changeset_diff(
            &changeset,
            self.metadata.get("expression").map(|x| x.as_str()),
        );
    }
/// Prints a diff against an old snapshot.
Prints a diff against an old snapshot.
Prints a diff against an old snapshot .
pub fn print_changes(&self, old_snapshot: Option<&Snapshot>) {
        if let Some(value) = self.metadata.get("source") {
            println!("Source: {}", style(value).cyan());
        }
        if let Some(value) = self.metadata.get("created") {
            println!("New: {}", style(value).cyan());
        }
        let changeset = Changeset::new(
            old_snapshot.as_ref().map_or("", |x| x.contents()),
            &self.snapshot,
            "\n",
        );
        if let Some(old_snapshot) = old_snapshot {
            if let Some(value) = old_snapshot.metadata.get("created") {
                println!("Old: {}", style(value).cyan());
            }
            println!();
            println!("{}", style("-old snapshot").red());
            println!("{}", style("+new results").green());
        } else {
            println!("Old: {}", style("n.a.").red());
            println!();
            println!("{}", style("+new results").green());
        }
        print_changeset_diff(
            &changeset,
            self.metadata.get("expression").map(|x| x.as_str()),
        );
    }
pub fn print_changes ( & self , old_snapshot : Option < & Snapshot > ) { if let Some ( value ) = self . metadata . get ( " " ) { println ! ( " " style ( value ) cyan ( ) ) ; } if let Some ( value ) = self . metadata . get ( " " ) { println ! ( " " style ( value ) cyan ( ) ) ; } let changeset = Changeset :: new ( old_snapshot . as_ref ( ) . map_or ( " " , | x | x . contents ( ) ) , & self . snapshot , " \n " , ) ; if let Some ( old_snapshot ) = old_snapshot { if let Some ( value ) = old_snapshot . metadata . get ( " " ) { println ! ( " " style ( value ) cyan ( ) ) ; } println ! ( ) ; println ! ( " " style ( " " ) red ( ) ) ; println ! ( " " style ( " " ) green ( ) ) ; } else { println ! ( " " style ( " " ) red ( ) ) ; println ! ( ) ; println ! ( " " style ( " " ) green ( ) ) ; } print_changeset_diff ( & changeset , self . metadata . get ( " " ) . map ( | x | x . as_str ( ) ) , ) ; }
Prints a diff against an old snapshot.
Prints a diff against an old snapshot .
&self
old_snapshot
Option<&Snapshot>
&self
old_snapshot
Option<&Snapshot>