From 97ee8f09a4f8d9b26265b815c7a0091e835b4e02 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Mon, 15 May 2023 13:41:04 +0000 Subject: [PATCH] feat: exit with error if no packages found to download --- distro.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/distro.go b/distro.go index 048ec3f..31a1807 100644 --- a/distro.go +++ b/distro.go @@ -83,6 +83,8 @@ func (cmd DebianGetDebCmd) Run() (err error) { } defer os.RemoveAll(tmp) + hasresults := false + for _, pkg := range packages { if cmd.IgnoreCached { log.Debug().Msgf("check cache for %s", pkg.Deb.Name) @@ -112,7 +114,12 @@ func (cmd DebianGetDebCmd) Run() (err error) { if err != nil { log.Fatal().Err(err).Msg("mv") } + + hasresults = true } + if !hasresults { + log.Fatal("no packages found to download") + } return }