cli

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger added in v0.0.4

func GetLogger(cmd *cli.Command) *zap.Logger

GetLogger retrieves the logger directly from command metadata

func InitializeLogging added in v0.0.4

func InitializeLogging(ctx context.Context, cmd *cli.Command) (context.Context, error)

InitializeLogging sets up logging based on command-line flags and environment variables. This function is designed to be used as the Before hook in urfave/cli applications. Behavior: - --debug acts as shorthand for --log-level=debug and --verbose (forces console + verbose) - --log-level debug without --verbose sets level internally but does not enable console unless explicitly requested elsewhere

func NewApplyCommand

func NewApplyCommand() *cli.Command

NewApplyCommand returns the 'apply' command for urfave/cli.

func NewInitCommand

func NewInitCommand() *cli.Command

NewInitCommand returns the 'init' command for urfave/cli. It initializes the default agent-sync project structure.

func SetupCliV3Commands added in v0.0.4

func SetupCliV3Commands(commands []*cli.Command, ctx *Context)

SetupCliV3Commands registers all commands for the urfave/cli/v3 version and sets up the context in each command's metadata.

Types

type Context

type Context struct {
	// Logger is used for internal logging (debug, error tracking)
	Logger *zap.Logger

	// Output is used for user-facing console output
	Output log.OutputWriter

	// Debug indicates whether debug shorthand was requested.
	// When true, logging should be forced to debug level and console verbose enabled.
	Debug bool
}

Context holds shared resources and configuration for CLI commands. It provides consistent access to logging and output facilities.

func GetSharedContext added in v0.0.4

func GetSharedContext(cmd *cli.Command) *Context

GetSharedContext retrieves the shared context from command metadata

Jump to

Keyboard shortcuts

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