cli

package
v0.0.0-...-2561dba Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package cli handles all of the core command line parsing. It's the first entry point after the real main function, and it imports and runs our core "lib".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CLI

func CLI(ctx context.Context, data *cliUtil.Data) error

CLI is the entry point for using mgmt normally from the CLI.

Types

type Args

type Args struct {
	License bool `arg:"--license" help:"display the license and exit"`

	RunCmd *RunArgs `arg:"subcommand:run" help:"run code on this machine"`

	DeployCmd *DeployArgs `arg:"subcommand:deploy" help:"deploy code into a cluster"`

	SetupCmd *SetupArgs `arg:"subcommand:setup" help:"setup some bootstrapping tasks"`

	FirstbootCmd *FirstbootArgs `arg:"subcommand:firstboot" help:"run some tasks on first boot"`

	DocsCmd *DocsGenerateArgs `arg:"subcommand:docs" help:"generate documentation"`

	// This never runs, it gets preempted in the real main() function.
	// XXX: Can we do it nicely with the new arg parser? can it ignore all args?
	EtcdCmd *EtcdArgs `arg:"subcommand:etcd" help:"run standalone etcd"`
	// contains filtered or unexported fields
}

Args is the CLI parsing structure and type of the parsed result. This particular struct is the top-most one.

func (*Args) Description

func (obj *Args) Description() string

Description returns a description string. Implementing this signature is part of the API for the cli library.

func (*Args) Run

func (obj *Args) Run(ctx context.Context, data *cliUtil.Data) (bool, error)

Run executes the correct subcommand. It errors if there's ever an error. It returns true if we did activate one of the subcommands. It returns false if we did not. This information is used so that the top-level parser can return usage or help information if no subcommand activates.

func (*Args) Version

func (obj *Args) Version() string

Version returns the version string. Implementing this signature is part of the API for the cli library.

type DeployArgs

type DeployArgs struct {
	Seeds []string `arg:"--seeds,env:MGMT_SEEDS" help:"default etc client endpoint"`
	Noop  bool     `arg:"--noop" help:"globally force all resources into no-op mode"`
	Sema  int      `arg:"--sema" default:"-1" help:"globally add a semaphore to all resources with this lock count"`
	NoGit bool     `arg:"--no-git" help:"don't look at git commit id for safe deploys"`
	Force bool     `arg:"--force" help:"force a new deploy, even if the safety chain would break"`

	DeployEmpty      *cliUtil.EmptyArgs      `arg:"subcommand:empty" help:"deploy empty payload"`
	DeployLang       *cliUtil.LangArgs       `arg:"subcommand:lang" help:"deploy lang (mcl) payload"`
	DeployYaml       *cliUtil.YamlArgs       `arg:"subcommand:yaml" help:"deploy yaml graph payload"`
	DeployPuppet     *cliUtil.PuppetArgs     `arg:"subcommand:puppet" help:"deploy puppet graph payload"`
	DeployLangPuppet *cliUtil.LangPuppetArgs `arg:"subcommand:langpuppet" help:"deploy langpuppet graph payload"`
}

DeployArgs is the CLI parsing structure and type of the parsed result. This particular one contains all the common flags for the `deploy` subcommand which all frontends can use.

func (*DeployArgs) Run

func (obj *DeployArgs) Run(ctx context.Context, data *cliUtil.Data) (bool, error)

Run executes the correct subcommand. It errors if there's ever an error. It returns true if we did activate one of the subcommands. It returns false if we did not. This information is used so that the top-level parser can return usage or help information if no subcommand activates. This particular Run is the run for the main `deploy` subcommand. This always requires a frontend to deploy to the cluster, but if you don't want a graph, you can use the `empty` frontend. The engine backend is agnostic to which frontend is deployed, in fact, you can deploy with multiple different frontends, one after another, on the same engine.

type DocsGenerateArgs

type DocsGenerateArgs struct {
	docs.Config // embedded config (can't be a pointer) https://github.com/alexflint/go-arg/issues/240

	DocsGenerate *cliUtil.DocsGenerateArgs `arg:"subcommand:generate" help:"generate documentation"`
}

DocsGenerateArgs is the CLI parsing structure and type of the parsed result. This particular one contains all the common flags for the `docs generate` subcommand.

