本文整理汇总了Golang中github.com/brooklyncentral/brooklyn-cli/terminal.NewTable函数的典型用法代码示例。如果您正苦于以下问题:Golang NewTable函数的具体用法?Golang NewTable怎么用?Golang NewTable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewTable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Run
func (cmd *Deploy) Run(scope scope.Scope, c *cli.Context) {
if err := net.VerifyLoginURL(cmd.network); err != nil {
error_handler.ErrorExit(err)
}
var create models.TaskSummary
var err error
var blueprint []byte
if c.Args().First() == "" {
error_handler.ErrorExit("A filename or '-' must be provided as the first argument", error_handler.CLIUsageErrorExitCode)
}
if c.Args().First() == "-" {
blueprint, err = ioutil.ReadAll(os.Stdin)
if err != nil {
error_handler.ErrorExit(err)
}
create, err = application.CreateFromBytes(cmd.network, blueprint)
} else {
create, err = application.Create(cmd.network, c.Args().First())
}
if nil != err {
if httpErr, ok := err.(net.HttpError); ok {
error_handler.ErrorExit(strings.Join([]string{httpErr.Status, httpErr.Body}, "\n"), httpErr.Code)
} else {
error_handler.ErrorExit(err)
}
}
table := terminal.NewTable([]string{"Id:", create.EntityId})
table.Add("Name:", create.EntityDisplayName)
table.Add("Status:", create.CurrentStatus)
table.Print()
}
开发者ID:andreaturli,项目名称:brooklyn-cli,代码行数:32,代码来源:deploy.go
示例2: show
func (cmd *Activity) show(activityId string) {
activity, err := activities.Activity(cmd.network, activityId)
if nil != err {
error_handler.ErrorExit(err)
}
table := terminal.NewTable([]string{"Id:", activity.Id})
table.Add("DisplayName:", activity.DisplayName)
table.Add("Description:", activity.Description)
table.Add("EntityId:", activity.EntityId)
table.Add("EntityDisplayName:", activity.EntityDisplayName)
table.Add("Submitted:", time.Unix(activity.SubmitTimeUtc/1000, 0).Format(time.UnixDate))
table.Add("Started:", time.Unix(activity.StartTimeUtc/1000, 0).Format(time.UnixDate))
table.Add("Ended:", time.Unix(activity.EndTimeUtc/1000, 0).Format(time.UnixDate))
table.Add("CurrentStatus:", activity.CurrentStatus)
table.Add("IsError:", strconv.FormatBool(activity.IsError))
table.Add("IsCancelled:", strconv.FormatBool(activity.IsCancelled))
table.Add("SubmittedByTask:", activity.SubmittedByTask.Metadata.Id)
if activity.Streams["stdin"].Metadata.Size > 0 ||
activity.Streams["stdout"].Metadata.Size > 0 ||
activity.Streams["stderr"].Metadata.Size > 0 ||
activity.Streams["env"].Metadata.Size > 0 {
table.Add("Streams:", fmt.Sprintf("stdin: %d, stdout: %d, stderr: %d, env %d",
activity.Streams["stdin"].Metadata.Size,
activity.Streams["stdout"].Metadata.Size,
activity.Streams["stderr"].Metadata.Size,
activity.Streams["env"].Metadata.Size))
} else {
table.Add("Streams:", "")
}
table.Add("DetailedStatus:", fmt.Sprintf("\"%s\"", activity.DetailedStatus))
table.Print()
}
开发者ID:andreaturli,项目名称:brooklyn-cli,代码行数:33,代码来源:activity.go
示例3: Run
func (cmd *AddChildren) Run(c *cli.Context) {
activity := entities.AddChildren(cmd.network, c.Args()[0], c.Args()[1], c.Args()[2])
table := terminal.NewTable([]string{"Id", "Task", "Submitted", "Status"})
table.Add(activity.Id, activity.DisplayName, time.Unix(activity.SubmitTimeUtc/1000, 0).Format(time.UnixDate), activity.CurrentStatus)
table.Print()
}
开发者ID:burkechris,项目名称:brooklyn-cli,代码行数:7,代码来源:add-children.go
示例4: Run
func (cmd *Application) Run(c *cli.Context) {
application := application.Application(cmd.network, c.Args()[0])
table := terminal.NewTable([]string{"Name", "Id", "Status", "Location"})
table.Add(application.Spec.Name, application.Id, string(application.Status), strings.Join(application.Spec.Locations, ", "))
table.Print()
}
开发者ID:burkechris,项目名称:brooklyn-cli,代码行数:7,代码来源:application.go
示例5: show
func (cmd *Application) show(appName string) {
application, err := application.Application(cmd.network, appName)
if nil != err {
error_handler.ErrorExit(err)
}
entity, err := entities.GetEntity(cmd.network, appName, appName)
if nil != err {
error_handler.ErrorExit(err)
}
state, err := entity_sensors.CurrentState(cmd.network, appName, appName)
if nil != err {
error_handler.ErrorExit(err)
}
location, err := locations.GetLocation(cmd.network, application.Spec.Locations[0])
if nil != err {
error_handler.ErrorExit(err)
}
table := terminal.NewTable([]string{"Id:", application.Id})
table.Add("Name:", application.Spec.Name)
table.Add("Status:", string(application.Status))
if serviceUp, ok := state[serviceIsUpStr]; ok {
table.Add("ServiceUp:", fmt.Sprintf("%v", serviceUp))
}
table.Add("Type:", application.Spec.Type)
table.Add("CatalogItemId:", entity.CatalogItemId)
table.Add("LocationId:", strings.Join(application.Spec.Locations, ", "))
table.Add("LocationName:", location.Name)
table.Add("LocationSpec:", location.Spec)
table.Add("LocationType:", location.Type)
table.Print()
}
开发者ID:andreaturli,项目名称:brooklyn-cli,代码行数:31,代码来源:application.go
示例6: Run
func (cmd *Config) Run(scope scope.Scope, c *cli.Context) {
if err := net.VerifyLoginURL(cmd.network); err != nil {
error_handler.ErrorExit(err)
}
if c.Args().Present() {
configValue, err := entity_config.ConfigValue(cmd.network, scope.Application, scope.Entity, c.Args().First())
if nil != err {
error_handler.ErrorExit(err)
}
displayValue, err := stringRepresentation(configValue)
if nil != err {
error_handler.ErrorExit(err)
}
fmt.Println(displayValue)
} else {
config, err := entity_config.ConfigCurrentState(cmd.network, scope.Application, scope.Entity)
if nil != err {
error_handler.ErrorExit(err)
}
table := terminal.NewTable([]string{"Key", "Value"})
for key, value := range config {
table.Add(key, fmt.Sprintf("%v", value))
}
table.Print()
}
}
开发者ID:andreaturli,项目名称:brooklyn-cli,代码行数:28,代码来源:config.go
示例7: Run
func (cmd *Catalog) Run(c *cli.Context) {
catalog := catalog.Catalog(cmd.network)
table := terminal.NewTable([]string{"Id", "Name", "Description"})
for _, app := range catalog {
table.Add(app.Id, app.Name, app.Description)
}
table.Print()
}
开发者ID:burkechris,项目名称:brooklyn-cli,代码行数:8,代码来源:catalog.go
示例8: Run
func (cmd *Children) Run(c *cli.Context) {
entityList := entities.Children(cmd.network, c.Args()[0], c.Args()[1])
table := terminal.NewTable([]string{"Id", "Name", "Type"})
for _, entity := range entityList {
table.Add(entity.Id, entity.Name, entity.Type)
}
table.Print()
}
开发者ID:burkechris,项目名称:brooklyn-cli,代码行数:8,代码来源:entity-children.go
示例9: Run
func (cmd *Locations) Run(c *cli.Context) {
locationList := locations.LocationList(cmd.network)
table := terminal.NewTable([]string{"Id", "Name", "Spec"})
for _, location := range locationList {
table.Add(location.Id, location.Name, location.Spec)
}
table.Print()
}
开发者ID:burkechris,项目名称:brooklyn-cli,代码行数:8,代码来源:locations.go
示例10: Run
func (cmd *Policies) Run(c *cli.Context) {
policies := entity_policies.PolicyList(cmd.network, c.Args()[0], c.Args()[1])
table := terminal.NewTable([]string{"Name", "State"})
for _, policy := range policies {
table.Add(policy.Name, string(policy.State))
}
table.Print()
}
开发者ID:burkechris,项目名称:brooklyn-cli,代码行数:8,代码来源:policies.go
示例11: Run
func (cmd *Applications) Run(c *cli.Context) {
applications := application.Applications(cmd.network)
table := terminal.NewTable([]string{"Id", "Name", "Status", "Location"})
for _, app := range applications {
table.Add(app.Id, app.Spec.Name, string(app.Status), strings.Join(app.Spec.Locations, ", "))
}
table.Print()
}
开发者ID:burkechris,项目名称:brooklyn-cli,代码行数:9,代码来源:applications.go
示例12: list
func (cmd *Application) list() {
applications, err := application.Applications(cmd.network)
if nil != err {
error_handler.ErrorExit(err)
}
table := terminal.NewTable([]string{"Id", "Name", "Status", "Location"})
for _, app := range applications {
table.Add(app.Id, app.Spec.Name, string(app.Status), strings.Join(app.Spec.Locations, ", "))
}
table.Print()
}
开发者ID:andreaturli,项目名称:brooklyn-cli,代码行数:11,代码来源:application.go
示例13: list
func (cmd *Policy) list(application, entity string) {
policies, err := entity_policies.PolicyList(cmd.network, application, entity)
if nil != err {
error_handler.ErrorExit(err)
}
table := terminal.NewTable([]string{"Id", "Name", "State"})
for _, policy := range policies {
table.Add(policy.Id, policy.Name, string(policy.State))
}
table.Print()
}
开发者ID:andreaturli,项目名称:brooklyn-cli,代码行数:11,代码来源:policy.go
示例14: listapp
func (cmd *Entity) listapp(application string) {
entitiesList, err := entities.EntityList(cmd.network, application)
if nil != err {
error_handler.ErrorExit(err)
}
table := terminal.NewTable([]string{"Id", "Name", "Type"})
for _, entityitem := range entitiesList {
table.Add(entityitem.Id, entityitem.Name, entityitem.Type)
}
table.Print()
}
开发者ID:andreaturli,项目名称:brooklyn-cli,代码行数:11,代码来源:entity.go
示例15: Run
func (cmd *Effectors) Run(c *cli.Context) {
effectors := entity_effectors.EffectorList(cmd.network, c.Args()[0], c.Args()[1])
table := terminal.NewTable([]string{"Name", "Description", "Parameters"})
for _, effector := range effectors {
var parameters []string
for _, parameter := range effector.Parameters {
parameters = append(parameters, parameter.Name)
}
table.Add(effector.Name, effector.Description, strings.Join(parameters, ","))
}
table.Print()
}
开发者ID:burkechris,项目名称:brooklyn-cli,代码行数:12,代码来源:effectors.go
示例16: Run
func (cmd *AddChildren) Run(scope scope.Scope, c *cli.Context) {
if err := net.VerifyLoginURL(cmd.network); err != nil {
error_handler.ErrorExit(err)
}
activity, err := entities.AddChildren(cmd.network, scope.Application, scope.Entity, c.Args().First())
if nil != err {
error_handler.ErrorExit(err)
}
table := terminal.NewTable([]string{"Id", "Task", "Submitted", "Status"})
table.Add(activity.Id, activity.DisplayName, time.Unix(activity.SubmitTimeUtc/1000, 0).Format(time.UnixDate), activity.CurrentStatus)
table.Print()
}
开发者ID:andreaturli,项目名称:brooklyn-cli,代码行数:13,代码来源:add-children.go
示例17: Run
func (cmd *Locations) Run(scope scope.Scope, c *cli.Context) {
if err := net.VerifyLoginURL(cmd.network); err != nil {
error_handler.ErrorExit(err)
}
locationList, err := locations.LocationList(cmd.network)
if nil != err {
error_handler.ErrorExit(err)
}
table := terminal.NewTable([]string{"Id", "Name", "Spec"})
for _, location := range locationList {
table.Add(location.Id, location.Name, location.Spec)
}
table.Print()
}
开发者ID:andreaturli,项目名称:brooklyn-cli,代码行数:14,代码来源:locations.go
示例18: list
func (cmd *Activity) list(application, entity string) {
activityList, err := entities.GetActivities(cmd.network, application, entity)
if nil != err {
error_handler.ErrorExit(err)
}
table := terminal.NewTable([]string{"Id", "Task", "Submitted", "Status", "Streams"})
for _, activity := range activityList {
table.Add(activity.Id,
truncate(activity.DisplayName),
time.Unix(activity.SubmitTimeUtc/1000, 0).Format(time.UnixDate), truncate(activity.CurrentStatus),
streams(activity))
}
table.Print()
}
开发者ID:andreaturli,项目名称:brooklyn-cli,代码行数:14,代码来源:activity.go
示例19: Run
func (cmd *Catalog) Run(scope scope.Scope, c *cli.Context) {
if err := net.VerifyLoginURL(cmd.network); err != nil {
error_handler.ErrorExit(err)
}
catalog, err := catalog.Catalog(cmd.network)
if nil != err {
error_handler.ErrorExit(err)
}
table := terminal.NewTable([]string{"Id", "Name", "Description"})
for _, app := range catalog {
table.Add(app.Id, app.Name, app.Description)
}
table.Print()
}
开发者ID:andreaturli,项目名称:brooklyn-cli,代码行数:14,代码来源:catalog.go
示例20: show
func (cmd *Policy) show(application, entity, policy string) {
configs, err := entity_policy_config.GetAllConfigValues(cmd.network, application, entity, policy)
if nil != err {
error_handler.ErrorExit(err)
}
table := terminal.NewTable([]string{"Name", "Value", "Description"})
var theConfigs policyConfigList = configs
sort.Sort(theConfigs)
for _, config := range theConfigs {
value, err := entity_policy_config.GetConfigValue(cmd.network, application, entity, policy, config.Name)
if nil != err {
error_handler.ErrorExit(err)
}
table.Add(config.Name, value, config.Description)
}
table.Print()
}
开发者ID:andreaturli,项目名称:brooklyn-cli,代码行数:18,代码来源:policy.go
注:本文中的github.com/brooklyncentral/brooklyn-cli/terminal.NewTable函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论