cli

package
v0.0.0-...-bafe0c7 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteTemplate

func WriteTemplate(w io.Writer, tpl string, replacements any) error

WriteTemplate writes a formatted string to the provided writer using the given template and replacements. The tpl is parsed as a text/template and executed with the replacements map providing the template variables.

Types

type Flag

type Flag struct {
	Name        string
	Variable    string
	Type        string
	Default     any
	Description string
}

Flag represents a command line flag configuration.

func NewFlag

func NewFlag(flag Flag) (*Flag, error)

NewFlag creates a Flag instance with validation. It returns an error if the flag configuration is invalid.

type Logger

type Logger interface {
	// Printf formats and prints a message according to the format specifier
	Printf(format string, v ...interface{})
}

Logger defines the interface for logging operations

func NewLogger

func NewLogger() Logger

NewLogger creates and returns a new Logger instance

type Options

type Options struct {
	// Address specifies the network address to listen on
	Address string
	// Port specifies the network port number to listen on
	Port int
	// TLSCert is the path to the TLS certificate file
	TLSCert string
	// TLSPrivateKey is the path to the TLS private key file
	TLSPrivateKey string
	// EnableEncryption determines if encryption should be used
	EnableEncryption bool
	// SymmetricKey is the path for the key used for encryption (AES-GCM AE)
	SymmetricKey string
	// EnableSignVerification determines if signature verification should be performed
	EnableSignVerification bool
	// SignPrivateKey is the path to the private key used for signing (ed25519)
	SignPrivateKey string
	// SessionName specifies the name of the debug session
	SessionName string
	// Editor specifies the preferred text editor
	Editor string
	// Version specifies the `-version` flag to return the version
	Version bool
}

Options holds the configuration for the CLI application.

func NewOptions

func NewOptions(flags map[string]Flag) (Options, error)

NewOptions creates a new Options instance from the provided flags configuration. It parses command-line flags and returns Options and any error encountered. The flags parameter should contain the flag definitions for all supported options.

Jump to

Keyboard shortcuts

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