本文整理汇总了Golang中github.com/convox/rack/Godeps/_workspace/src/github.com/codegangsta/cli.Context.Int方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.Int方法的具体用法?Golang Context.Int怎么用?Golang Context.Int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/convox/rack/Godeps/_workspace/src/github.com/codegangsta/cli.Context
的用法示例。
在下文中一共展示了Context.Int方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: cmdRackScale
func cmdRackScale(c *cli.Context) {
count := 0
typ := ""
if c.IsSet("count") {
count = c.Int("count")
}
if c.IsSet("type") {
typ = c.String("type")
}
system, err := rackClient(c).ScaleSystem(count, typ)
if err != nil {
stdcli.Error(err)
return
}
fmt.Printf("Name %s\n", system.Name)
fmt.Printf("Status %s\n", system.Status)
fmt.Printf("Version %s\n", system.Version)
fmt.Printf("Count %d\n", system.Count)
fmt.Printf("Type %s\n", system.Type)
}
示例2: cmdInstall
func cmdInstall(c *cli.Context) {
region := c.String("region")
if !lambdaRegions[region] {
stdcli.Error(fmt.Errorf("Convox is not currently supported in %s", region))
}
tenancy := "default"
instanceType := c.String("instance-type")
if c.Bool("dedicated") {
tenancy = "dedicated"
if strings.HasPrefix(instanceType, "t2") {
stdcli.Error(fmt.Errorf("t2 instance types aren't supported in dedicated tenancy, please set --instance-type."))
}
}
fmt.Println(Banner)
distinctId, err := currentId()
creds, err := readCredentials(c)
if err != nil {
handleError("install", distinctId, err)
return
}
if creds == nil {
err = fmt.Errorf("error reading credentials")
handleError("install", distinctId, err)
return
}
reader := bufio.NewReader(os.Stdin)
if email := c.String("email"); email != "" {
distinctId = email
updateId(distinctId)
} else if terminal.IsTerminal(int(os.Stdin.Fd())) {
fmt.Print("Email Address (optional, to receive project updates): ")
email, err := reader.ReadString('\n')
if err != nil {
handleError("install", distinctId, err)
return
}
if strings.TrimSpace(email) != "" {
distinctId = email
updateId(email)
}
}
development := "No"
if c.Bool("development") {
isDevelopment = true
development = "Yes"
}
encryption := "Yes"
if c.Bool("disable-encryption") {
encryption = "No"
}
ami := c.String("ami")
key := c.String("key")
stackName := c.String("stack-name")
vpcCIDR := c.String("vpc-cidr")
subnet0CIDR := c.String("subnet0-cidr")
subnet1CIDR := c.String("subnet1-cidr")
subnet2CIDR := c.String("subnet2-cidr")
versions, err := version.All()
if err != nil {
handleError("install", distinctId, err)
return
}
version, err := versions.Resolve(c.String("version"))
if err != nil {
handleError("install", distinctId, err)
return
}
versionName := version.Version
formationUrl := fmt.Sprintf(FormationUrl, versionName)
instanceCount := fmt.Sprintf("%d", c.Int("instance-count"))
fmt.Printf("Installing Convox (%s)...\n", versionName)
//.........这里部分代码省略.........
示例3: cmdInstall
//.........这里部分代码省略.........
}
ami := c.String("ami")
key := c.String("key")
vpcCIDR := c.String("vpc-cidr")
subnet0CIDR := c.String("subnet0-cidr")
subnet1CIDR := c.String("subnet1-cidr")
subnet2CIDR := c.String("subnet2-cidr")
subnetPrivate0CIDR := c.String("subnet-private0-cidr")
subnetPrivate1CIDR := c.String("subnet-private1-cidr")
subnetPrivate2CIDR := c.String("subnet-private2-cidr")
versions, err := version.All()
if err != nil {
handleError("install", distinctId, err)
return
}
version, err := versions.Resolve(c.String("version"))
if err != nil {
handleError("install", distinctId, err)
return
}
versionName := version.Version
formationUrl := fmt.Sprintf(FormationUrl, versionName)
instanceCount := fmt.Sprintf("%d", c.Int("instance-count"))
fmt.Printf("Installing Convox (%s)...\n", versionName)
if isDevelopment {
fmt.Println("(Development Mode)")
}
if private == "Yes" {
fmt.Println("(Private Network Edition)")
}
password := c.String("password")
if password == "" {
password = randomString(30)
}
CloudFormation := cloudformation.New(session.New(), awsConfig(region, creds))
req := &cloudformation.CreateStackInput{
Capabilities: []*string{aws.String("CAPABILITY_IAM")},
Parameters: []*cloudformation.Parameter{
&cloudformation.Parameter{ParameterKey: aws.String("Ami"), ParameterValue: aws.String(ami)},
&cloudformation.Parameter{ParameterKey: aws.String("ClientId"), ParameterValue: aws.String(distinctId)},
&cloudformation.Parameter{ParameterKey: aws.String("Development"), ParameterValue: aws.String(development)},
&cloudformation.Parameter{ParameterKey: aws.String("InstanceCount"), ParameterValue: aws.String(instanceCount)},
&cloudformation.Parameter{ParameterKey: aws.String("InstanceType"), ParameterValue: aws.String(instanceType)},
&cloudformation.Parameter{ParameterKey: aws.String("Key"), ParameterValue: aws.String(key)},
&cloudformation.Parameter{ParameterKey: aws.String("Password"), ParameterValue: aws.String(password)},
&cloudformation.Parameter{ParameterKey: aws.String("Private"), ParameterValue: aws.String(private)},
&cloudformation.Parameter{ParameterKey: aws.String("PrivateApi"), ParameterValue: aws.String(privateApi)},
&cloudformation.Parameter{ParameterKey: aws.String("Tenancy"), ParameterValue: aws.String(tenancy)},
&cloudformation.Parameter{ParameterKey: aws.String("Version"), ParameterValue: aws.String(versionName)},