• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang columnize.SimpleFormat函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/ryanuber/columnize.SimpleFormat函数的典型用法代码示例。如果您正苦于以下问题:Golang SimpleFormat函数的具体用法?Golang SimpleFormat怎么用?Golang SimpleFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了SimpleFormat函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: printAppDetail

func printAppDetail(a App) {
	var output []string
	var outputEnv []string
	fields := structs.New(a).Fields()

	fmt.Println("\nApplication Details:")

	for _, f := range fields {
		if f.Name() == "Addresses" {
			output = append(output, fmt.Sprintf("%s:\n", f.Name()))
			for _, v := range a.Addresses {
				output = append(output, fmt.Sprintf("……|%s", v))
			}
		} else if f.Name() == "Certificates" {
			output = append(output, fmt.Sprintf("%s:| Use \"--full\" to see certificates", f.Name()))
			output = append(output, fmt.Sprintf("– PrivateKey: |%s\n", a.Certificates["private_key"]))
		} else if f.Name() == "CreatedAt" {
			output = append(output, fmt.Sprintf("%s: | %s\n", f.Name(), utils.FormatTime(a.CreatedAt+"Z")))
		} else if f.Name() == "CurrentDeployments" {
			output = append(output, fmt.Sprintf("%s:\n", f.Name()))
			for k, v := range a.CurrentDeployments {
				output = append(output, fmt.Sprintf("……|%s: %s", k, v))
			}
		} else if f.Name() == "Environment" {
			outputEnv = append(outputEnv, fmt.Sprintf("%s:\n", f.Name()))
			for k, v := range a.Environment {
				outputEnv = append(outputEnv, fmt.Sprintf("%s=%s", k, v))
			}
		} else if f.Name() == "Location" {
			output = append(output, fmt.Sprintf("%s: |Identifier: %s\t UUID: %s\n", f.Name(), a.Location["identifier"], a.Location["uuid"]))
		} else if f.Name() == "Metadata" {
			mdata, _ := json.Marshal(a.Metadata)
			output = append(output, fmt.Sprintf("%s: |%s\n", f.Name(), mdata))
		} else if f.Name() == "Ports" {
			output = append(output, fmt.Sprintf("%s:\n", f.Name()))
			for _, v := range a.Ports {
				output = append(output, fmt.Sprintf("……|%s", v))
			}
		} else if f.Name() == "Rules" {
			output = append(output, fmt.Sprintf("%s:\n", f.Name()))
			for k, v := range a.Rules {
				output = append(output, fmt.Sprintf("……|%s=%v", k, v))
			}
		} else if f.Name() == "SSLPorts" {
			output = append(output, fmt.Sprintf("%s:\n", f.Name()))
			for _, v := range a.SSLPorts {
				output = append(output, fmt.Sprintf("……|%s", v))
			}
		} else if f.Name() == "UpdatedAt" {
			output = append(output, fmt.Sprintf("%s: | %s\n", f.Name(), utils.FormatTime(a.UpdatedAt+"Z")))
		} else {
			output = append(output, fmt.Sprintf("%s: |%v\n", f.Name(), f.Value()))
		}
	}

	fmt.Println(columnize.SimpleFormat(output))
	fmt.Println("\n")
	fmt.Println(columnize.SimpleFormat(outputEnv))
}
开发者ID:devx,项目名称:kumoru-cli,代码行数:59,代码来源:applications.go


示例2: listRun

func listRun(cmd *cobra.Command, args []string) {
	configDir, err := homedir.Expand(globalFlags.config)
	assert(err)

	machines, err := vm.List(configDir)
	assert(err)

	lines := []string{listHeader}
	for _, machine := range machines {
		var hds, nics []string
		for _, hd := range machine.HDs {
			hds = append(hds, fmt.Sprintf("%s %s", hd.Device, hd.Size))
		}
		for _, nic := range machine.NICs {
			nics = append(nics, fmt.Sprintf("%s %s", nic.Bridge, nic.Mac))
		}

		status, _ := machine.Status(listFlags.TMuxSessionName)

		lines = append(lines, fmt.Sprintf(listScheme,
			machine.Serial,
			machine.Image,
			machine.Memory,
			strings.Join(hds, ","),
			strings.Join(nics, ","),
			status))
	}
	fmt.Println(columnize.SimpleFormat(lines))
}
开发者ID:giantswarm,项目名称:onsho,代码行数:29,代码来源:list.go


