Documentation
¶
Overview ¶
Package cli implements the Sous Command Line Interface. It is a presentation layer, and contains no core logic.
Index ¶
- Constants
- Variables
- func AddFlags(fs *flag.FlagSet, target interface{}, help string) error
- func BuildCLIGraph(cli *CLI, root *Sous, out, err io.Writer) *graph.SousGraph
- func MustAddFlags(fs *flag.FlagSet, target interface{}, help string)
- func ProduceResult(err error) cmdr.Result
- func SuccessYAML(v interface{}) cmdr.Result
- type Addable
- type BuildFlags
- type CLI
- type DeployFlags
- type Registrant
- type Sous
- type SousBuild
- type SousConfig
- type SousContext
- type SousDeploy
- type SousHarvest
- type SousHelp
- type SousInit
- type SousQuery
- type SousQueryAds
- type SousQueryArtifacts
- type SousQueryGDM
- type SousRectify
- type SousUpdate
- type SousVersion
Constants ¶
const (
FlavorFlagHelp = `` /* 583-byte string literal not displayed */
)
const OtplFlagsHelp = `` /* 151-byte string literal not displayed */
Variables ¶
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.
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 )
var QuerySubcommands = cmdr.Commands{}
var TopLevelCommands = cmdr.Commands{}
TopLevelCommands is populated once per command file (beginning sous_) in this directory.
Functions ¶
func AddFlags ¶
AddFlags sniffs out struct fields from target and adds them as var flags to the flag set.
func BuildCLIGraph ¶ added in v0.0.2
BuildCLIGraph builds the CLI DI graph.
func MustAddFlags ¶ added in v0.0.2
MustAddFlags wraps AddFlags and panics if AddFlags returns an error.
func ProduceResult ¶
ProduceResult converts errors into Results
func SuccessYAML ¶
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 ¶
BuildFlags are CLI flags used to set build options.
type CLI ¶ added in v0.0.2
CLI describes the command line interface for Sous
func NewSousCLI ¶
NewSousCLI creates a new Sous cli app.
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) Execute ¶
Execute exists to present a helpful error to the user, in the case they just run 'sous' with not subcommand.
func (*Sous) RegisterOn ¶
RegisterOn adds the Sous object itself to the Psyringe
func (*Sous) Subcommands ¶
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) RegisterOn ¶
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.
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) 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 ¶
SousHarvest is the description of the `sous query gdm` command
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) RegisterOn ¶
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) Subcommands ¶
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
type SousQueryArtifacts ¶
SousQueryArtifacts is the description of the `sous query gdm` command
type SousQueryGDM ¶
type SousQueryGDM struct { GDM graph.CurrentGDM // contains filtered or unexported fields }
SousQueryGDM is the description of the `sous query gdm` command
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
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.