cli

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package cli is ovdb's command-line presentation of the onboarding and configuration capabilities: `ovdb server …`, `ovdb open`, `ovdb config …` and the preview `ovdb status`. Commands resolve environment-dependent inputs, call the local server (or the pure reads in internal/setup) and render the resulting documents; --json prints those documents unchanged.

Every new command is hidden unless OVDB_PREVIEW=1, exits 0 on success and 1 on any failure, and reports failures in the shared error envelope.

Index

Constants

View Source
const EnvStartFault = "OVDB_TEST_START_FAULT"

EnvStartFault is a hidden test-only variable: a server started with it set to "1" exits before readiness, so start fails with server_start_failed.

Variables

This section is empty.

Functions

func Render

func Render(err error, args []string, stdout, stderr io.Writer) bool

Render prints err when it is an envelope error and reports whether it did: the JSON document on stdout when args ask for --json, otherwise the problem pattern on stderr (first-run-onboarding#REQ:problem-pattern). main calls it before fang's own error output, so legacy commands keep theirs. args are the raw arguments, because a flag error happens before --json itself is parsed.

Types

type App

type App struct {
	Version string
	Getenv  paths.Getenv // os.Getenv when nil
	// Executable runs the detached server; os.Executable() when empty.
	Executable string
	// ChildEnv is appended to the detached server's environment (tests).
	ChildEnv []string
	// OpenBrowser launches a URL; browser.Opener{}.Open when nil.
	OpenBrowser func(url string) error
}

App carries what every command needs from the process.

func (*App) AddCommands

func (a *App) AddCommands(root *cobra.Command)

AddCommands registers the new commands on root, hidden without the gate.

func (*App) Status

func (a *App) Status(cmd *cobra.Command, jsonOut bool) error

Status is the preview `ovdb status`: a pure read that never starts a server (first-run-onboarding#REQ:status-command).

Jump to

Keyboard shortcuts

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