MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / main

Function main

app/cli/main.go:35–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33)
34
35func main() {
36 // Couldn't find an easier way to disable the timestamp.
37 // Enable color on interactive terminals and CI systems that render ANSI,
38 // and disable it for ANSI-incapable consumers (e.g. a Jenkins console
39 // without the AnsiColor plugin, piped output) to avoid leaking raw escape
40 // codes. See cmd.LogColorDisabled.
41 logger := zerolog.New(zerolog.ConsoleWriter{
42 Out: os.Stderr,
43 NoColor: cmd.LogColorDisabled(),
44 FormatTimestamp: func(interface{}) string { return "" },
45 })
46 rootCmd := cmd.NewRootCmd(logger)
47 if err := cmd.Execute(rootCmd); err != nil {
48 msg, exitCode := errorInfo(err, logger)
49 logger.Error().Msg(msg)
50 os.Exit(exitCode)
51 }
52}
53
54// handle predefined errors and handle types so we can tailor the experience
55func errorInfo(err error, logger zerolog.Logger) (string, int) {

Callers

nothing calls this directly

Calls 5

LogColorDisabledFunction · 0.92
NewRootCmdFunction · 0.92
ExecuteFunction · 0.92
errorInfoFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected