mirror of
https://github.com/go-task/task.git
synced 2025-07-13 01:30:33 +02:00
print task in command section
This commit is contained in:
@ -24,7 +24,11 @@ func printTaskCommands(cmds []*taskfile.Cmd, logger *logger.Logger) {
|
|||||||
logger.Outf("")
|
logger.Outf("")
|
||||||
logger.Outf("commands:")
|
logger.Outf("commands:")
|
||||||
for _, c := range cmds {
|
for _, c := range cmds {
|
||||||
|
if c.Cmd != "" {
|
||||||
logger.Outf(" - %s", c.Cmd)
|
logger.Outf(" - %s", c.Cmd)
|
||||||
|
} else {
|
||||||
|
logger.Outf(" - Task: %s", c.Task)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ func TestPrintTaskCommandsIfPresent(t *testing.T) {
|
|||||||
Cmds: []*taskfile.Cmd{
|
Cmds: []*taskfile.Cmd{
|
||||||
{Cmd: "command-1"},
|
{Cmd: "command-1"},
|
||||||
{Cmd: "command-2"},
|
{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(), "\ncommands:\n")
|
||||||
assert.Contains(t, buffer.String(), "\n - command-1\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-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) {
|
func TestDoesNotPrintCommandIfMissing(t *testing.T) {
|
||||||
|
Reference in New Issue
Block a user