示例3: listMethods

func (c *AuthCommand) listMethods() int {
	client, err := c.Client()
	if err != nil {
		c.Ui.Error(fmt.Sprintf(
			"Error initializing client: %s", err))
		return 1
	}

	auth, err := client.Sys().ListAuth()
	if err != nil {
		c.Ui.Error(fmt.Sprintf(
			"Error reading auth table: %s", err))
		return 1
	}

	paths := make([]string, 0, len(auth))
	for path := range auth {
		paths = append(paths, path)
	}
	sort.Strings(paths)

	columns := []string{"Path | Type | Description"}
	for _, k := range paths {
		a := auth[k]
		columns = append(columns, fmt.Sprintf(
			"%s | %s | %s", k, a.Type, a.Description))
	}

	c.Ui.Output(columnize.SimpleFormat(columns))
	return 0
}
开发者ID:carriercomm,项目名称:vault,代码行数:31,代码来源:auth.go


示例4: showInstances

func showInstances(cmd *cobra.Command, args []string) {
	requireProfile := false
	loadArgumentsFromCluster(cmd.Flags(), requireProfile)
	clusterInfoFromArgs(&instancesFlags, args)

	provider := newProvider()
	instancesFlags = provider.ClusterDefaults(instancesFlags)

	if instancesFlags.Name == "" {
		Exitf("Please specify a name\n")
	}
	instances, err := provider.GetInstances(instancesFlags)
	if err != nil {
		Exitf("Failed to list instances: %v\n", err)
	}
	clusterMembers, err := instances.AsClusterMemberList(log, nil)
	if err != nil {
		Exitf("Failed to fetch instance member data: %v\n", err)
	}

	lines := []string{"Name | Cluster IP | Public IP | Private IP | Machine ID | Options | Extra"}
	for _, i := range instances {
		cm, _ := clusterMembers.Find(i) // ignore errors
		options := []string{}
		if cm.EtcdProxy {
			options = append(options, "etcd-proxy")
		}
		lbIP := strings.TrimSpace(i.LoadBalancerIPv4 + " " + i.LoadBalancerIPv6)
		lines = append(lines, fmt.Sprintf("%s | %s | %s | %s | %s | %s | %s", i.Name, i.ClusterIP, lbIP, i.PrivateIP, cm.MachineID, strings.Join(options, ","), strings.Join(i.Extra, ",")))
	}
	result := columnize.SimpleFormat(lines)
	fmt.Println(result)
}
开发者ID:pulcy,项目名称:quark,代码行数:33,代码来源:instance_list.go


示例5: ShowDomainRecords

func (p *cfProvider) ShowDomainRecords(domain string) error {
	id, err := p.zoneID(domain)
	if err != nil {
		return maskAny(err)
	}

	url := apiUrl + fmt.Sprintf("zones/%s/dns_records", id)
	res, err := p.get(url, "application/json")
	if err != nil {
		return maskAny(err)
	}

	records := []CfDnsRecord{}
	if err := res.UnmarshalResult(&records); err != nil {
		return maskAny(err)
	}

	lines := []string{
		"Type | Name | Data",
	}
	for _, r := range records {
		line := fmt.Sprintf("%s | %s | %s", r.Type, trimLength(r.Name, 20), trimLength(r.Content, 60))
		lines = append(lines, line)
	}

	sort.Strings(lines[1:])
	result := columnize.SimpleFormat(lines)
	fmt.Println(result)

	return nil
}
开发者ID:pulcy,项目名称:quark,代码行数:31,代码来源:dns.go


示例6: ShowRegions

func (this *doProvider) ShowRegions() error {
	// Load regions
	client := NewDOClient(this.token)
	regions, err := RegionList(client)
	if err != nil {
		return err
	}

	lines := []string{
		"Slug | Name | Features | Size",
	}
	for _, r := range regions {
		if !r.Available {
			continue
		}
		line := fmt.Sprintf("%s | %s | %s | %s", r.Slug, r.Name, strings.Join(r.Features, " "), strings.Join(r.Sizes, " "))
		lines = append(lines, line)
	}

	sort.Strings(lines[1:])
	result := columnize.SimpleFormat(lines)
	fmt.Println(result)

	return nil
}
开发者ID:pulcy,项目名称:quark,代码行数:25,代码来源:regions.go


