1
0
mirror of https://github.com/go-task/task.git synced 2025-01-12 04:34:11 +02:00

print task in command section

This commit is contained in:
jaedle 2019-02-24 17:23:31 +01:00
parent a4a20d92a4
commit c82a7240bb
2 changed files with 7 additions and 3 deletions

View File

@ -24,7 +24,11 @@ func printTaskCommands(cmds []*taskfile.Cmd, logger *logger.Logger) {
logger.Outf("")
logger.Outf("commands:")
for _, c := range cmds {
if c.Cmd != "" {
logger.Outf(" - %s", c.Cmd)
} else {
logger.Outf(" - Task: %s", c.Task)
}
}
}
}

View File

@ -75,7 +75,7 @@ func TestPrintTaskCommandsIfPresent(t *testing.T) {
Cmds: []*taskfile.Cmd{
{Cmd: "command-1"},
{Cmd: "command-2"},
{Cmd: "command-3"},
{Task: "task-1"},
},
}
@ -84,7 +84,7 @@ func TestPrintTaskCommandsIfPresent(t *testing.T) {
assert.Contains(t, buffer.String(), "\ncommands:\n")
assert.Contains(t, buffer.String(), "\n - command-1\n")
assert.Contains(t, buffer.String(), "\n - command-2\n")
assert.Contains(t, buffer.String(), "\n - command-3\n")
assert.Contains(t, buffer.String(), "\n - Task: task-1\n")
}
func TestDoesNotPrintCommandIfMissing(t *testing.T) {