Add documentation comments to exit

This commit is contained in:
Diego Fernando Carrión 2022-11-01 17:57:45 +01:00
parent c824df3cb2
commit 7a629ccb41
No known key found for this signature in database
GPG Key ID: 811EF2E03998BFC4

View File

@ -4,6 +4,7 @@ import (
"gitlab.com/CRThaze/cworthy/errno"
)
// ExitT represents an unsigned 16 bit integer used to define exit statuses.
type ExitT errno.ErrorT
const (
@ -51,10 +52,14 @@ func init() {
exitDescs[EX_ABORT] = "process aborted"
}
// Desc returns the description string for a given ExitCode.
func (e ExitT) Desc() string {
return exitDescs[e]
}
// GetAllExitCodeDescriptions returns an array of all possible ExitCode description
// strings (where the index is the exit code). Any unreserved ExitCodes are also
// included with empty string descriptions.
func GetAllExitCodeDescriptions() [^ExitT(0)]string {
return exitDescs
}