bake silent

This commit is contained in:
2019-09-22 07:08:48 -04:00
parent deb033dd3a
commit 91b3697f2e
2 changed files with 22 additions and 21 deletions
+16 -16
View File
@@ -26,11 +26,10 @@ class Bakefile:
raise NoBakefileFound()
# Set environment variables for 'bake's that run underneath of us.
os.environ["BAKE_SKIP_DONE"] = "1"
os.environ["BAKE_SILENT"] = "1"
os.environ["PYTHONUNBUFFERED"] = "1"
os.environ["BAKEFILE_PATH"] = self.path
os.environ["BAKE_SKIP_DONE"] = "1"
os.environ["BAKE_SILENT"] = "1"
self.chunks
self._tasks = None
@@ -229,20 +228,21 @@ class Bakefile:
"""Functions (_task_name), inserted into the Bash runtime."""
source = []
for task in self.tasks:
task = self[task]
f_name = task.name.replace("/", "_")
f_name = f_name.replace("-", "_")
f_name = f"task_{f_name}"
# TODO: Recommend bake taskname instead.
# for task in self.tasks:
# task = self[task]
# f_name = task.name.replace("/", "_")
# f_name = f_name.replace("-", "_")
# f_name = f"task_{f_name}"
source.append(
# Replace / namespacing with _ namespacing, for functions.
f"{f_name}()"
+ " { \n"
+ f" bake --silent {task.name} $@;\n"
+ "}\n"
+ f"declare -x {f_name};"
)
# source.append(
# # Replace / namespacing with _ namespacing, for functions.
# f"{f_name}()"
# + " { \n"
# + f" bake --silent {task.name} $@;\n"
# + "}\n"
# + f"declare -x {f_name};"
# )
return "\n".join(source)
+6 -5
View File
@@ -24,6 +24,7 @@ SAFE_ENVIRONS = [
"BAKEFILE_PATH",
"PYTHONUNBUFFERED",
"PYTHONDONTWRITEBYTECODE",
"BAKE_SILENT",
]
@@ -142,20 +143,20 @@ def echo_json(obj):
"--continue",
"_continue",
is_flag=True,
type=click.BOOL,
# type=click.BOOL,
help="Continue, if a task fails.",
)
@click.option(
"--interactive",
"-i",
is_flag=True,
type=click.BOOL,
# type=click.BOOL,
help="Run in interactive mode.",
)
@click.option(
"--insecure",
is_flag=True,
type=click.BOOL,
# type=click.BOOL,
help="Inherit parent shell's environment variables.",
)
@click.argument("arguments", nargs=-1, type=click.STRING)
@@ -163,7 +164,7 @@ def echo_json(obj):
"--silent",
"-s",
is_flag=True,
type=click.BOOL,
# type=click.BOOL,
help="Reduce output.",
envvar="BAKE_SILENT",
)
@@ -182,7 +183,7 @@ def echo_json(obj):
"-j",
"_json",
is_flag=True,
type=click.BOOL,
# type=click.BOOL,
help="Output in JSON format (stdout).",
)
def entrypoint(