diff --git a/procfile.go b/procfile.go index 9f4d668..910695a 100644 --- a/procfile.go +++ b/procfile.go @@ -5,6 +5,7 @@ import ( "fmt" _ "github.com/kr/pretty" "io" + "math" "os" "regexp" ) @@ -38,11 +39,18 @@ func (pf *Procfile) HasProcess(name string) (exists bool) { return false } -func (pf *Procfile) LongestProcessName() (longest int) { +func (pf *Procfile) LongestProcessName(concurrency map[string]int) (longest int) { longest = 6 // length of forego for _, entry := range pf.Entries { - if len(entry.Name) > longest { - longest = len(entry.Name) + thisLen := len(entry.Name) + // The "." + thisLen += 1 + if c, ok := concurrency[entry.Name]; ok { + // Add the number of digits + thisLen += int(math.Log10(float64(c))) + 1 + } + if thisLen > longest { + longest = thisLen } } return diff --git a/start.go b/start.go index d63fd76..0a5a953 100644 --- a/start.go +++ b/start.go @@ -191,7 +191,7 @@ func runStart(cmd *Command, args []string) { handleError(err) of := NewOutletFactory() - of.Padding = pf.LongestProcessName() + of.Padding = pf.LongestProcessName(concurrency) f := &Forego{ outletFactory: of,