1#[must_use]
3pub fn new() -> Diff<'static> {
4 Diff::new()
5}
6
7#[derive(Debug)]
11pub struct Diff<'a> {
12 base: crate::RepoBase<'a>,
13 exit_code: bool,
14}
15
16crate::impl_repo_base!(Diff);
17
18impl<'a> Diff<'a> {
19 #[must_use]
20 fn new() -> Self {
21 Self {
22 base: crate::RepoBase::default(),
23 exit_code: false,
24 }
25 }
26
27 #[must_use]
33 pub fn exit_code(mut self) -> Self {
34 self.exit_code = true;
35 self
36 }
37}
38
39impl Default for Diff<'_> {
40 fn default() -> Self {
41 Self::new()
42 }
43}
44
45impl crate::Build for Diff<'_> {
46 fn build(self) -> Result<cmd_proc::Command, crate::EnvError> {
47 Ok(self
48 .base
49 .command()?
50 .argument("diff")
51 .optional_flag(self.exit_code, "--exit-code"))
52 }
53}