cli

package
v0.0.0-...-328360e Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: GPL-3.0 Imports: 18 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"`

	// 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 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 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.

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