common

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2024 License: GPL-3.0, LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger = lib.Logger{
	LogFunc: func(log lib.Log) string {
		var severityPretty string
		switch log.Level {
		case "INFO":
			severityPretty = color.GreenString("[INFO]")
		case "WARN":
			severityPretty = color.YellowString("[WARN]")
		case "ERROR":
			severityPretty = color.HiYellowString("[ERROR]")
		case "CRITICAL":
			severityPretty = color.HiRedString("[CRITICAL]")
		case "FATAL":
			fmt.Println(color.RedString("[FATAL]"), log.Content)
			os.Exit(1)
		default:
			severityPretty = color.WhiteString("[" + strings.ToUpper(log.Level) + "]")
		}
		fmt.Println(severityPretty, log.Content)
		if log.Prompt {
			fmt.Print(": ")
			reader := bufio.NewReader(os.Stdin)
			userInput, err := reader.ReadString('\n')
			if err != nil {
				fmt.Println(color.RedString("[FATAL]"), "Failed to read user input:", err)
				os.Exit(1)
			} else {
				return userInput[:len(userInput)-1]
			}
		}
		return ""
	},
	PromptSupported: true,
	StdoutSupported: true,
	Stdout:          os.Stdout,
}
View Source
var LoadPrivateKeyEmptyBlockError = errors.New("blocks returned by pem.Decode are empty")
View Source
var LoadPrivateKeyFolderCreateError = errors.New("failed to create folder")
View Source
var LoadPrivateKeyGenerateError = errors.New("failed to generate private key")
View Source
var LoadPrivateKeyHomedirError = errors.New("failed to get home directory")
View Source
var LoadPrivateKeyMarshalError = errors.New("failed to marshal private key")
View Source
var LoadPrivateKeyNotEd25519Error = errors.New("private key is not ed25519")
View Source
var LoadPrivateKeyParseError = errors.New("failed to parse private key")
View Source
var LoadPrivateKeyReadError = errors.New("failed to read private key")
View Source
var LoadPrivateKeyWriteError = errors.New("failed to write private key")

Functions

func BuildEPKHandleError

func BuildEPKHandleError(tempDir string, err error, vagueError error, logger *lib.Logger)

BuildEPKHandleError handles errors related to the building of EPKs

func BuildEPKRemoveTemporaryDirectory

func BuildEPKRemoveTemporaryDirectory(tempDir string, logger *lib.Logger)

BuildEPKRemoveTemporaryDirectory removes the temporary directory created by BuildEPK

func EternityJsonHandleError

func EternityJsonHandleError(err error, vagueError error, logger *lib.Logger)

EternityJsonHandleError handles errors related to the parsing of eternity.json

func GenerateRepositoryHandleError

func GenerateRepositoryHandleError(err error, vagueError error, logger *lib.Logger)

func LoadPrivateKey

func LoadPrivateKey(logger *lib.Logger) (ed25519.PrivateKey, error, error)

LoadPrivateKey loads the private key from $HOME/.local/share/eternity/private.key

func LoadPrivateKeyHandleError

func LoadPrivateKeyHandleError(err error, vagueError error, logger *lib.Logger)

LoadPrivateKeyHandleError handles errors related to LoadPrivateKey

func PackageEPKHandleError

func PackageEPKHandleError(err error, vagueError error, logger *lib.Logger)

PackageEPKHandleError handles errors related to the packaging of EPKs

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL