MCPcopy Create free account
hub / github.com/docker/docker-language-server / Execute

Function Execute

internal/pkg/cli/cli.go:52–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50}
51
52func Execute() {
53 logLevel.Set(slog.LevelError)
54
55 logger := slog.New(slog.NewJSONHandler(
56 os.Stderr,
57 &slog.HandlerOptions{
58 AddSource: true,
59 Level: &logLevel,
60 },
61 ))
62 ctx, cancel := context.WithCancel(context.Background())
63 defer cancel()
64 setupSignalHandler(cancel)
65
66 err := NewRootCmd("docker-language-server").ExecuteContext(ctx)
67 if err != nil {
68 if !isCobraError(err) {
69 logger.Error("fatal error", "error", err)
70 }
71 os.Exit(1)
72 }
73}
74
75func setupSignalHandler(cancel context.CancelFunc) {
76 c := make(chan os.Signal, 1)

Callers 1

mainFunction · 0.92

Calls 3

setupSignalHandlerFunction · 0.85
NewRootCmdFunction · 0.85
isCobraErrorFunction · 0.85

Tested by

no test coverage detected