Skip to content

Commit

Permalink
Improve telemetry for run env command
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Nov 30, 2014
1 parent 22297b9 commit 6b9cbde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions platformio/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions platformio/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 6b9cbde

Please sign in to comment.