This commit is contained in:
2019-09-20 19:30:12 -04:00
parent d3bb2b8bef
commit 7e017a3de0
+24 -1
View File
@@ -100,12 +100,18 @@ def echo_json(obj):
)
@click.option(
"--list",
"-l",
"_list",
default=False,
is_flag=True,
help="Lists available tasks (and their dependencies).",
)
@click.option(
"--levels",
"-l",
default=1,
nargs=1,
help="Lists available tasks (and their dependencies).",
)
@click.option(
"--help", "-h", default=False, is_flag=True, help="Show this message and exit."
)
@@ -179,6 +185,7 @@ def entrypoint(
bakefile,
arguments,
_list,
levels,
_continue,
environ_json,
debug,
@@ -283,7 +290,12 @@ def entrypoint(
if _list:
__list_json = {"tasks": {}}
task_list = []
for _task in bakefile.tasks:
if len(_task.split("/")) <= levels:
task_list.append(_task)
for _task in task_list:
depends_on = bakefile[_task].depends_on(
include_filters=False, recursive=True
)
@@ -308,6 +320,17 @@ def entrypoint(
err=False,
)
if not silent:
tasks_unechoed = len(bakefile.tasks) - len(task_list)
bake_command = str(click.style(f"bake -l {levels + 1}", fg="red"))
if tasks_unechoed:
# click.echo(err=True)
click.echo(
f"Note: {tasks_unechoed} more tasks are available. "
f"Please use $ {bake_command} to see more.",
err=True,
)
if _json:
echo_json(__list_json)