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 ¶
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.
Types ¶
This section is empty.