feat (help): allow cli option to list tasks with no desc

added an add'l cli option that lists all tasks, with or without description.
orig. behavior: task -l lists tasks with desc field
new behaviour: task -la or task -a will list all tasks. if task has desc, it will be included.

BREAKING CHANGES: none, that I know of.
NOTES/Concerns:
- This is wip.
- Haven't checked how it interacts with bash completion.
- The new Executor.TaskNames func does not use e.CompiledTask(taskfile.Call{Task: task.Task})
This commit is contained in:
Kevin Ard
2020-11-13 15:27:03 -05:00
parent b136166fc9
commit 9bed7f7a9b
3 changed files with 28 additions and 6 deletions

View File

@@ -57,6 +57,7 @@ func main() {
helpFlag bool
init bool
list bool
listAll bool
status bool
force bool
watch bool
@@ -75,6 +76,7 @@ func main() {
pflag.BoolVarP(&helpFlag, "help", "h", false, "shows Task usage")
pflag.BoolVarP(&init, "init", "i", false, "creates a new Taskfile.yml in the current folder")
pflag.BoolVarP(&list, "list", "l", false, "lists tasks with description of current Taskfile")
pflag.BoolVarP(&listAll, "list-all", "a", false, "list tasks with or without a description")
pflag.BoolVar(&status, "status", false, "exits with non-zero exit code if any of the given tasks is not up-to-date")
pflag.BoolVarP(&force, "force", "f", false, "forces execution even when the task is up-to-date")
pflag.BoolVarP(&watch, "watch", "w", false, "enables watch of the given task")
@@ -148,8 +150,8 @@ func main() {
return
}
if list {
e.PrintTasksHelp()
if list || listAll {
e.PrintTasksHelp(listAll)
return
}