mirror of
https://github.com/tarampampam/error-pages.git
synced 2025-07-26 03:22:14 +00:00
30 lines
610 B
Go
30 lines
610 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/fatih/color"
|
|
"github.com/tarampampam/error-pages/internal/cli"
|
|
)
|
|
|
|
// exitFn is a function for application exiting.
|
|
var exitFn = os.Exit //nolint:gochecknoglobals
|
|
|
|
// main CLI application entrypoint.
|
|
func main() { exitFn(run()) }
|
|
|
|
// run this CLI application.
|
|
// Exit codes documentation: <https://tldp.org/LDP/abs/html/exitcodes.html>
|
|
func run() int {
|
|
cmd := cli.NewCommand(filepath.Base(os.Args[0]))
|
|
|
|
if err := cmd.Execute(); err != nil {
|
|
_, _ = color.New(color.FgHiRed, color.Bold).Fprintln(os.Stderr, err.Error())
|
|
|
|
return 1
|
|
}
|
|
|
|
return 0
|
|
}
|