| 1 | // Package cmd provides exit codes and result types for the Shoutrrr CLI. |
| 2 | package cmdscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ |
| 3 | |
| 4 | // ExitError contains the final exit message and code for a CLI session. |
| 5 | type ExitErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError# struct { |
| 6 | // ExitCode is the numeric exit code returned to the operating system. |
| 7 | ExitCodescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError#ExitCode. int |
| 8 | // Message is the human-readable error message. |
| 9 | Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError#Message. string |
| 10 | } |
| 11 | |
| 12 | const ( |
| 13 | // ExSuccess is the exit code that signals that everything went as expected. |
| 14 | ExSuccessscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExSuccess. = 0 |
| 15 | // ExUsage is the exit code that signals that the application was not started with the correct arguments. |
| 16 | ExUsagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExUsage. = 64 |
| 17 | // ExUnavailable is the exit code that signals that the application failed to perform the intended task. |
| 18 | ExUnavailablescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExUnavailable. = 69 |
| 19 | // ExConfig is the exit code that signals that the task failed due to a configuration error. |
| 20 | ExConfigscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExConfig. = 78 |
| 21 | ) |
| 22 | |
| 23 | // ErrNil is the empty ExitError that is used whenever the command ran successfully. |
| 24 | var ErrNilscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ErrNil. = ExitErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError#{ |
| 25 | ExitCodescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError#ExitCode.: 0, |
| 26 | Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError#Message.: "", |
| 27 | } |
| 28 | |
| 29 | // Error returns the error message for the ExitError. |
| 30 | // This implements the error interface. |
| 31 | func (e ExitErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError#) Errorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError#Error().() string { |
| 32 | return e.Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError#Message. |
| 33 | } |
| 34 | |
| 35 | // InvalidUsage returns an ExitError with the exit code ExUsage. |
| 36 | // |
| 37 | // Parameters: |
| 38 | // - message: The error message describing the invalid usage. |
| 39 | // |
| 40 | // Returns: |
| 41 | // - ExitError: An ExitError with ExitCode set to ExUsage. |
| 42 | func InvalidUsagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/InvalidUsage().(message string) ExitErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError# { |
| 43 | return ExitErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError#{ |
| 44 | ExUsagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExUsage., |
| 45 | message, |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // TaskUnavailable returns an ExitError with the exit code ExUnavailable. |
| 50 | // |
| 51 | // Parameters: |
| 52 | // - message: The error message describing why the task was unavailable. |
| 53 | // |
| 54 | // Returns: |
| 55 | // - ExitError: An ExitError with ExitCode set to ExUnavailable. |
| 56 | func TaskUnavailablescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/TaskUnavailable().(message string) ExitErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError# { |
| 57 | return ExitErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError#{ |
| 58 | ExUnavailablescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExUnavailable., |
| 59 | message, |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // ConfigurationError returns an ExitError with the exit code ExConfig. |
| 64 | // |
| 65 | // Parameters: |
| 66 | // - message: The error message describing the configuration error. |
| 67 | // |
| 68 | // Returns: |
| 69 | // - ExitError: An ExitError with ExitCode set to ExConfig. |
| 70 | func ConfigurationErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ConfigurationError().(message string) ExitErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError# { |
| 71 | return ExitErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExitError#{ |
| 72 | ExConfigscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/shoutrrr/cmd`/ExConfig., |
| 73 | message, |
| 74 | } |
| 75 | } |