BD456SZFVRW32OG6PN2TN5R3SAGMVH64KW7HQA7LHAVXMIA4HIJAC
F6YAQWVDXG6UZBJPJDTIJBQDBMXVMT7P6INK6GPJ5SR3BDDRX4EQC
NBBTJI4IO3HF6V4PCXQYBBSB6CON2UHO46PJ3GXBZZ6FOECKUL5AC
NSE6BLWA372T3TYEVMOKWWD725NRYQNLJGWEVXAIQ3EP6R2YNQ7QC
XERTHGSY3OMO7CBVVHIXI7LH6JY4AOS7BA6WQP22JBO2NDWGBH4QC
337EO2TURD5ELICUPPC5ZX6ZEOQXT4PVWTE7WKI7VUQPPCUDLFAQC
HZV5P57YJPTWI34HC5KDGZNOREGME2PBKT3W24DSYFE72UAAYRJQC
IQY5LHEN34KNUOZ75S5V5LZDZQCZ65LV7YXXRYJMIE6WSXMKFMXAC
SOTD66FO7FA67P4DEOYPKURE45J45PTFVT66OF54SUYJYUBAADJQC
NCRTU7M46QRJ4VHTNJQ6OFHCGX5M2GGTUY2J5UW3RWEQSAYOGVPAC
4RPYR65C4IEKV3INJ67NN4DOH37UDY45EE7VGF55ZKDFH75LXLJAC
in-out property <bool> is-selected: false;
in property <bool> has-hover;
states [
selected when root.is-selected: {
root.background: Palette.selection-background;
label.color: Palette.selection-foreground;
}
lowlighted when root.has-hover: {
root.background: Palette.alternate-background;
label.color: Palette.alternate-foreground;
}
]
Ok(delta) => delta,
Err(e) => {
println!("{:?}", e);
return;
}
};
ui.set_delta((&String::from(delta)[..]).into());
}
});
ui.on_request_diff_delta({
let ui_handle = ui.as_weak();
move |ch_name: SharedString| {
let ch_name = ch_name.as_str();
let ui = ui_handle.unwrap();
let exe_path_string = ui.get_exe_path();
let exe_path = Path::new(exe_path_string.as_str());
let repo_path_string = ui.get_repo_path();
let repo_path = Path::new(repo_path_string.as_str());
let diff_output = cmds::diff(
exe_path,
repo_path,
Some(ch_name).filter(|cn| !cn.is_empty()),
);
let delta = match diff_output {
let output = cmd.output()?;
check_exit_status(cmd, output.status)?;
// TODO this will fail when diffing binary data
Ok(String::from_utf8(output.stdout)?)
}
pub fn diff(
exe: &std::path::Path,
repo: &std::path::Path,
ch_name_maybe: Option<&str>,
) -> Result<String, Error> {
let mut cmd = Command::new(exe);
let cmd = cmd
.arg("diff")
.arg("--no-prompt")
.arg("--repository")
.arg(repo);
if let Some(ch_name) = ch_name_maybe {
cmd.arg("--channel").arg(ch_name);
}