diff --git a/lib/cntfy.nu b/lib/cntfy.nu index 9a28fb5..937b1c1 100755 --- a/lib/cntfy.nu +++ b/lib/cntfy.nu @@ -12,6 +12,11 @@ export def publish [ ] { let cfg = ( config read_file cntfy ) + if ( $env.NTFY_LIMIT? == 0) { + sleep 5sec + let-env NTFY_LIMIT = 3 + } + let request_body = ({ topic: $topic title: $title diff --git a/podman-update-check b/podman-update-check index 87a46d3..88e988d 100755 --- a/podman-update-check +++ b/podman-update-check @@ -49,9 +49,25 @@ export def needs_update [] { def print_needs_update [ntfy: bool] { let data = $in - print $"Image `($data.Name)` needs to be updated." + let containers = ( containers_for_image $data.Name ) + print $"Image `($data.Name)` needs to be updated. Used by ($containers | str join ', ')" if $ntfy { - cntfy publish --tags [ podman $data.Name ] --priority 4 --title $"($data.Name) outdated" "updates" $"Container ($data.Name) needs to be updated." + ( + cntfy publish + --tags [ podman $data.Name ] + --priority 4 + --title $"($data.Name) outdated" + "updates" $"Container ($data.Name) needs to be updated. Used by ($data.Containers) containers. Used by: ( $containers | str join '\n' )" + ) } +} + +def containers_for_image [image: string] { + ( podman container ls --all --format json + | from json + | where Image == $image + | insert Name {|$it| $it.Names? | get 0 } + | get Name + ) } \ No newline at end of file