diff --git a/scribe/emitter.go b/scribe/emitter.go index 27935461..7522a860 100644 --- a/scribe/emitter.go +++ b/scribe/emitter.go @@ -89,11 +89,26 @@ Entries: func (e Emitter) LaunchProcesses(processes []packit.Process, processEnvs ...map[string]packit.Environment) { e.Process("Assigning launch processes:") + var ( + typePadding int + ) + for _, process := range processes { - p := fmt.Sprintf("%s: %s", process.Type, process.Command) + if len(process.Type) > typePadding { + typePadding = len([]byte(process.Type)) + } + } + + for _, process := range processes { + pad := typePadding + len(process.Command) - len(process.Type) + p := fmt.Sprintf("%s: %*s", process.Type, pad, process.Command) if process.Args != nil { - p = fmt.Sprintf("%s %s", p, strings.Join(process.Args, " ")) + p += " " + strings.Join(process.Args, " ") + } + + if process.Default { + p += " " + "(default)" } e.Subprocess(p) diff --git a/scribe/emitter_test.go b/scribe/emitter_test.go index 4906b40a..e25fe94d 100644 --- a/scribe/emitter_test.go +++ b/scribe/emitter_test.go @@ -47,7 +47,6 @@ func testEmitter(t *testing.T, context spec.G, it spec.S) { } }) - it("prints details about the selected dependency", func() { emitter.SelectedDependency(entry, dependency, now) Expect(buffer.String()).To(ContainLines( @@ -236,6 +235,7 @@ func testEmitter(t *testing.T, context spec.G, it spec.S) { { Type: "web", Command: "web-command", + Default: true, }, { Type: "some-other-type", @@ -250,8 +250,8 @@ func testEmitter(t *testing.T, context spec.G, it spec.S) { Expect(buffer.String()).To(ContainLines( " Assigning launch processes:", - " some-type: some-command", - " web: web-command", + " some-type: some-command", + " web: web-command (default)", " some-other-type: some-other-command some args", "", )) @@ -280,8 +280,8 @@ func testEmitter(t *testing.T, context spec.G, it spec.S) { Expect(buffer.String()).To(ContainLines( " Assigning launch processes:", - " some-type: some-command", - " web: web-command", + " some-type: some-command", + " web: web-command (default)", ` ANOTHER_WEB_VAR -> "another-env"`, ` WEB_VAR -> "some-env"`, " some-other-type: some-other-command some args",