示例7: showClusterInfo

func showClusterInfo(cmd *cobra.Command, args []string) {
	requireProfile := false
	loadArgumentsFromCluster(cmd.Flags(), requireProfile)
	clusterInfoFromArgs(&clusterInfoFlags, args)

	provider := newProvider()
	clusterInfoFlags = provider.ClusterDefaults(clusterInfoFlags)

	if clusterInfoFlags.Name == "" {
		Exitf("Please specify a name\n")
	}
	instances, err := provider.GetInstances(clusterInfoFlags)
	if err != nil {
		Exitf("Failed to list instances: %v\n", err)
	}
	clusterMembers, err := instances.AsClusterMemberList(log, nil)
	if err != nil {
		Exitf("Failed to fetch instance member data: %v\n", err)
	}

	lines := []string{
		fmt.Sprintf("ID | %s", clusterMembers[0].ClusterID),
		fmt.Sprintf("#Instances | %d", len(instances)),
	}
	result := columnize.SimpleFormat(lines)
	fmt.Println(result)
}
开发者ID:pulcy,项目名称:quark,代码行数:27,代码来源:cluster_info.go


示例8: Run

func (this *Alias) Run(args []string) (exitCode int) {
	cmdFlags := flag.NewFlagSet("alias", flag.ContinueOnError)
	cmdFlags.Usage = func() { this.Ui.Output(this.Help()) }
	if err := cmdFlags.Parse(args); err != nil {
		return 1
	}

	aliases := ctx.AliasesWithValue()
	sortedNames := make([]string, 0, len(aliases))
	for name, _ := range aliases {
		sortedNames = append(sortedNames, name)
	}
	sort.Strings(sortedNames)

	lines := make([]string, 0, len(aliases)+1)
	header := "Alias|Command"
	lines = append(lines, header)
	for _, name := range sortedNames {
		lines = append(lines, fmt.Sprintf("%s|%s", name, aliases[name]))
	}

	fmt.Println(columnize.SimpleFormat(lines))

	return
}
开发者ID:funkygao,项目名称:gafka,代码行数:25,代码来源:alias.go


示例9: runInstances

func runInstances(args []string) (exit int) {
	if len(args) == 0 {
		return exitError("no Swarm given. Usage: kocho instances <swarm>")
	} else if len(args) > 1 {
		return exitError("too many arguments. Usage: kocho instances <swarm>")
	}
	swarmName := args[0]

	s, err := swarmService.Get(swarmName, swarm.AWS)
	if err != nil {
		return exitError(fmt.Sprintf("couldn't get instances of swarm: %s", swarmName), err)
	}

	instances, err := s.GetInstances()
	if err != nil {
		return exitError(fmt.Sprintf("couldn't get instances of swarm: %s", swarmName), err)
	}

	lines := []string{instancesHeader}
	for _, i := range instances {
		lines = append(lines, fmt.Sprintf(instancesScheme, i.Id, i.Image, i.Type, i.PublicDNSName, i.PrivateDNSName))
	}
	fmt.Println(columnize.SimpleFormat(lines))
	return 0
}
开发者ID:giantswarm,项目名称:kocho,代码行数:25,代码来源:instances.go


示例10: SealStatus

// SealStatus shows the seal status of the vault
func (s *VaultService) SealStatus() error {
	m := sync.Mutex{}
	lines := []string{
		"Address | Status | Key Threshold | Key Shares | Unseal Progress",
	}
	seal := func(client VaultClient) error {
		s.log.Debugf("Fetching seal status of vault at %s", client.Address)
		status, err := client.Client.Sys().SealStatus()
		var line string
		if err != nil {
			line = fmt.Sprintf("%s | error: %s | - | - | -", client.Address, err.Error())
		} else {
			statusText := "unsealed"
			if status.Sealed {
				statusText = "sealed"
			}
			line = fmt.Sprintf("%s | %s | %d | %d | %d", client.Address, statusText, status.T, status.N, status.Progress)
		}
		m.Lock()
		defer m.Unlock()
		lines = append(lines, line)
		return nil
	}
	if err := s.asyncForEachClient(seal); err != nil {
		return maskAny(err)
	}
	fmt.Println(columnize.SimpleFormat(lines))
	return nil
}
开发者ID:pulcy,项目名称:vault-monkey,代码行数:30,代码来源:seal.go


