cli

package
v0.0.0-...-fe5d286 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Overview

Package cli provides command-line interface functionality for SolidPing.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrManifestRequired is returned when no manifest file is supplied.
	ErrManifestRequired = errors.New("a manifest file is required (-f/--file)")
	// ErrApplyAborted is returned when the user declines the apply prompt.
	ErrApplyAborted = errors.New("apply aborted")
)
View Source
var (
	// ErrCheckNotFound is returned when a check is not found.
	ErrCheckNotFound = errors.New("check not found")
	// ErrFailedToListChecks is returned when listing checks fails.
	ErrFailedToListChecks = errors.New("failed to list checks")
	// ErrFailedToCreateCheck is returned when creating a check fails.
	ErrFailedToCreateCheck = errors.New("failed to create check")
	// ErrFailedToRemoveCheck is returned when removing a check fails.
	ErrFailedToRemoveCheck = errors.New("failed to remove check")
	// ErrAPIError is returned when an API call fails.
	ErrAPIError = errors.New("API error")
)
View Source
var (
	// ErrServerUnhealthy is returned when the server is unhealthy.
	ErrServerUnhealthy = errors.New("server is unhealthy")
	// ErrFailedToGetVersion is returned when getting version fails.
	ErrFailedToGetVersion = errors.New("failed to get version")
)

Functions

func GetCommands

func GetCommands() []*cli.Command

GetCommands returns all CLI commands

func GetGlobalFlags

func GetGlobalFlags() []cli.Flag

GetGlobalFlags returns the global flags available for all commands.

Types

type Context

type Context struct {
	Config       *config.Config
	APIHelper    *apihelper.Helper
	Outputter    output.Outputter
	OutputFormat output.Format
	Verbose      bool
}

Context holds the context for CLI commands.

func NewCLIContext

func NewCLIContext(cmd *cli.Command) (*Context, error)

NewCLIContext creates a new CLI context from command flags.

func (*Context) GetClient

func (c *Context) GetClient(_ context.Context) (*apihelper.Helper, error)

GetClient returns an authenticated API client.

func (*Context) GetOrg

func (c *Context) GetOrg() string

GetOrg returns the organization from config or flag override.

func (*Context) HandleAuthError

func (c *Context) HandleAuthError(err error) error

HandleAuthError handles authentication errors consistently across output formats.

func (*Context) HandleError

func (c *Context) HandleError(msg string, err error) error

HandleError handles general errors consistently across output formats.

func (*Context) HandleStatusError

func (c *Context) HandleStatusError(msg string, statusCode int) error

HandleStatusError handles unexpected HTTP status code errors.

func (*Context) IsText

func (c *Context) IsText() bool

IsText returns true if the output format is text (human-readable).

Directories

Path Synopsis
Package apihelper provides helper functions for API client operations.
Package apihelper provides helper functions for API client operations.
Package config provides configuration management for the CLI.
Package config provides configuration management for the CLI.
Package output provides output formatting utilities for CLI commands.
Package output provides output formatting utilities for CLI commands.

Jump to

Keyboard shortcuts

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