app

package
v0.0.2-testing Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 22 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package app assembles a runnable CLI from products: the unified `reearth` binary (Run with several products) or a standalone product binary (Main).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(f *core.Factory, o Options, args []string) int

Execute runs args against a Factory and returns the exit code.

func Main

func Main(p core.Product)

Main runs a single product as a standalone CLI and exits.

func NewFactory

func NewFactory(o Options, io *iostreams.IOStreams) *core.Factory

NewFactory creates the Factory shared by all commands.

func NewRoot

func NewRoot(f *core.Factory, o Options) *cobra.Command

NewRoot builds the root command with global flags, core commands and products.

func RawFlag

func RawFlag(args []string, name string, short ...string) (value string, ok bool)

RawFlag finds a global flag in unparsed args (--name, --name=v, --name v, -s v, -sv, -s=v) before "--". Without "=", the value is the next arg. As in pflag, the shorthand may follow the boolean global shorthands (-yojson). It is for reading flags when parsing may have failed.

func Run

func Run(o Options, args []string) int

Run executes the CLI with args and returns the exit code.

Types

type Factory

type Factory = core.Factory

type Options

type Options struct {
	// Name is the binary name ("reearth", "reearth-cms").
	Name string
	// Short describes the root command.
	Short string
	// Products are mounted as subcommands, or as the root when Standalone.
	Products []core.Product
	// Standalone makes the single product the root command.
	Standalone bool
	// Extra adds host-specific commands (upgrade, extension, ...).
	Extra func(f *core.Factory) []*cobra.Command
	// Dispatch may handle args before cobra (e.g. running an extension).
	Dispatch func(f *core.Factory, root *cobra.Command, args []string) (handled bool, exitCode int)
	// BeforeRun runs before the command; AfterRun after it, even on error.
	BeforeRun func(f *core.Factory, args []string)
	AfterRun  func(f *core.Factory, cmd *cobra.Command, err error)
	// DoctorChecks contributes extra checks to `doctor`.
	DoctorChecks []func(ctx context.Context) []core.Check
}

type Product

type Product = core.Product

Jump to

Keyboard shortcuts

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