示例11: printSummary

func (this *Clusters) printSummary(zkzone *zk.ZkZone, clusterPattern string, port string) {
	lines := []string{"Zone|Cluster|Brokers|Topics|Partitions|FlatMsg|Cum"}

	type summary struct {
		zone, cluster               string
		brokers, topics, partitions int
		flat, cum                   int64
	}
	summaries := make([]summary, 0, 10)
	zkzone.ForSortedClusters(func(zkcluster *zk.ZkCluster) {
		if !patternMatched(zkcluster.Name(), clusterPattern) {
			return
		}

		brokers, topics, partitions, flat, cum := this.clusterSummary(zkcluster)
		summaries = append(summaries, summary{zkzone.Name(), zkcluster.Name(), brokers, topics, partitions,
			flat, cum})

	})
	sortutil.DescByField(summaries, "cum")
	var totalFlat, totalCum int64
	for _, s := range summaries {
		lines = append(lines, fmt.Sprintf("%s|%s|%d|%d|%d|%s|%s",
			s.zone, s.cluster, s.brokers, s.topics, s.partitions,
			gofmt.Comma(s.flat), gofmt.Comma(s.cum)))

		totalCum += s.cum
		totalFlat += s.flat
	}
	this.Ui.Output(columnize.SimpleFormat(lines))
	this.Ui.Output(fmt.Sprintf("Flat:%s Cum:%s", gofmt.Comma(totalFlat), gofmt.Comma(totalCum)))
}
开发者ID:funkygao,项目名称:gafka,代码行数:32,代码来源:clusters.go


示例12: statusRun

func statusRun(cmd *cobra.Command, args []string) {
	if len(args) != 1 {
		fmt.Println("Serial missing")
		os.Exit(1)
	}

	configDir, err := homedir.Expand(globalFlags.config)
	assert(err)

	machine, err := vm.Load(configDir, args[0])
	assert(err)

	status, err := machine.Status(statusFlags.TMuxSessionName)
	assert(err)

	var hds, nics []string
	for _, hd := range machine.HDs {
		hds = append(hds, fmt.Sprintf("%s %s", hd.Device, hd.Size))
	}
	for _, nic := range machine.NICs {
		nics = append(nics, fmt.Sprintf("%s %s", nic.Bridge, nic.Mac))
	}

	lines := []string{}
	lines = append(lines, fmt.Sprintf(statusScheme, "Serial:", machine.Serial))
	lines = append(lines, fmt.Sprintf(statusScheme, "Status:", status))
	lines = append(lines, fmt.Sprintf(statusScheme, "Image:", machine.Image))
	lines = append(lines, fmt.Sprintf("%s | %d", "Memory:", machine.Memory))
	lines = append(lines, fmt.Sprintf(statusScheme, "HDs:", strings.Join(hds, ",")))
	lines = append(lines, fmt.Sprintf(statusScheme, "NICs:", strings.Join(nics, ",")))
	fmt.Println(columnize.SimpleFormat(lines))
}
开发者ID:giantswarm,项目名称:onsho,代码行数:32,代码来源:status.go


示例13: printAllocations

func printAllocations(mesos *lib.Mesos) int {
	output := make([]string, 1)
	output[0] = "Hostname | Cpu % | Cpu Ratio | Mem % | Mem Ratio | Disk % | Disk Ratio"

	for _, s := range mesos.Cluster.Slaves {
		ss := s.Stats
		ln := fmt.Sprintf(
			"%s | %.0f | %.1f/%d | %.0f | %d/%d | %.0f| %d/%d",
			s.HostName,
			ss.CpusPercent*100,
			ss.CpusUsed,
			ss.CpusTotal,
			ss.MemPercent*100,
			ss.MemUsed,
			ss.MemTotal,
			ss.DiskPercent*100,
			ss.DiskUsed,
			ss.DiskTotal,
		)
		output = append(output, ln)
	}

	result := columnize.SimpleFormat(output)
	fmt.Println(result)
	return 0
}
开发者ID:AndrewBurnell,项目名称:notadash,代码行数:26,代码来源:allocation.go


示例14: listRun

