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, in io.Reader, 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 SousManifest
- type SousManifestGet
- type SousManifestSet
- type SousMetadata
- type SousMetadataGet
- type SousMetadataSet
- type SousPlumbing
- type SousPlumbingStatus
- type SousQuery
- type SousQueryAds
- type SousQueryArtifacts
- type SousQueryGDM
- type SousRectify
- type SousServer
- type SousUpdate
- type SousVersion
Constants ¶
const OtplFlagsHelp = `` /* 151-byte string literal not displayed */
Variables ¶
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.
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 )
var ManifestSubcommands = cmdr.Commands{}
var MetadataSubcommands = cmdr.Commands{}
var PlumbingSubcommands = cmdr.Commands{}
PlumbingSubcommands collects the subcommands of `sous plumbing` as they're added
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.PossiblyInvalidConfig }
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 { 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 ¶
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) RegisterOn ¶ added in v0.0.3
func (*SousHarvest) RegisterOn(psy Addable)
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) RegisterOn ¶
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
type SousManifestGet struct { config.DeployFilterFlags graph.TargetManifestID *sous.State graph.OutWriter *sous.ResolveFilter }
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
type SousManifestSet struct { config.DeployFilterFlags graph.TargetManifestID *sous.State graph.StateWriter graph.InReader *sous.ResolveFilter }
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
type SousMetadataGet struct { config.DeployFilterFlags *sous.ResolveFilter *sous.State graph.CurrentGDM graph.OutWriter }
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
type SousMetadataSet struct { config.DeployFilterFlags *sous.ResolveFilter *sous.State graph.CurrentGDM sous.StateWriter }
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) Subcommands ¶
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) RegisterOn ¶ added in v0.0.3
func (*SousQueryAds) RegisterOn(psy Addable)
type SousQueryArtifacts ¶
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) 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) 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) 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.
Source Files ¶
- add_flags.go
- cli.go
- deploy_filter_flags.go
- flags.go
- otpl_flags.go
- sous.go
- sous_build.go
- sous_config.go
- sous_context.go
- sous_deploy.go
- sous_harvest.go
- sous_help.go
- sous_init.go
- sous_manifest.go
- sous_manifest_get.go
- sous_manifest_set.go
- sous_metadata.go
- sous_metadata_get.go
- sous_metadata_set.go
- sous_plumbing.go
- sous_plumbing_status.go
- sous_query.go
- sous_query_ads.go
- sous_query_artifacts.go
- sous_query_gdm.go
- sous_rectify.go
- sous_server.go
- sous_update.go
- sous_version.go