nu-scripts/flatpak-updater.nu

24 lines
606 B
Plaintext
Raw Normal View History

2024-03-15 13:51:15 +01:00
#!/usr/bin/env nu
# Documentation for notify
def notify [message: string, prefix?: string] {
notify-send $"Flatpak updater ($prefix)" $message
}
def update_flatpaks [] {
notify "Starting unattended flatpak update..."
let flatpak_status = do { flatpak update -y } | complete
if $flatpak_status != 0 {
if $flatpak_status.stderr != "" {
notify $flatpak_status.stderr "stderr"
2024-03-20 01:32:01 +01:00
} else {
notify "Unattended update complete.\nConsider restarting presently running flatpaks."
}
2024-03-15 13:51:15 +01:00
}
}
# Documentation for main
def main [] {
update_flatpaks
2024-03-20 01:32:01 +01:00
}