cli

package
v0.0.3-prerelease3 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2017 License: MIT Imports: 19 Imported by: 0

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 OtplFlagsHelp = `` /* 151-byte string literal not displayed */

Variables

View Source
var (
	GeneralErrorf = func(format string, a ...interface{}) cmdr.ErrorResult {
		return EnsureErrorResult(fmt.Errorf(format, a...))
	}
	EnsureErrorResult = func(err error) cmdr.ErrorResult {
		sous.Log.Debug.Println(err)
		return cmdr.EnsureErrorResult(err)
	}
)

Func aliases, for convenience returning from commands.

View Source
var (
	// ClusterFilterFlagsHelp just exposes the -cluster flag (for server)
	ClusterFilterFlagsHelp = clusterFlagHelp
	// ManifestFilterFlagsHelp the text/config for selecting manifests
	ManifestFilterFlagsHelp = sourceFlagHelp + repoFlagHelp + offsetFlagHelp
	// MetadataFilterFlagsHelp the the text/config for metadata commands
	MetadataFilterFlagsHelp = sourceFlagHelp + repoFlagHelp + offsetFlagHelp + flavorFlagHelp + clusterFlagHelp
	// 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 ManifestSubcommands = cmdr.Commands{}
View Source
var MetadataSubcommands = cmdr.Commands{}
View Source
var PlumbingSubcommands = cmdr.Commands{}

PlumbingSubcommands collects the subcommands of `sous plumbing` as they're added

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, in io.Reader, 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
	SousGraph *graph.SousGraph
	// contains filtered or unexported fields
}

CLI describes the command line interface for Sous

func NewSousCLI

