cmd-usage 0.7.13

Live Command Code (commandcode.ai) usage dashboard: credits, 5-hour and weekly windows, plan limits. Watch mode or one-shot.
Documentation
//! Desktop notifications. Best-effort: runs on a detached thread and silently
//! no-ops if the OS tool is missing. macOS uses osascript, Linux notify-send.

/// Notify that a spend window hit its cap. `title`/`body` come from the caller
/// so each binary can phrase its own message.
pub fn cap(title: &str, body: &str) {
    let title = title.to_string();
    let body = body.to_string();
    std::thread::spawn(move || {
        if cfg!(target_os = "macos") {
            let script = format!(
                "display notification \"{}\" with title \"{}\"",
                body.replace('\\', "\\\\").replace('"', "\\\""),
                title
            );
            let _ = std::process::Command::new("osascript")
                .arg("-e")
                .arg(script)
                .status();
        } else if cfg!(target_os = "linux") {
            let _ = std::process::Command::new("notify-send")
                .arg(&title)
                .arg(&body)
                .status();
        }
    });
}