diff --git a/app/app.go b/app/app.go index bff5dd7..e15ec08 100644 --- a/app/app.go +++ b/app/app.go @@ -23,6 +23,7 @@ type Options struct { PushPrefix string `short:"R" long:"push-prefix" description:"[Re]Push pulled images with a specified repo path prefix" env:"PUSH_PREFIX"` InsecureRegistry bool `short:"i" long:"insecure-registry" description:"Use insecure plain-HTTP connection to registries (not recommended!)" env:"INSECURE_REGISTRY"` TraceRequests bool `short:"T" long:"trace-requests" description:"Trace Docker registry HTTP requests" env:"TRACE_REQUESTS"` + DoNotFail bool `short:"N" long:"do-not-fail" description:"Do not fail on errors (could be dangerous!)" env:"DO_NOT_FAIL"` Version bool `short:"V" long:"version" description:"Show version and exit"` Positional struct { Repositories []string `positional-arg-name:"REPO1 REPO2 REPOn" description:"Docker repositories to operate on, e.g.: alpine nginx~/1\\.13\\.5$/ busybox~/1.27.2/"` diff --git a/main.go b/main.go index f2f05dd..ecb4fab 100644 --- a/main.go +++ b/main.go @@ -12,9 +12,14 @@ import ( "github.com/ivanilves/lstags/tag/registry" ) +var doNotFail bool + func suicide(err error) { fmt.Printf("%s\n", err.Error()) - os.Exit(1) + + if !doNotFail { + os.Exit(1) + } } func getVersion() string { @@ -49,6 +54,8 @@ func main() { auth.WebSchema = o.GetWebSchema() registry.WebSchema = o.GetWebSchema() + doNotFail = o.DoNotFail + const format = "%-12s %-45s %-15s %-25s %s\n" fmt.Printf(format, "", "", "<(local) ID>", "", "")