本文整理汇总了Golang中github.com/wercker/wercker/util.Settings.Bool方法的典型用法代码示例。如果您正苦于以下问题:Golang Settings.Bool方法的具体用法?Golang Settings.Bool怎么用?Golang Settings.Bool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/wercker/wercker/util.Settings
的用法示例。
在下文中一共展示了Settings.Bool方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewVersionOptions
// NewVersionOptions constructor
func NewVersionOptions(c util.Settings, e *util.Environment) (*VersionOptions, error) {
json, _ := c.Bool("json")
beta, _ := c.Bool("beta")
noUpdateCheck, _ := c.Bool("no-update-check")
return &VersionOptions{
OutputJSON: json,
BetaChannel: beta,
CheckForUpdate: !noUpdateCheck,
}, nil
}
示例2: NewDockerOptions
// NewDockerOptions constructor
func NewDockerOptions(c util.Settings, e *util.Environment) (*DockerOptions, error) {
dockerHost, _ := c.String("docker-host")
dockerTLSVerify, _ := c.String("docker-tls-verify")
dockerCertPath, _ := c.String("docker-cert-path")
dockerDNS, _ := c.StringSlice("docker-dns")
dockerLocal, _ := c.Bool("docker-local")
speculativeOptions := &DockerOptions{
DockerHost: dockerHost,
DockerTLSVerify: dockerTLSVerify,
DockerCertPath: dockerCertPath,
DockerDNS: dockerDNS,
DockerLocal: dockerLocal,
}
// We're going to try out a few settings and set DockerHost if
// one of them works, it they don't we'll get a nice error when
// requireDockerEndpoint triggers later on
guessAndUpdateDockerOptions(speculativeOptions, e)
return speculativeOptions, nil
}
示例3: NewReporterOptions
// NewReporterOptions constructor
func NewReporterOptions(c util.Settings, e *util.Environment, globalOpts *GlobalOptions) (*ReporterOptions, error) {
shouldReport, _ := c.Bool("report")
reporterHost, _ := c.String("wercker-host")
reporterKey, _ := c.String("wercker-token")
if shouldReport {
if reporterKey == "" {
return nil, errors.New("wercker-token is required")
}
if reporterHost == "" {
return nil, errors.New("wercker-host is required")
}
}
return &ReporterOptions{
GlobalOptions: globalOpts,
ReporterHost: reporterHost,
ReporterKey: reporterKey,
ShouldReport: shouldReport,
}, nil
}
示例4: NewKeenOptions
// NewKeenOptions constructor
func NewKeenOptions(c util.Settings, e *util.Environment, globalOpts *GlobalOptions) (*KeenOptions, error) {
keenMetrics, _ := c.Bool("keen-metrics")
keenProjectWriteKey, _ := c.String("keen-project-write-key")
keenProjectID, _ := c.String("keen-project-id")
if keenMetrics {
if keenProjectWriteKey == "" {
return nil, errors.New("keen-project-write-key is required")
}
if keenProjectID == "" {
return nil, errors.New("keen-project-id is required")
}
}
return &KeenOptions{
GlobalOptions: globalOpts,
KeenProjectID: keenProjectID,
KeenProjectWriteKey: keenProjectWriteKey,
ShouldKeenMetrics: keenMetrics,
}, nil
}
示例5: NewPullOptions
// NewPullOptions constructor
func NewPullOptions(c util.Settings, e *util.Environment) (*PullOptions, error) {
globalOpts, err := NewGlobalOptions(c, e)
if err != nil {
return nil, err
}
// dockerOpts, err := NewDockerOptions(c, e, globalOpts)
// if err != nil {
// return nil, err
// }
repository, _ := c.String("target")
output, _ := c.String("output")
outputDir, err := filepath.Abs(output)
if err != nil {
return nil, err
}
branch, _ := c.String("branch")
status, _ := c.String("status")
result, _ := c.String("result")
load, _ := c.Bool("load")
force, _ := c.Bool("force")
return &PullOptions{
GlobalOptions: globalOpts,
// DockerOptions: dockerOpts,
Repository: repository,
Branch: branch,
Status: status,
Result: result,
Output: outputDir,
Load: load,
Force: force,
}, nil
}
示例6: NewPipelineOptions
// NewPipelineOptions big-ass constructor
func NewPipelineOptions(c util.Settings, e *util.Environment) (*PipelineOptions, error) {
globalOpts, err := NewGlobalOptions(c, e)
if err != nil {
return nil, err
}
// dockerOpts, err := NewDockerOptions(c, e, globalOpts)
// if err != nil {
// return nil, err
// }
awsOpts, err := NewAWSOptions(c, e, globalOpts)
if err != nil {
return nil, err
}
gitOpts, err := NewGitOptions(c, e, globalOpts)
if err != nil {
return nil, err
}
keenOpts, err := NewKeenOptions(c, e, globalOpts)
if err != nil {
return nil, err
}
reporterOpts, err := NewReporterOptions(c, e, globalOpts)
if err != nil {
return nil, err
}
buildID, _ := c.String("build-id")
deployID, _ := c.String("deploy-id")
pipelineID := ""
if deployID != "" {
pipelineID = deployID
} else {
pipelineID = buildID
}
deployTarget, _ := c.String("deploy-target")
pipeline, _ := c.String("pipeline")
applicationName, err := guessApplicationName(c, e)
if err != nil {
return nil, err
}
applicationID := guessApplicationID(c, e, applicationName)
applicationOwnerName := guessApplicationOwnerName(c, e)
applicationStartedByName, _ := c.String("application-started-by-name")
if applicationStartedByName == "" {
applicationStartedByName = applicationOwnerName
}
repository, _ := c.String("commit")
shouldCommit := (repository != "")
tag := guessTag(c, e)
message := guessMessage(c, e)
shouldStoreLocal, _ := c.Bool("store-local")
shouldStoreS3, _ := c.Bool("store-s3")
workingDir, _ := c.String("working-dir")
workingDir, _ = filepath.Abs(workingDir)
guestRoot, _ := c.String("guest-root")
mntRoot, _ := c.String("mnt-root")
reportRoot, _ := c.String("report-root")
projectID := guessProjectID(c, e)
projectPath := guessProjectPath(c, e)
projectURL := guessProjectURL(c, e)
if projectPath == workingDir {
return nil, fmt.Errorf("Project path can't be the same as the working dir")
}
// These timeouts are given in minutes but we store them as milliseconds
commandTimeoutFloat, _ := c.Float64("command-timeout")
commandTimeout := int(commandTimeoutFloat * 1000 * 60)
noResponseTimeoutFloat, _ := c.Float64("no-response-timeout")
noResponseTimeout := int(noResponseTimeoutFloat * 1000 * 60)
shouldArtifacts, _ := c.Bool("artifacts")
// TODO(termie): switch negative flag
shouldRemove, _ := c.Bool("no-remove")
shouldRemove = !shouldRemove
sourceDir, _ := c.String("source-dir")
attachOnError, _ := c.Bool("attach-on-error")
directMount, _ := c.Bool("direct-mount")
enableDevSteps, _ := c.Bool("enable-dev-steps")
publishPorts, _ := c.StringSlice("publish")
enableVolumes, _ := c.Bool("enable-volumes")
werckerYml, _ := c.String("wercker-yml")
return &PipelineOptions{
GlobalOptions: globalOpts,
AWSOptions: awsOpts,
// DockerOptions: dockerOpts,
GitOptions: gitOpts,
KeenOptions: keenOpts,
//.........这里部分代码省略.........