tangled
alpha
login
or
join now
tgirl.cloud
/
lix-diff
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
feat: return_code
isabelroses.com
2 days ago
d7ed019c
e900deae
+25
-11
4 changed files
expand all
collapse all
unified
split
Cargo.lock
Cargo.toml
src
diff.rs
main.rs
+9
-9
Cargo.lock
···
102
103
[[package]]
104
name = "clap"
105
-
version = "4.5.54"
106
source = "registry+https://github.com/rust-lang/crates.io-index"
107
-
checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394"
108
dependencies = [
109
"clap_builder",
110
"clap_derive",
···
112
113
[[package]]
114
name = "clap_builder"
115
-
version = "4.5.54"
116
source = "registry+https://github.com/rust-lang/crates.io-index"
117
-
checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00"
118
dependencies = [
119
"anstream",
120
"anstyle",
···
124
125
[[package]]
126
name = "clap_derive"
127
-
version = "4.5.49"
128
source = "registry+https://github.com/rust-lang/crates.io-index"
129
-
checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671"
130
dependencies = [
131
"heck",
132
"proc-macro2",
···
136
137
[[package]]
138
name = "clap_lex"
139
-
version = "0.7.7"
140
source = "registry+https://github.com/rust-lang/crates.io-index"
141
-
checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32"
142
143
[[package]]
144
name = "color-eyre"
···
337
338
[[package]]
339
name = "lix-diff"
340
-
version = "1.3.0"
341
dependencies = [
342
"clap",
343
"color-eyre",
···
102
103
[[package]]
104
name = "clap"
105
+
version = "4.5.60"
106
source = "registry+https://github.com/rust-lang/crates.io-index"
107
+
checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a"
108
dependencies = [
109
"clap_builder",
110
"clap_derive",
···
112
113
[[package]]
114
name = "clap_builder"
115
+
version = "4.5.60"
116
source = "registry+https://github.com/rust-lang/crates.io-index"
117
+
checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876"
118
dependencies = [
119
"anstream",
120
"anstyle",
···
124
125
[[package]]
126
name = "clap_derive"
127
+
version = "4.5.55"
128
source = "registry+https://github.com/rust-lang/crates.io-index"
129
+
checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5"
130
dependencies = [
131
"heck",
132
"proc-macro2",
···
136
137
[[package]]
138
name = "clap_lex"
139
+
version = "1.0.0"
140
source = "registry+https://github.com/rust-lang/crates.io-index"
141
+
checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831"
142
143
[[package]]
144
name = "color-eyre"
···
337
338
[[package]]
339
name = "lix-diff"
340
+
version = "1.4.0"
341
dependencies = [
342
"clap",
343
"color-eyre",
+2
-2
Cargo.toml
···
1
[package]
2
name = "lix-diff"
3
-
version = "1.3.0"
4
license = "MIT"
5
description = "A lix plugin for diffing two generations"
6
homepage = "https://github.com/tgirlcloud/lix-diff"
···
8
edition = "2024"
9
10
[dependencies]
11
-
clap = { version = "4.5.54", features = ["derive"] }
12
color-eyre = "0.6.5"
13
humansize = "2.1.3"
14
nu-ansi-term = "0.50.3"
···
1
[package]
2
name = "lix-diff"
3
+
version = "1.4.0"
4
license = "MIT"
5
description = "A lix plugin for diffing two generations"
6
homepage = "https://github.com/tgirlcloud/lix-diff"
···
8
edition = "2024"
9
10
[dependencies]
11
+
clap = { version = "4.5.60", features = ["derive"] }
12
color-eyre = "0.6.5"
13
humansize = "2.1.3"
14
nu-ansi-term = "0.50.3"
+4
src/diff.rs
···
39
by_size: false,
40
}
41
}
0
0
0
0
42
}
43
44
impl std::fmt::Display for PackageListDiff {
···
39
by_size: false,
40
}
41
}
42
+
43
+
pub fn is_empty(&self) -> bool {
44
+
self.added.is_empty() && self.removed.is_empty() && self.changed.is_empty()
45
+
}
46
}
47
48
impl std::fmt::Display for PackageListDiff {
+10
src/main.rs
···
14
15
use self::parser::DiffRoot;
16
0
17
#[derive(Parser, PartialEq, Debug)]
18
/// List the package differences between two `NixOS` generations
19
struct Args {
···
39
/// disable the header showing the generation paths
40
#[arg(long)]
41
no_header: bool,
0
0
0
0
0
42
}
43
44
fn main() -> Result<()> {
···
95
}
96
97
println!("{packages}");
0
0
0
0
98
99
Ok(())
100
}
···
14
15
use self::parser::DiffRoot;
16
17
+
#[allow(clippy::struct_excessive_bools)]
18
#[derive(Parser, PartialEq, Debug)]
19
/// List the package differences between two `NixOS` generations
20
struct Args {
···
40
/// disable the header showing the generation paths
41
#[arg(long)]
42
no_header: bool,
43
+
44
+
/// add a return code indicating whether there are changes or no (1 if there are no changes, 0
45
+
/// otherwise)
46
+
#[arg(short, long = "return")]
47
+
return_code: bool,
48
}
49
50
fn main() -> Result<()> {
···
101
}
102
103
println!("{packages}");
104
+
105
+
if args.return_code {
106
+
std::process::exit(if packages.is_empty() { 1 } else { 0 });
107
+
}
108
109
Ok(())
110
}