cli

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2016 License: MIT Imports: 16 Imported by: 2

Documentation

Overview

Package cli implements the Sous Command Line Interface. It is a presentation layer, and contains no core logic.

Index

Constants

View Source
const (
	FlavorFlagHelp = `` /* 583-byte string literal not displayed */

)
View Source
const OtplFlagsHelp = `` /* 151-byte string literal not displayed */

Variables

View Source
var (
	SuccessData       = cmdr.SuccessData
	Successf          = cmdr.Successf
	Success           = cmdr.Success
	UsageErrorf       = cmdr.UsageErrorf
	OSErrorf          = cmdr.OSErrorf
	IOErrorf          = cmdr.IOErrorf
	InternalErrorf    = cmdr.InternalErrorf
	EnsureErrorResult = cmdr.EnsureErrorResult
)

Func aliases, for convenience returning from commands.

View Source
var (
	// SourceFlagsHelp is the text (and config) for source flags
	SourceFlagsHelp = repoFlagHelp + offsetFlagHelp + FlavorFlagHelp + tagFlagHelp + revisionFlagHelp
	// RectifyFilterFlagsHelp is the text (and config) for rectification flags
	RectifyFilterFlagsHelp = repoFlagHelp + offsetFlagHelp + FlavorFlagHelp + clusterFlagHelp + allFlagHelp
	// DeployFilterFlagsHelp is the text and config for deploy flags
	DeployFilterFlagsHelp = repoFlagHelp + offsetFlagHelp + FlavorFlagHelp + clusterFlagHelp + allFlagHelp + tagFlagHelp
)
View Source
var QuerySubcommands = cmdr.Commands{}
View Source
var TopLevelCommands = cmdr.Commands{}

TopLevelCommands is populated once per command file (beginning sous_) in this directory.

Functions

func AddFlags

func AddFlags(fs *flag.FlagSet, target interface{}, help string) error

AddFlags sniffs out struct fields from target and adds them as var flags to the flag set.

func BuildCLIGraph added in v0.0.2

func BuildCLIGraph(cli *CLI, root *Sous, out, err io.Writer) *graph.SousGraph

BuildCLIGraph builds the CLI DI graph.

func MustAddFlags added in v0.0.2

func MustAddFlags(fs *flag.FlagSet, target interface{}, help string)

MustAddFlags wraps AddFlags and panics if AddFlags returns an error.

func ProduceResult

func ProduceResult(err error) cmdr.Result

ProduceResult converts errors into Results

func SuccessYAML

func SuccessYAML(v interface{}) cmdr.Result

SuccessYAML lets you return YAML on the command line.

Types

type Addable

type Addable interface {
	Add(...interface{})
}

Addable objects are able to receive lists of interface{}, presumably to add them to a DI registry. Abstracts Psyringe's Add()

type BuildFlags

type BuildFlags struct {
	Strict  bool   `flag:"strict"`
	Builder string `flag:"builder"`
}

BuildFlags are CLI flags used to set build options.

type CLI added in v0.0.2

type CLI struct {
	*cmdr.CLI
	*graph.SousGraph
}

CLI describes the command line interface for Sous

func NewSousCLI

func NewSousCLI(s *Sous, out, errout io.Writer) (*CLI, error)

NewSousCLI creates a new Sous cli app.

func (*CLI) Plumbing added in v0.0.2

func (cli *CLI) Plumbing(cmd cmdr.Executor, args []string) cmdr.Result

Plumbing injects a command with the current psyringe, then it Executes it, returning the result

type DeployFlags

type DeployFlags struct {
	Deployer   string `flag:"deployer"`
	DryRun     bool   `flag:"dry-run"`
	ForceClone bool   `flag:"force-clone"`
	Cluster    string `flag:"cluster"`
}

DeployFlags are CLI flags used to set deployment context and options.

type Registrant

type Registrant interface {
	RegisterOn(Addable)
}

A Registrant is able to add values to an Addable (implicitly: a Psyringe)

type Sous

type Sous struct {
	// CLI is a reference to the CLI singleton. We use it here to set global
	// verbosity.
	CLI *CLI
	*sous.LogSet
	// Err is the error message stream.
	Err *graph.ErrOut
	// Version is the version of Sous itself.
	Version semv.Version
	// OS is the OS this Sous is running on.
	OS string
	// Arch is the architecture this Sous is running on.
	Arch string
	// GoVersion is the version of Go this sous was built with.
	GoVersion string
	// contains filtered or unexported fields
}

Sous is the main sous command.

func (*Sous) AddFlags

func (s *Sous) AddFlags(fs *flag.FlagSet)

AddFlags adds sous' flags.

