forked from platformio/platformio-core
Produce less noisy output when “-s/—silent” options are used for run and init commands // Resolve #850
This commit is contained in:
@@ -95,7 +95,7 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose,
|
||||
results.append((envname, None))
|
||||
continue
|
||||
|
||||
if results:
|
||||
if not silent and results:
|
||||
click.echo()
|
||||
|
||||
options = {}
|
||||
@@ -108,11 +108,13 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose,
|
||||
upload_port, silent, verbose)
|
||||
results.append((envname, ep.process()))
|
||||
|
||||
if len(results) > 1:
|
||||
found_error = any([status is False for (_, status) in results])
|
||||
|
||||
if (found_error or not silent) and len(results) > 1:
|
||||
click.echo()
|
||||
print_summary(results, start_time)
|
||||
|
||||
if any([status is False for (_, status) in results]):
|
||||
if found_error:
|
||||
raise exception.ReturnErrorCode(1)
|
||||
return True
|
||||
|
||||
@@ -160,18 +162,20 @@ class EnvironmentProcessor(object):
|
||||
if "\n" in v:
|
||||
self.options[k] = self.options[k].strip().replace("\n", ", ")
|
||||
|
||||
click.echo("[%s] Processing %s (%s)" % (
|
||||
datetime.now().strftime("%c"), click.style(
|
||||
self.name, fg="cyan", bold=True),
|
||||
", ".join(["%s: %s" % (k, v) for k, v in self.options.items()])))
|
||||
click.secho("-" * terminal_width, bold=True)
|
||||
if self.silent:
|
||||
click.echo("Please wait...")
|
||||
if not self.silent:
|
||||
click.echo("[%s] Processing %s (%s)" % (
|
||||
datetime.now().strftime("%c"), click.style(
|
||||
self.name, fg="cyan", bold=True), ", ".join(
|
||||
["%s: %s" % (k, v) for k, v in self.options.items()])))
|
||||
click.secho("-" * terminal_width, bold=True)
|
||||
|
||||
self.options = self._validate_options(self.options)
|
||||
result = self._run()
|
||||
|
||||
is_error = result['returncode'] != 0
|
||||
|
||||
if self.silent and not is_error:
|
||||
return True
|
||||
|
||||
if is_error or "piotest_processor" not in self.cmd_ctx.meta:
|
||||
print_header(
|
||||
"[%s] Took %.2f seconds" % ((click.style(
|
||||
|
Reference in New Issue
Block a user