diff --git a/HISTORY.rst b/HISTORY.rst index 8ff024cb..42cb63a0 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,15 @@ Release History =============== +0.9.2 (?) +--------- + +* Replaced "dark blue" by "cyan" colour for the texts (`issue #33 `_) +* Added new setting `enable_prompts `_ + and allowed to disable all PlatformIO prompts (useful for cloud compilers) + (`issue #34 `_) + + 0.9.1 (2014-12-05) ------------------ diff --git a/docs/installation.rst b/docs/installation.rst index e0df7b68..287188da 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -25,6 +25,11 @@ application: `Command Prompt `_ (``cmd.exe``) application. +.. warning:: + If you are going to use *PlatformIO* for "*Cloud Compiling*", please + don't forget to turn off :ref:`enable_prompts ` setting. It + will allow you to avoid blocking when call ``platformio`` like subprocess. + Please *choose one of* the following: Super-Quick (Mac / Linux) diff --git a/platformio/app.py b/platformio/app.py index 3f24617a..9101796b 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -33,6 +33,15 @@ DEFAULT_SETTINGS = { "description": ("Shares commands, platforms and libraries usage" " to help us make PlatformIO better (Yes/No)"), "value": True + }, + "enable_prompts": { + "description": ( + "Can PlatformIO communicate with you via prompts: " + "propose to install platforms which aren't installed yet, " + "paginate over library search results and etc.)? ATTENTION!!! " + "If you call PlatformIO like subprocess, " + "please disable prompts to avoid blocking (Yes/No)"), + "value": True } } diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 6136780a..986d784c 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -7,6 +7,7 @@ from shutil import copyfile import click +from platformio import app from platformio.exception import ProjectInitialized from platformio.util import get_source_dir @@ -42,7 +43,8 @@ def cli(project_dir): click.echo("%s - a directory for the project specific libraries" % click.style("lib", fg="cyan")) - if click.confirm("Do you want to continue?"): + if (not app.get_setting("enable_prompts") or + click.confirm("Do you want to continue?")): for d in (src_dir, lib_dir): if not isdir(d): makedirs(d) diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index c2350bb4..67f61827 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -3,6 +3,7 @@ import click +from platformio import app from platformio.exception import (LibAlreadyInstalledError, LibInstallDependencyError) from platformio.libmanager import LibraryManager @@ -69,7 +70,8 @@ def lib_search(query, **filters): if int(result['page'])*int(result['perpage']) >= int(result['total']): break - if click.confirm("Show next libraries?"): + if (app.get_setting("enable_prompts") and + click.confirm("Show next libraries?")): result = get_api_result( "/lib/search", dict(query=query, page=str(int(result['page']) + 1)) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index f16e3f96..c45f61d6 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -3,7 +3,7 @@ import click -from platformio import exception, telemetry +from platformio import app, exception, telemetry from platformio.commands.install import cli as cmd_install from platformio.platforms.base import PlatformFactory from platformio.util import get_project_config @@ -68,7 +68,8 @@ def process_environment(ctx, name, options, targets, upload_port): telemetry.on_run_environment(options, envtargets) - if (platform not in PlatformFactory.get_platforms(installed=True) and + if (app.get_setting("enable_prompts") and + platform not in PlatformFactory.get_platforms(installed=True) and click.confirm("The platform '%s' has not been installed yet. " "Would you like to install it now?" % platform)): ctx.invoke(cmd_install, platforms=[platform]) diff --git a/platformio/commands/show.py b/platformio/commands/show.py index 746daa61..de8769bb 100644 --- a/platformio/commands/show.py +++ b/platformio/commands/show.py @@ -5,6 +5,7 @@ from datetime import datetime import click +from platformio import app from platformio.commands.install import cli as cmd_install from platformio.exception import PlatformNotInstalledYet from platformio.pkgmanager import PackageManager @@ -20,8 +21,9 @@ def cli(ctx, platform): installed=True).keys() if platform not in installed_platforms: - if click.confirm("The platform '%s' has not been installed yet. " - "Would you like to install it now?" % platform): + if (app.get_setting("enable_prompts") and + click.confirm("The platform '%s' has not been installed yet. " + "Would you like to install it now?" % platform)): ctx.invoke(cmd_install, platforms=[platform]) else: raise PlatformNotInstalledYet(platform)