func NewSousCLI(s *Sous, in io.Reader, 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.PossiblyInvalidConfig
}

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 {
	Config            graph.LocalSousConfig
	CLI               *CLI
	DeployFilterFlags config.DeployFilterFlags
	OTPLFlags         config.OTPLFlags
	// 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

func (*SousHarvest) RegisterOn added in v0.0.3

func (*SousHarvest) RegisterOn(psy Addable)

type SousHelp

type SousHelp struct {
	CLI  *CLI
	Sous *Sous
}

func (*SousHelp) Execute

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

func (*SousHelp) Help

func (sh *SousHelp) Help() string

type SousInit

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

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 SousManifest added in v0.0.3

type SousManifest struct{}

func (*SousManifest) Execute added in v0.0.3

func (sm *SousManifest) Execute(args []string) cmdr.Result

func (*SousManifest) Help added in v0.0.3

func (*SousManifest) Help() string

func (SousManifest) Subcommands added in v0.0.3

func (SousManifest) Subcommands() cmdr.Commands

type SousManifestGet added in v0.0.3

func (*SousManifestGet) AddFlags added in v0.0.3

func (smg *SousManifestGet) AddFlags(fs *flag.FlagSet)

func (*SousManifestGet) Execute added in v0.0.3

func (smg *SousManifestGet) Execute(args []string) cmdr.Result

func (*SousManifestGet) Help added in v0.0.3

func (*SousManifestGet) Help() string

func (*SousManifestGet) RegisterOn added in v0.0.3

func (smg *SousManifestGet) RegisterOn(psy Addable)

type SousManifestSet added in v0.0.3

func (*SousManifestSet) AddFlags added in v0.0.3

func (smg *SousManifestSet) AddFlags(fs *flag.FlagSet)

func (*SousManifestSet) Execute added in v0.0.3

func (smg *SousManifestSet) Execute(args []string) cmdr.Result

func (*SousManifestSet) Help added in v0.0.3

func (*SousManifestSet) Help() string

func (*SousManifestSet) RegisterOn added in v0.0.3

func (smg *SousManifestSet) RegisterOn(psy Addable)

type SousMetadata added in v0.0.3

type SousMetadata struct{}

func (*SousMetadata) Execute added in v0.0.3

func (sm *SousMetadata) Execute(args []string) cmdr.Result

func (*SousMetadata) Help added in v0.0.3

func (*SousMetadata) Help() string

func (SousMetadata) Subcommands added in v0.0.3

func (SousMetadata) Subcommands() cmdr.Commands

type SousMetadataGet added in v0.0.3

func (*SousMetadataGet) AddFlags added in v0.0.3

func (smg *SousMetadataGet) AddFlags(fs *flag.FlagSet)

func (*SousMetadataGet) Execute added in v0.0.3

func (smg *SousMetadataGet) Execute(args []string) cmdr.Result

func (*SousMetadataGet) Help added in v0.0.3

func (*SousMetadataGet) Help() string

func (*SousMetadataGet) RegisterOn added in v0.0.3

func (smg *SousMetadataGet) RegisterOn(psy Addable)

type SousMetadataSet added in v0.0.3

func (*SousMetadataSet) AddFlags added in v0.0.3

func (smg *SousMetadataSet) AddFlags(fs *flag.FlagSet)

func (*SousMetadataSet) Execute added in v0.0.3

func (smg *SousMetadataSet) Execute(args []string) cmdr.Result

func (*SousMetadataSet) Help added in v0.0.3

func (*SousMetadataSet) Help() string

func (*SousMetadataSet) RegisterOn added in v0.0.3

func (smg *SousMetadataSet) RegisterOn(psy Addable)

type SousPlumbing added in v0.0.3

type SousPlumbing struct{}

SousPlumbing is the `sous plumbing` subcommand

func (*SousPlumbing) Help added in v0.0.3

func (*SousPlumbing) Help() string

Help implements Command for SousPlumbing

func (SousPlumbing) Subcommands added in v0.0.3

func (SousPlumbing) Subcommands() cmdr.Commands

Subcommands implements Submcommandor for SousPlumbing

type SousPlumbingStatus added in v0.0.3

type SousPlumbingStatus struct {
	DeployFilterFlags config.DeployFilterFlags
	StatusPoller      *sous.StatusPoller
}

SousPlumbingStatus is the `sous plumbing status` object.

func (*SousPlumbingStatus) AddFlags added in v0.0.3

func (sps *SousPlumbingStatus) AddFlags(fs *flag.FlagSet)

AddFlags implements cmdr.AddFlags on SousPlumbingStatus.

func (*SousPlumbingStatus) Execute added in v0.0.3

func (sps *SousPlumbingStatus) Execute(args []string) cmdr.Result

Execute implements cmdr.Executor on SousPlumbingStatus.

func (*SousPlumbingStatus) Help added in v0.0.3

func (*SousPlumbingStatus) Help() string

Help implements Command on SousPlumbingStatus.

func (*SousPlumbingStatus) RegisterOn added in v0.0.3

func (sps *SousPlumbingStatus) RegisterOn(psy Addable)

RegisterOn implements Registrant on SousPlumbingStatus.

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
	sous.Registry
	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

func (*SousQueryAds) RegisterOn added in v0.0.3

func (*SousQueryAds) RegisterOn(psy Addable)

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

func (*SousQueryArtifacts) RegisterOn added in v0.0.3

func (*SousQueryArtifacts) RegisterOn(psy Addable)

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

func (*SousQueryGDM) RegisterOn added in v0.0.3

func (*SousQueryGDM) RegisterOn(psy Addable)

type SousRectify

type SousRectify struct {
	Config      graph.LocalSousConfig
	State       *sous.State
	GDM         graph.CurrentGDM
	SourceFlags config.DeployFilterFlags
	Resolver    *sous.Resolver
	// 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.

func (*SousRectify) RegisterOn added in v0.0.3

func (sr *SousRectify) RegisterOn(psy Addable)

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

type SousServer added in v0.0.3

type SousServer struct {
	Sous              *Sous
	Verbosity         *config.Verbosity
	DeployFilterFlags config.DeployFilterFlags
	AutoResolver      *sous.AutoResolver
	Config            graph.LocalSousConfig
	Log               *sous.LogSet
	// contains filtered or unexported fields
}

A SousServer represents the `sous server` command.

func (*SousServer) AddFlags added in v0.0.3

func (ss *SousServer) AddFlags(fs *flag.FlagSet)

AddFlags is part of the cmdr.Command interfaces(s).

func (*SousServer) Execute added in v0.0.3

func (ss *SousServer) Execute(args []string) cmdr.Result

Execute is part of the cmdr.Command interface(s).

func (*SousServer) Help added in v0.0.3

func (ss *SousServer) Help() string

Help is part of the cmdr.Command interface(s).

func (*SousServer) RegisterOn added in v0.0.3

func (ss *SousServer) RegisterOn(psy Addable)

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

type SousUpdate

type SousUpdate struct {
	DeployFilterFlags config.DeployFilterFlags
	OTPLFlags         config.OTPLFlags
	Manifest          graph.TargetManifest
	GDM               graph.CurrentGDM
	State             *sous.State
	StateWriter       graph.StateWriter
	StateReader       graph.StateReader
	*sous.ResolveFilter
}

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