Initial commit
1 files changed, 41 insertions, 0 deletions
diff --git a/LibSystemdCli.Models/SystemdUnitList.cs b/LibSystemdCli.Models/SystemdUnitList.cs
new file mode 100644
index 0000000..d6cba63
--- /dev/null
+++ b/LibSystemdCli.Models/SystemdUnitList.cs
@@ -0,0 +1,41 @@
+using System.Text.Json.Serialization;
+
+namespace LibSystemdCli.Models;
+
+public class SystemdUnitListItem {
+ [JsonPropertyName("unit")]
+ public string Unit { get; set; } = null!;
+
+ [JsonPropertyName("description")]
+ public string Description { get; set; } = null!;
+
+ [JsonPropertyName("load")]
+ public string Load { get; set; } = null!;
+
+ [JsonPropertyName("active")]
+ public string Active { get; set; } = null!;
+
+ [JsonPropertyName("sub")]
+ public string Sub { get; set; } = null!;
+
+ [JsonPropertyName("job")]
+ public string Job { get; set; } = null!;
+
+
+ [JsonPropertyName("x-fragment-paths")]
+ public List<string> FragmentPaths { get; set; } = null!;
+
+ [JsonIgnore]
+ public string UnitType => Unit.Split('.').Last();
+
+ [JsonIgnore]
+ public bool IsSystem => IsGenerated || IsFromPackage;
+
+ [JsonIgnore]
+ public bool IsGenerated => FragmentPaths.Any(x => x.StartsWith("/run/systemd/generator/"))
+ || FragmentPaths.Any(x=>x.StartsWith("/run/systemd/transient/"))
+ || FragmentPaths.Count == 0;
+
+ [JsonIgnore]
+ public bool IsFromPackage => FragmentPaths.Any(x => x.StartsWith("/usr/lib/systemd/"));
+}
\ No newline at end of file
|