nu-scripts/flatpak-updater.nu

24 lines
606 B
Plaintext
Executable file

#!/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"
} else {
notify "Unattended update complete.\nConsider restarting presently running flatpaks."
}
}
}
# Documentation for main
def main [] {
update_flatpaks
}