func listRun(cmd *cobra.Command, args []string) {
	if listFlags.Fields == "" {
		fmt.Printf("Invalid fields parameter. Please choose valid fields: %s\n", strings.Join(hostToFieldKeys(listFields), ","))
		os.Exit(1)
	}

	cols := strings.Split(listFlags.Fields, ",")
	for _, s := range cols {
		if _, ok := listFields[s]; !ok {
			fmt.Printf("Invalid field: %q.\n\nUsage: %s\n", s, cmd.Usage())
			os.Exit(1)
		}
	}

	hosts, err := mayu.List()
	assert(err)

	lines := []string{}
	for _, host := range hosts {
		var f []string
		for _, c := range cols {
			f = append(f, listFields[c](&host))
		}
		lines = append(lines, strings.Join(f, "|"))
	}
	sort.Strings(lines)

	if !listFlags.NoLegend {
		lines = append([]string{strings.ToUpper(strings.Join(cols, "|"))}, lines...)
	}

	fmt.Println(columnize.SimpleFormat(lines))
}
开发者ID:giantswarm,项目名称:mayu,代码行数:33,代码来源:list.go


示例15: AppList

func AppList(configStore *config.Store, env string) error {

	envs := []string{env}

	if env == "" {
		var err error
		envs, err = configStore.ListEnvs()
		if err != nil {
			return err
		}
	}

	columns := []string{"NAME | ENV | VERSION | IMAGE ID | CONFIG | POOLS "}

	for _, env := range envs {

		appList, err := configStore.ListApps(env)
		if err != nil {
			return err
		}

		pools, err := configStore.ListPools(env)
		if err != nil {
			return err
		}

		for _, app := range appList {
			name := app.Name()
			versionDeployed := app.Version()
			versionID := app.VersionID()
			if len(versionID) > 12 {
				versionID = versionID[:12]
			}

			assignments := []string{}
			for _, pool := range pools {
				aa, err := configStore.ListAssignments(env, pool)
				if err != nil {
					return err
				}
				if utils.StringInSlice(app.Name(), aa) {
					assignments = append(assignments, pool)
				}
			}

			columns = append(columns, strings.Join([]string{
				name,
				env,
				versionDeployed,
				versionID,
				strconv.FormatInt(app.ID(), 10),
				strings.Join(assignments, ","),
			}, " | "))
		}
	}
	output := columnize.SimpleFormat(columns)
	fmt.Println(output)
	return nil
}
开发者ID:carriercomm,项目名称:galaxy,代码行数:59,代码来源:app.go


示例16: Run

func (c *ServerMembersCommand) Run(args []string) int {
	var detailed bool

	flags := c.Meta.FlagSet("server-members", FlagSetClient)
	flags.Usage = func() { c.Ui.Output(c.Help()) }
	flags.BoolVar(&detailed, "detailed", false, "Show detailed output")

	if err := flags.Parse(args); err != nil {
		return 1
	}

	// Check for extra arguments
	args = flags.Args()
	if len(args) != 0 {
		c.Ui.Error(c.Help())
		return 1
	}

	// Get the HTTP client
	client, err := c.Meta.Client()
	if err != nil {
		c.Ui.Error(fmt.Sprintf("Error initializing client: %s", err))
		return 1
	}

	// Query the members
	srvMembers, err := client.Agent().Members()
	if err != nil {
		c.Ui.Error(fmt.Sprintf("Error querying servers: %s", err))
		return 1
	}

	if srvMembers == nil {
		c.Ui.Error("Agent doesn't know about server members")
		return 0
	}

	// Sort the members
	sort.Sort(api.AgentMembersNameSort(srvMembers.Members))

	// Determine the leaders per region.
	leaders, err := regionLeaders(client, srvMembers.Members)
	if err != nil {
		c.Ui.Error(fmt.Sprintf("Error determining leaders: %s", err))
		return 1
	}

	// Format the list
	var out []string
	if detailed {
		out = detailedOutput(srvMembers.Members)
	} else {
		out = standardOutput(srvMembers.Members, leaders)
	}

	// Dump the list
	c.Ui.Output(columnize.SimpleFormat(out))
	return 0
}
开发者ID:zanella,项目名称:nomad,代码行数:59,代码来源:server_members.go


示例17: RuntimeList

