Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(cli): report automation rule counts in doctor output

Richie McIlroyc9bc08a23c94
diff --git a/apps/cli/src/doctor.rs b/apps/cli/src/doctor.rs
index f821265ea..0e035eea9 100644
--- a/apps/cli/src/doctor.rs
+++ b/apps/cli/src/doctor.rs
@@ -386,6 +386,13 @@ fn capture_ready(permissions: &Permissions) -> bool {
}
}
+#[derive(Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct AutomationsInfo {
+ pub rule_count: usize,
+ pub enabled_count: usize,
+}
+
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Doctor {
@@ -395,6 +402,8 @@ pub struct Doctor {
#[serde(skip_serializing_if = "Option::is_none")]
pub install: Option<cap_cli_install::CliInstallStatus>,
pub checks: Vec<Check>,
+ /// Automation rules shared with Cap Desktop that the CLI honors after capture/upload.
+ pub automations: AutomationsInfo,
/// Overall health: false when a required check (e.g. ffmpeg) failed.
pub ok: bool,
/// Whether a screen recording can start right now (screen recording permission granted).
@@ -451,12 +460,18 @@ pub fn run_doctor(format: OutputFormat) -> Result<(), String> {
.any(|check| matches!(check.status, CheckStatus::Fail));
let capture_ready = capture_ready(&permissions);
+ let (rule_count, enabled_count) = crate::automation::rule_counts();
+
let doctor = Doctor {
schema_version: SCHEMA_VERSION,
version,
permissions,
install: install.ok(),
checks,
+ automations: AutomationsInfo {
+ rule_count,
+ enabled_count,
+ },
ok,
capture_ready,
};
@@ -473,6 +488,10 @@ pub fn run_doctor(format: OutputFormat) -> Result<(), String> {
println!(" executable: {path}");
}
println!(" capture ready: {}", doctor.capture_ready);
+ println!(
+ " automations: {} rule(s), {} enabled",
+ doctor.automations.rule_count, doctor.automations.enabled_count
+ );
println!();
for check in &doctor.checks {
println!(