From 6fc14514d7fa3c82234713697fe918f865c8372d Mon Sep 17 00:00:00 2001 From: Antoine Clarman Date: Mon, 26 Feb 2024 16:21:50 +0100 Subject: [PATCH] chore(cli): add exit flag --- cmd/koherence/main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/koherence/main.go b/cmd/koherence/main.go index e757e20..7cb3ab4 100644 --- a/cmd/koherence/main.go +++ b/cmd/koherence/main.go @@ -9,11 +9,22 @@ import ( ) func main() { + var exitValue int + app := cli.NewApp() app.Name = "koherence" app.Usage = "Openstack/Kube/Machine coherence checker" app.Version = version.Version + app.Flags = []cli.Flag{ + cli.IntFlag{ + Name: "exit, e", + Value: 1, + Usage: "value returned on error", + Destination: &exitValue, + }, + } + app.Commands = []cli.Command{ debugCommand, checkCommand, @@ -25,6 +36,6 @@ func main() { "main() error", slog.String("error", err.Error()), ) - os.Exit(1) + os.Exit(exitValue) } }