This commit is contained in:
2025-04-13 20:22:32 +03:00
parent b8cb7af3bb
commit e3aaa88822
8 changed files with 139 additions and 109 deletions

View File

@ -17,6 +17,7 @@
package cliutils
import (
"errors"
"fmt"
"log/slog"
@ -52,5 +53,8 @@ func FormatCliExit(msg string, err error) cli.ExitCoder {
}
func FormatCliExitWithCode(msg string, err error, exitCode int) cli.ExitCoder {
if err == nil {
return cli.Exit(errors.New(msg), exitCode)
}
return cli.Exit(fmt.Errorf("%s: %w", msg, err), exitCode)
}