func (*Sous) Execute

func (s *Sous) Execute(args []string) cmdr.Result

Execute exists to present a helpful error to the user, in the case they just run 'sous' with not subcommand.

func (*Sous) Help

func (*Sous) Help() string

Help returns the top-level help for Sous.

func (*Sous) RegisterOn

func (s *Sous) RegisterOn(psy Addable)

RegisterOn adds the Sous object itself to the Psyringe

func (*Sous) Subcommands

func (s *Sous) Subcommands() cmdr.Commands

Subcommands returns all the top-level sous subcommands.

type SousBuild

type SousBuild struct {
	config.DeployFilterFlags
	config.PolicyFlags

	*sous.BuildManager
}

SousBuild is the command description for `sous build` Implements cmdr.Command, cmdr.Executor and cmdr.AddFlags

func (*SousBuild) AddFlags

func (sb *SousBuild) AddFlags(fs *flag.FlagSet)

AddFlags adds flags to the build command.

func (*SousBuild) Execute

func (sb *SousBuild) Execute(args []string) cmdr.Result

Execute fulfills the cmdr.Executor interface

func (*SousBuild) Help

func (*SousBuild) Help() string

Help returns the help string for this command

func (*SousBuild) RegisterOn

func (sb *SousBuild) RegisterOn(psy Addable)

RegisterOn adds the DeploymentConfig to the psyringe to configure the labeller and registrar

type SousConfig

type SousConfig struct {
	User   graph.LocalUser
	Config graph.LocalSousConfig
}

SousConfig is the sous config command.

func (*SousConfig) Execute

func (sc *SousConfig) Execute(args []string) cmdr.Result

Execute displays or sets config properties.

func (*SousConfig) Help

func (sc *SousConfig) Help() string

Help returns help for 'sous config'.

type SousContext

type SousContext struct {
	config.DeployFilterFlags
	*sous.SourceContext
}

SousContext is the 'sous context' command.

func (*SousContext) AddFlags

func (sc *SousContext) AddFlags(fs *flag.FlagSet)

AddFlags adds flags to the context command.

func (*SousContext) Execute

func (sc *SousContext) Execute(args []string) cmdr.Result

Execute prints the detected sous context.

func (*SousContext) Help

func (*SousContext) Help() string

Help provides help for sous context.

func (*SousContext) RegisterOn

func (sc *SousContext) RegisterOn(psy Addable)

RegisterOn adds the DeploymentConfig to the psyringe to configure the labeller and registrar

type SousDeploy added in v0.0.2

type SousDeploy struct {
	*CLI
	config.DeployFilterFlags
	config.OTPLFlags
	Update  SousUpdate
	Rectify SousRectify
	// contains filtered or unexported fields
}

SousDeploy is the command description for `sous deploy`

func (*SousDeploy) AddFlags added in v0.0.2

func (sd *SousDeploy) AddFlags(fs *flag.FlagSet)

AddFlags adds the flags for sous init.

func (*SousDeploy) Execute added in v0.0.2

func (sd *SousDeploy) Execute(args []string) cmdr.Result

Execute fulfills the cmdr.Executor interface.

func (*SousDeploy) Help added in v0.0.2

func (sd *SousDeploy) Help() string

Help returns the help string for this command

func (*SousDeploy) RegisterOn added in v0.0.2

func (sd *SousDeploy) RegisterOn(psy Addable)

RegisterOn adds the DeploymentConfig to the psyringe to configure the labeller and registrar

type SousHarvest

type SousHarvest struct {
	*sous.State
	sous.Registry
	graph.ErrWriter
}

SousHarvest is the description of the `sous query gdm` command

func (*SousHarvest) Execute

func (sh *SousHarvest) Execute(args []string) cmdr.Result

Execute defines the behavior of `sous query gdm`

func (*SousHarvest) Help

func (*SousHarvest) Help() string

Help prints the help

type SousHelp

type SousHelp struct {
	CLI  *CLI
	Sous *Sous
}

func (*SousHelp) Execute

func (sh *SousHelp) Execute(args []string) cmdr.Result

func (*SousHelp) Help

func (sh *SousHelp) Help() string

type SousInit

type SousInit struct {
	config.DeployFilterFlags
	Flags         config.OTPLFlags
	Target        graph.TargetManifest
	SourceContext *sous.SourceContext
	WD            graph.LocalWorkDirShell
	GDM           graph.CurrentGDM
	State         *sous.State
	StateWriter   graph.LocalStateWriter
}

SousInit is the command description for `sous init`

func (*SousInit) AddFlags

func (si *SousInit) AddFlags(fs *flag.FlagSet)

AddFlags adds the flags for sous init.

