def project_data(project_dir, environment, json_output): if not is_platformio_project(project_dir): raise NotPlatformIOProjectError(project_dir) with fs.cd(project_dir): config = ProjectConfig.get_instance() config.validate(environment) environment = list(environment or config.envs()) if json_output: return click.echo( json.dumps(load_project_ide_data(project_dir, environment))) for envname in environment: click.echo("Environment: " + click.style(envname, fg="cyan", bold=True)) click.echo("=" * (13 + len(envname))) click.echo( tabulate( [(click.style(name, bold=True), "=", json.dumps(value, indent=2)) for name, value in load_project_ide_data( project_dir, envname).items()], tablefmt="plain", )) click.echo() return None
def project_config(project_dir, json_output): if not is_platformio_project(project_dir): raise NotPlatformIOProjectError(project_dir) with fs.cd(project_dir): config = ProjectConfig.get_instance() if json_output: return click.echo(config.to_json()) click.echo("Computed project configuration for %s" % click.style(project_dir, fg="cyan")) for section, options in config.as_tuple(): click.secho(section, fg="cyan") click.echo("-" * len(section)) click.echo( tabulate( [(name, "=", "\n".join(value) if isinstance(value, list) else value) for name, value in options], tablefmt="plain", )) click.echo() return None