Documentation
¶
Overview ¶
Package cli contains various utilities that are useful for building CLI applications with gobox based applications. Support is available for both urfave/cli/v2 and urfave/cli/v3.
Index ¶
- func HookInUrfaveCLI(ctx context.Context, cancel context.CancelFunc, a *cliV2.App, ...)
- func Run(ctx context.Context, cancel context.CancelFunc, a *cliV2.App, conf *Config)
- func RunV3(ctx context.Context, cancel context.CancelFunc, c *cliV3.Command, conf *Config)
- type Config
- type TelemetryConfig
- type TelemetryOtelConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HookInUrfaveCLI ¶
func HookInUrfaveCLI(ctx context.Context, cancel context.CancelFunc, a *cliV2.App, logger logrus.FieldLogger, honeycombAPIKey, dataset, _ string)
HookInUrfaveCLI sets up a V2 app.Before func that automatically traces command runs & automatically updates itself.
TODO(jaredallard): Deprecate this after templates have been updated and released for a few weeks.
Types ¶
type Config ¶ added in v1.66.0
type Config struct {
// Telemetry is the configuration for telemetry for the CLI
Telemetry TelemetryConfig
// Logger is the logger to use for logging
Logger logrus.FieldLogger
}
Config configures the CLI integration provided by gobox
type TelemetryConfig ¶ added in v1.66.0
type TelemetryConfig struct {
// Disabled intentionally turns off all telemetry for the CLI, regardless of
// UseDelibird, Otel, or a mounted trace.yaml.
//
// This framework normally overrides the mounted trace.yaml with a synthesized
// config that always enables OpenTelemetry tracing to Honeycomb using an API
// key compiled into the binary. CLIs that don't have a valid Honeycomb API key
// (for example, cron jobs built with stencil-golang) should set this instead of
// relying on trace.yaml, since that file is otherwise ignored here and setting
// `OpenTelemetry.Enabled: false` in it has no effect, producing continuous
// "unknown API key" export errors. Takes priority over UseDelibird.
Disabled bool
// UseDelibird enables the delibird integration, which logs all output to a
// file as frames (writes to the terminal) as well as records traces.
//
// These files will not be automatically uploaded, a daemon must be running on
// the user's local machine to upload them. For Outreach, this is uploaded by the
// orc 'delibird' daemon. For other users, these are kept locally.
UseDelibird bool
// Otel is the configuration for telemetry when delibird is not in use.
Otel TelemetryOtelConfig
}
TelemetryConfig is the configuration for telemetry for the CLI
type TelemetryOtelConfig ¶ added in v1.66.0
type TelemetryOtelConfig struct {
// HoneycombAPIKey is the honeycomb API key to use for telemetry.
HoneycombAPIKey cfg.SecretData
// Dataset is the dataset to send telemetry to.
Dataset string
// Debug enables debug logging for telemetry.
Debug bool
}
TelemetryOtelConfig is the configuration for telemetry when delibird is not in use.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package aws contains helpers for working with AWS in CLIs
|
Package aws contains helpers for working with AWS in CLIs |
|
Description: Implements consistent ways to get Auth across platforms.
|
Description: Implements consistent ways to get Auth across platforms. |
|
internal
|
|
|
term
Package term holds small terminal-output helpers shared by pkg/cli's progress and spinner packages.
|
Package term holds small terminal-output helpers shared by pkg/cli's progress and spinner packages. |
|
Package logfile implements a hook that will re-run the current process with a PTY attached to it, and then hook into the PTY's stdout/stderr to record logs.
|
Package logfile implements a hook that will re-run the current process with a PTY attached to it, and then hook into the PTY's stdout/stderr to record logs. |
|
Package progress implements a small byte-progress meter on top of charm.land/bubbles/v2/progress, for use in place of github.com/schollz/progressbar/v3.
|
Package progress implements a small byte-progress meter on top of charm.land/bubbles/v2/progress, for use in place of github.com/schollz/progressbar/v3. |
|
Package prompt implements small terminal prompts (text input, yes/no confirmation, single- and multi-choice selection, and a generic picker) on top of github.com/charmbracelet/bubbletea.
|
Package prompt implements small terminal prompts (text input, yes/no confirmation, single- and multi-choice selection, and a generic picker) on top of github.com/charmbracelet/bubbletea. |
|
Package spinner implements a small animated spinner on top of charm.land/bubbles/v2/spinner, for use in place of github.com/briandowns/spinner.
|
Package spinner implements a small animated spinner on top of charm.land/bubbles/v2/spinner, for use in place of github.com/briandowns/spinner. |
|
Description: Provides miscellaneous helpers for the updater
|
Description: Provides miscellaneous helpers for the updater |
|
archive
Package archive contains methods for extracting file(s) from arbitrary archive types.
|
Package archive contains methods for extracting file(s) from arbitrary archive types. |
|
release
Package release contains methods that interact with releases from VCS providers that do not exist natively in git.
|
Package release contains methods that interact with releases from VCS providers that do not exist natively in git. |
|
resolver
Package resolver contains a git tag aware version resolver that supports channels to determine the latest version.
|
Package resolver contains a git tag aware version resolver that supports channels to determine the latest version. |
Click to show internal directories.
Click to hide internal directories.