From 6b9cbde8eb4302a72af34047f85b7f19810725c5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 30 Nov 2014 17:00:30 +0200 Subject: [PATCH] Improve telemetry for run env command --- platformio/commands/run.py | 4 ++-- platformio/telemetry.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index adfd3be3..400a6f3a 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -39,8 +39,6 @@ def cli(environment, target, upload_port): echo("Processing %s environment:" % style(envname, fg="cyan")) - telemetry.on_run_environment(envname, config.items(section)) - variables = ["PIOENV=" + envname] if upload_port: variables.append("UPLOAD_PORT=%s" % upload_port) @@ -59,6 +57,8 @@ def cli(environment, target, upload_port): if not config.has_option(section, "platform"): raise UndefinedEnvPlatform(envname) + telemetry.on_run_environment(config.items(section), envtargets) + p = PlatformFactory().newPlatform(config.get(section, "platform")) result = p.run(variables, envtargets) secho(result['out'], fg="green") diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 78a6b328..d6e95e66 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -134,10 +134,10 @@ def on_command(ctx): # pylint: disable=W0613 resend_backuped_reports() -def on_run_environment(name, options): # pylint: disable=W0613 - # on_event("RunEnv", "Name", name) - for opt, value in options: - on_event("RunEnv", opt.title(), value) +def on_run_environment(options, targets): + opts = ["%s=%s" % (opt, value) for opt, value in sorted(options)] + targets = [t.title() for t in targets or ["run"]] + on_event("Env", " ".join(targets), " ".join(opts)) def on_event(category, action, label=None, value=None, screen_name=None):