New "--no-ansi" flag for PIO Core

This commit is contained in:
Ivan Kravets
2019-09-23 20:51:02 +03:00
parent cd8dc24454
commit 61b6eea52c
3 changed files with 25 additions and 18 deletions

View File

@ -10,6 +10,7 @@ PlatformIO Core 4.0
~~~~~~~~~~~~~~~~~~
* Extend project environment configuration in "platformio.ini" with other sections using a new `extends <http://docs.platformio.org/page/projectconf/section_env_advanced.html#extends>`__ option (`issue #2953 <https://github.com/platformio/platformio-core/issues/2953>`_)
* New ``--no-ansi`` flag for `PIO Core <http://docs.platformio.org/page/userguide/index.html>`__ to disable ANSI control characters
* Generate ``.ccls`` LSP file for `Emacs <https://docs.platformio.org/page/ide/emacs.html>`__ cross references, hierarchies, completion and semantic highlighting
* Fixed an issue with project generator for `CLion IDE <http://docs.platformio.org/page/ide/clion.html>`__ when 2 environments were used (`issue #2824 <https://github.com/platformio/platformio-core/issues/2824>`_)
* Fixed default PIO Unified Debugger configuration for `J-Link probe <http://docs.platformio.org/page/plus/debug-tools/jlink.html>`__

2
docs

Submodule docs updated: 10d5ce9d8e...52c3dc5a88

View File

@ -26,19 +26,35 @@ from platformio.compat import CYGWIN
@click.command(cls=PlatformioCLI,
context_settings=dict(help_option_names=["-h", "--help"]))
@click.version_option(__version__, prog_name="PlatformIO")
@click.option("--force",
"-f",
@click.option("--force", "-f", is_flag=True, help="DEPRECATE")
@click.option("--caller", "-c", help="Caller ID (service)")
@click.option("--no-ansi",
is_flag=True,
help="Force to accept any confirmation prompts.")
@click.option("--caller", "-c", help="Caller ID (service).")
help="Do not print ANSI control characters")
@click.pass_context
def cli(ctx, force, caller):
def cli(ctx, force, caller, no_ansi):
try:
if (no_ansi or str(
os.getenv(
"PLATFORMIO_NO_ANSI",
os.getenv("PLATFORMIO_DISABLE_COLOR"))).lower() == "true"):
# pylint: disable=protected-access
click._compat.isatty = lambda stream: False
elif str(
os.getenv(
"PLATFORMIO_FORCE_ANSI",
os.getenv("PLATFORMIO_FORCE_COLOR"))).lower() == "true":
# pylint: disable=protected-access
click._compat.isatty = lambda stream: True
except: # pylint: disable=bare-except
pass
maintenance.on_platformio_start(ctx, force, caller)
@cli.resultcallback()
@click.pass_context
def process_result(ctx, result, force, caller): # pylint: disable=W0613
def process_result(ctx, result, *_, **__):
maintenance.on_platformio_end(ctx, result)
@ -55,16 +71,6 @@ def configure():
except (AttributeError, ImportError):
pass
try:
if str(os.getenv("PLATFORMIO_DISABLE_COLOR", "")).lower() == "true":
# pylint: disable=protected-access
click._compat.isatty = lambda stream: False
elif str(os.getenv("PLATFORMIO_FORCE_COLOR", "")).lower() == "true":
# pylint: disable=protected-access
click._compat.isatty = lambda stream: True
except: # pylint: disable=bare-except
pass
# Handle IOError issue with VSCode's Terminal (Windows)
click_echo_origin = [click.echo, click.secho]
@ -87,7 +93,7 @@ def main(argv=None):
sys.argv = argv
try:
configure()
cli(None, None, None)
cli() # pylint: disable=no-value-for-parameter
except SystemExit:
pass
except Exception as e: # pylint: disable=broad-except