shared

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package shared provides helpers shared across CLI sub-packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeContext

func MakeContext(timeoutMs int) (context.Context, context.CancelFunc)

MakeContext returns a context with an optional timeout. The caller must defer cancel() to avoid resource leaks.

func WithConnection

func WithConnection(conn string, timeout int, fn func(ctx context.Context, drv driver.Connection) error) error

WithConnection resolves a connection, runs fn, and handles cleanup and error output. Errors from resolution or fn are written to stderr as structured JSON.

Types

type GlobalFlags

type GlobalFlags struct {
	Connection string
	Format     string
	Expand     string
	Full       bool
	Timeout    int
	Compact    bool
}

GlobalFlags holds global CLI flag values shared across sub-packages.

Jump to

Keyboard shortcuts

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