cmd/gitlab-shell-check/command/command.go (17 lines of code) (raw):

// Package command provides functionality for executing commands package command import ( "gitlab.com/gitlab-org/gitlab-shell/v14/internal/command" "gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/healthcheck" "gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/readwriter" "gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/shared/disallowedcommand" "gitlab.com/gitlab-org/gitlab-shell/v14/internal/config" ) // New creates a new command based on the provided configuration and readWriter func New(config *config.Config, readWriter *readwriter.ReadWriter) (command.Command, error) { if cmd := build(config, readWriter); cmd != nil { return cmd, nil } return nil, disallowedcommand.Error } func build(config *config.Config, readWriter *readwriter.ReadWriter) command.Command { return &healthcheck.Command{Config: config, ReadWriter: readWriter} }