func (*DocsGenerateArgs) Run

func (obj *DocsGenerateArgs) Run(ctx context.Context, data *cliUtil.Data) (bool, error)

Run executes the correct subcommand. It errors if there's ever an error. It returns true if we did activate one of the subcommands. It returns false if we did not. This information is used so that the top-level parser can return usage or help information if no subcommand activates. This particular Run is the run for the main `docs` subcommand.

type EtcdArgs

type EtcdArgs struct{}

EtcdArgs is the CLI parsing structure and type of the parsed result. This particular one is empty because the `etcd` subcommand is preempted in the real main() function.

type FirstbootArgs

type FirstbootArgs struct {
	firstboot.Config // embedded config (can't be a pointer) https://github.com/alexflint/go-arg/issues/240

	FirstbootStart *cliUtil.FirstbootStartArgs `arg:"subcommand:start" help:"start firstboot service"`
}

FirstbootArgs is the CLI parsing structure and type of the parsed result. This particular one contains all the common flags for the `firstboot` subcommand.

func (*FirstbootArgs) Run

func (obj *FirstbootArgs) Run(ctx context.Context, data *cliUtil.Data) (bool, error)

Run executes the correct subcommand. It errors if there's ever an error. It returns true if we did activate one of the subcommands. It returns false if we did not. This information is used so that the top-level parser can return usage or help information if no subcommand activates. This particular Run is the run for the main `firstboot` subcommand. The firstboot command as a service that lets you run commands once on the first boot of a system.

type RunArgs

type RunArgs struct {
	lib.Config // embedded config (can't be a pointer) https://github.com/alexflint/go-arg/issues/240

	RunEmpty      *cliUtil.EmptyArgs      `arg:"subcommand:empty" help:"run empty payload"`
	RunLang       *cliUtil.LangArgs       `arg:"subcommand:lang" help:"run lang (mcl) payload"`
	RunYaml       *cliUtil.YamlArgs       `arg:"subcommand:yaml" help:"run yaml graph payload"`
	RunPuppet     *cliUtil.PuppetArgs     `arg:"subcommand:puppet" help:"run puppet graph payload"`
	RunLangPuppet *cliUtil.LangPuppetArgs `arg:"subcommand:langpuppet" help:"run a combined lang/puppet graph payload"`
}

RunArgs is the CLI parsing structure and type of the parsed result. This particular one contains all the common flags for the `run` subcommand which all frontends can use.

func (*RunArgs) Run

func (obj *RunArgs) Run(ctx context.Context, data *cliUtil.Data) (bool, error)

Run executes the correct subcommand. It errors if there's ever an error. It returns true if we did activate one of the subcommands. It returns false if we did not. This information is used so that the top-level parser can return usage or help information if no subcommand activates. This particular Run is the run for the main `run` subcommand. This always requires a frontend to start the engine, but if you don't want a graph, you can use the `empty` frontend. The engine backend is agnostic to which frontend is running, in fact, you can deploy with multiple different frontends, one after another, on the same engine.

type SetupArgs

type SetupArgs struct {
	setup.Config // embedded config (can't be a pointer) https://github.com/alexflint/go-arg/issues/240

	SetupPkg       *cliUtil.SetupPkgArgs       `arg:"subcommand:pkg" help:"setup packages"`
	SetupSvc       *cliUtil.SetupSvcArgs       `arg:"subcommand:svc" help:"setup services"`
	SetupFirstboot *cliUtil.SetupFirstbootArgs `arg:"subcommand:firstboot" help:"setup firstboot"`
}

SetupArgs is the CLI parsing structure and type of the parsed result. This particular one contains all the common flags for the `setup` subcommand.

func (*SetupArgs) Run

func (obj *SetupArgs) Run(ctx context.Context, data *cliUtil.Data) (bool, error)

Run executes the correct subcommand. It errors if there's ever an error. It returns true if we did activate one of the subcommands. It returns false if we did not. This information is used so that the top-level parser can return usage or help information if no subcommand activates. This particular Run is the run for the main `setup` subcommand. The setup command does some bootstrap work to help get things going.

Directories

Path Synopsis
Package util has some CLI related utility code.
Package util has some CLI related utility code.

Jump to

Keyboard shortcuts

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