1
0
Fork 0

Adding upstream version 0.8.9.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-22 10:16:14 +02:00
parent 3b2c48b5e4
commit c0c4addb85
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
285 changed files with 25880 additions and 0 deletions

View file

@ -0,0 +1,53 @@
package cmd
const (
// ExSuccess is the exit code that signals that everything went as expected.
ExSuccess = 0
// ExUsage is the exit code that signals that the application was not started with the correct arguments.
ExUsage = 64
// ExUnavailable is the exit code that signals that the application failed to perform the intended task.
ExUnavailable = 69
// ExConfig is the exit code that signals that the task failed due to a configuration error.
ExConfig = 78
)
// Success is the empty Result that is used whenever the command ran successfully.
//
//nolint:errname
var Success = Result{}
// Result contains the final exit message and code for a CLI session.
//
//nolint:errname
type Result struct {
ExitCode int
Message string
}
func (e Result) Error() string {
return e.Message
}
// InvalidUsage returns a Result with the exit code ExUsage.
func InvalidUsage(message string) Result {
return Result{
ExUsage,
message,
}
}
// TaskUnavailable returns a Result with the exit code ExUnavailable.
func TaskUnavailable(message string) Result {
return Result{
ExUnavailable,
message,
}
}
// ConfigurationError returns a Result with the exit code ExConfig.
func ConfigurationError(message string) Result {
return Result{
ExConfig,
message,
}
}