github.com/huiliang/nomad@v0.2.1-0.20151124023127-7a8b664699ff/command/helpers.go (about)

     1  package command
     2  
     3  import (
     4  	"github.com/ryanuber/columnize"
     5  )
     6  
     7  // formatKV takes a set of strings and formats them into properly
     8  // aligned k = v pairs using the columnize library.
     9  func formatKV(in []string) string {
    10  	columnConf := columnize.DefaultConfig()
    11  	columnConf.Empty = "<none>"
    12  	columnConf.Glue = " = "
    13  	return columnize.Format(in, columnConf)
    14  }
    15  
    16  // formatList takes a set of strings and formats them into properly
    17  // aligned output, replacing any blank fields with a placeholder
    18  // for awk-ability.
    19  func formatList(in []string) string {
    20  	columnConf := columnize.DefaultConfig()
    21  	columnConf.Empty = "<none>"
    22  	return columnize.Format(in, columnConf)
    23  }