cli

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package cli provides the public API for extending the StackEye CLI.

This package exports the root command and utility functions that allow other modules to extend the CLI with additional commands. This is used by the private stackeye-cli-admin module to add admin-only commands.

Example usage in an extending CLI:

package main

import (
    "os"
    "github.com/StackEye-IO/stackeye-cli/pkg/cli"
)

func main() {
    rootCmd := cli.RootCmd()
    rootCmd.AddCommand(myCustomCommand())
    os.Exit(cli.ExecuteWithExitCode(rootCmd))
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteWithExitCode

func ExecuteWithExitCode(cmd *cobra.Command) int

ExecuteWithExitCode runs the given command and returns an appropriate exit code. This maps errors to exit codes for proper CLI behavior:

  • 0: Success
  • 1: General error
  • 2: Command misuse (invalid arguments)
  • 3: Authentication required
  • 4: Permission denied
  • 5: Resource not found
  • 6: Rate limited
  • 7: Server error
  • 8: Network error
  • 9: Timeout
  • 10: Plan limit exceeded

func GetConfig

func GetConfig() interface{}

GetConfig returns the loaded configuration after Execute() has been called. Returns nil if called before Execute() or if config loading failed.

This is useful for commands that need access to authentication tokens, current context, or user preferences.

func GetVerbosity

func GetVerbosity() int

GetVerbosity returns the current verbosity level from CLI flags. Returns 0 if no verbosity flags were set, 1 for -v, 2 for -vv, etc.

This allows extended CLIs to pass verbosity settings to SDK clients for debug logging.

func RootCmd

func RootCmd() *cobra.Command

RootCmd returns the root command for the StackEye CLI. This allows other packages to add subcommands to extend the CLI.

The returned command has all standard commands (probe, alert, channel, etc.) already registered and is ready for execution.

Types

This section is empty.

Jump to

Keyboard shortcuts

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