func (*SousInit) Execute

func (si *SousInit) Execute(args []string) cmdr.Result

Execute fulfills the cmdr.Executor interface

func (*SousInit) Help

func (si *SousInit) Help() string

Help returns the help string for this command

func (*SousInit) RegisterOn

func (si *SousInit) RegisterOn(psy Addable)

RegisterOn adds flag sets for sous init to the dependency injector.

type SousQuery

type SousQuery struct {
	Sous *Sous
	// contains filtered or unexported fields
}

func (*SousQuery) AddFlags

func (sb *SousQuery) AddFlags(fs *flag.FlagSet)

func (*SousQuery) Execute

func (sb *SousQuery) Execute(args []string) cmdr.Result

func (*SousQuery) Help

func (*SousQuery) Help() string

func (SousQuery) Subcommands

func (SousQuery) Subcommands() cmdr.Commands

type SousQueryAds added in v0.0.2

type SousQueryAds struct {
	Deployer     sous.Deployer
	Config       graph.LocalSousConfig
	DockerClient graph.LocalDockerClient
	GDM          graph.CurrentGDM
	State        *sous.State
	// contains filtered or unexported fields
}

SousQueryAds is the description of the `sous query ads` command

func (*SousQueryAds) Execute added in v0.0.2

func (sb *SousQueryAds) Execute(args []string) cmdr.Result

Execute defines the behavior of `sous query ads`

func (*SousQueryAds) Help added in v0.0.2

func (*SousQueryAds) Help() string

Help prints the help

type SousQueryArtifacts

type SousQueryArtifacts struct {
	*sous.RegistryDumper
	graph.ErrWriter
}

SousQueryArtifacts is the description of the `sous query gdm` command

func (*SousQueryArtifacts) Execute

func (sqa *SousQueryArtifacts) Execute(args []string) cmdr.Result

Execute defines the behavior of `sous query gdm`

func (*SousQueryArtifacts) Help

func (*SousQueryArtifacts) Help() string

Help prints the help

type SousQueryGDM

type SousQueryGDM struct {
	GDM graph.CurrentGDM
	// contains filtered or unexported fields
}

SousQueryGDM is the description of the `sous query gdm` command

func (*SousQueryGDM) Execute

func (sb *SousQueryGDM) Execute(args []string) cmdr.Result

Execute defines the behavior of `sous query gdm`

func (*SousQueryGDM) Help

func (*SousQueryGDM) Help() string

Help prints the help

type SousRectify

type SousRectify struct {
	Config       graph.LocalSousConfig
	DockerClient graph.LocalDockerClient
	Deployer     sous.Deployer
	Registry     sous.Registry
	State        *sous.State
	GDM          graph.CurrentGDM
	SourceFlags  config.DeployFilterFlags
	Engine       sous.SourceHostChooser
	// contains filtered or unexported fields
}

SousRectify is the injectable command object used for `sous rectify`

func (*SousRectify) AddFlags

func (sr *SousRectify) AddFlags(fs *flag.FlagSet)

AddFlags adds flags for sous rectify

func (*SousRectify) Execute

func (sr *SousRectify) Execute(args []string) cmdr.Result

Execute fulfils the cmdr.Executor interface

func (*SousRectify) Help

func (*SousRectify) Help() string

Help returns the help string

type SousUpdate

type SousUpdate struct {
	config.DeployFilterFlags
	config.OTPLFlags
	Manifest graph.TargetManifest
	*sous.SourceContext
	WD          graph.LocalWorkDirShell
	GDM         graph.CurrentGDM
	State       *sous.State
	StateWriter graph.LocalStateWriter
	StateReader graph.LocalStateReader
}

SousUpdate is the command description for `sous update`

func (*SousUpdate) AddFlags

func (su *SousUpdate) AddFlags(fs *flag.FlagSet)

AddFlags adds the flags for sous init.

func (*SousUpdate) Execute

func (su *SousUpdate) Execute(args []string) cmdr.Result

Execute fulfills the cmdr.Executor interface.

func (*SousUpdate) Help

func (su *SousUpdate) Help() string

Help returns the help string for this command

func (*SousUpdate) RegisterOn

func (su *SousUpdate) RegisterOn(psy Addable)

RegisterOn adds the DeploymentConfig to the psyringe to configure the labeller and registrar

type SousVersion

type SousVersion struct {
	Sous *Sous
}

SousVersion is the 'sous version' command.

func (*SousVersion) Execute

func (sv *SousVersion) Execute(args []string) cmdr.Result

Execute runs the 'sous version' command.

func (*SousVersion) Help

func (*SousVersion) Help() string

Help returns help for sous version.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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