Adding upstream version 0.8.9.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
3b2c48b5e4
commit
c0c4addb85
285 changed files with 25880 additions and 0 deletions
53
shoutrrr/cmd/exit_codes.go
Normal file
53
shoutrrr/cmd/exit_codes.go
Normal 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,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue