cli

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

internal/cli/cli.go

internal/cli/client.go

internal/cli/commands.go

internal/cli/daemon_bootstrap.go

internal/cli/output.go

Index

Constants

View Source
const (
	ExitOK        = 0
	ExitGeneric   = 1
	ExitUsage     = 2
	ExitConfig    = 3
	ExitDaemon    = 4
	ExitNotFound  = 5
	ExitSourceBad = 6
)

Exit codes, documented in README.

Variables

View Source
var ErrUnreachable = errors.New("daemon unreachable")

ErrUnreachable is returned when the daemon is not running.

Functions

func Run

func Run(argv []string, stdout, stderr io.Writer) int

Run dispatches the CLI. argv excludes the program name.

Types

type Client

type Client struct {
	BaseURL string
	Secret  string
	HTTP    *http.Client
}

Client talks to the local daemon's admin API.

func EnsureDaemon

func EnsureDaemon(dataDir, cfgPath string) (*Client, error)

EnsureDaemon makes sure the daemon is running and returns an admin client wired to it. If the daemon is not running, spawns it (forwarding cfgPath via --config so the child loads the same config as the CLI) and waits up to 2 seconds for readiness.

func NewClient

func NewClient(port int, secret string) *Client

func (*Client) List

func (c *Client) List(ctx context.Context) (admin.ListResponse, error)

func (*Client) Reshare

func (c *Client) Reshare(ctx context.Context, id string) (admin.SharePayload, error)

func (*Client) Revoke

func (c *Client) Revoke(ctx context.Context, id string) error

func (*Client) Share

func (*Client) Status

func (c *Client) Status(ctx context.Context) (admin.StatusResponse, error)

func (*Client) Stop

func (c *Client) Stop(ctx context.Context) error

type Format

type Format int

Format controls how command output is rendered.

const (
	Human Format = iota
	JSON
)

Jump to

Keyboard shortcuts

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