func RuntimeList(configStore *config.Store, app, env, pool string) error {

	envs := []string{env}

	if env == "" {
		var err error
		envs, err = configStore.ListEnvs()
		if err != nil {
			return err
		}
	}

	columns := []string{"ENV | NAME | POOL | PS | MEM | VHOSTS | PORT | MAINT"}

	for _, env := range envs {

		appList, err := configStore.ListApps(env)
		if err != nil {
			return err
		}

		for _, appCfg := range appList {

			if app != "" && appCfg.Name() != app {
				continue
			}

			for _, p := range appCfg.RuntimePools() {

				if pool != "" && p != pool {
					continue
				}

				name := appCfg.Name()
				ps := appCfg.GetProcesses(p)
				mem := appCfg.GetMemory(p)

				columns = append(columns, strings.Join([]string{
					env,
					name,
					p,
					strconv.FormatInt(int64(ps), 10),
					mem,
					appCfg.Env()["VIRTUAL_HOST"],
					appCfg.Env()["GALAXY_PORT"],
					fmt.Sprint(appCfg.GetMaintenanceMode(p)),
				}, " | "))
			}
		}
	}
	output := columnize.SimpleFormat(columns)
	fmt.Println(output)
	return nil

}
开发者ID:sguzwf,项目名称:galaxy,代码行数:55,代码来源:runtime.go


示例18: Run

func (c *MountsCommand) Run(args []string) int {
	flags := c.Meta.FlagSet("mounts", meta.FlagSetDefault)
	flags.Usage = func() { c.Ui.Error(c.Help()) }
	if err := flags.Parse(args); err != nil {
		return 1
	}

	client, err := c.Client()
	if err != nil {
		c.Ui.Error(fmt.Sprintf(
			"Error initializing client: %s", err))
		return 2
	}

	mounts, err := client.Sys().ListMounts()
	if err != nil {
		c.Ui.Error(fmt.Sprintf(
			"Error reading mounts: %s", err))
		return 2
	}

	paths := make([]string, 0, len(mounts))
	for path := range mounts {
		paths = append(paths, path)
	}
	sort.Strings(paths)

	columns := []string{"Path | Type | Default TTL | Max TTL | Description"}
	for _, path := range paths {
		mount := mounts[path]
		defTTL := "system"
		switch {
		case mount.Type == "system":
			defTTL = "n/a"
		case mount.Type == "cubbyhole":
			defTTL = "n/a"
		case mount.Config.DefaultLeaseTTL != 0:
			defTTL = strconv.Itoa(mount.Config.DefaultLeaseTTL)
		}
		maxTTL := "system"
		switch {
		case mount.Type == "system":
			maxTTL = "n/a"
		case mount.Type == "cubbyhole":
			maxTTL = "n/a"
		case mount.Config.MaxLeaseTTL != 0:
			maxTTL = strconv.Itoa(mount.Config.MaxLeaseTTL)
		}
		columns = append(columns, fmt.Sprintf(
			"%s | %s | %s | %s | %s", path, mount.Type, defTTL, maxTTL, mount.Description))
	}

	c.Ui.Output(columnize.SimpleFormat(columns))
	return 0
}
开发者ID:citywander,项目名称:vault,代码行数:55,代码来源:mounts.go


示例19: PrintLocationBrief

//PrintLocationBrief outputs a listing of locations with minimal details
func PrintLocationBrief(l []location.Location) {
	var output []string

	output = append(output, fmt.Sprintf("Provider | Region"))

	for i := 0; i < len(l); i++ {
		output = append(output, fmt.Sprintf("%s | %s", l[i].Provider, l[i].Region))
	}

	fmt.Println(columnize.SimpleFormat(output))
}
开发者ID:kumoru,项目名称:kumoru-sdk-go,代码行数:12,代码来源:locations.go


示例20: PrintLocationBrief

func PrintLocationBrief(l []pools.Location) {
	var output []string

	output = append(output, fmt.Sprintf("Location | Provider | UUID | Status"))

	for i := 0; i < len(l); i++ {
		output = append(output, fmt.Sprintf("%s | %s | %s| %s", l[i].Identifier, l[i].Provider, l[i].Uuid, l[i].Status))
	}

	fmt.Println(columnize.SimpleFormat(output))
}
开发者ID:devx,项目名称:kumoru-cli,代码行数:11,代码来源:locations.go



注:本文中的github.com/ryanuber/columnize.SimpleFormat函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang assert.Equal函数代码示例发布时间:2022-05-28
下一篇:
Golang columnize.Format函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap