Minor improvements for pio device monitor command

This commit is contained in:
Ivan Kravets
2022-06-12 12:14:28 +03:00
parent 7aaa9c028b
commit 375c396b7b
4 changed files with 23 additions and 23 deletions

View File

@ -19,7 +19,7 @@ PlatformIO Core 6
* **Device Monitor**
- Automatically reconnect if a connection fails
- Added new `pio device monitor --no-reconnect <https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#cmdoption-pio-device-monitor-reconnect-no-reconnect>`__ option to disable automatic reconnection
- Added new `pio device monitor --no-reconnect <https://docs.platformio.org/en/latest/core/userguide/device/cmd_monitor.html#cmdoption-pio-device-monitor-no-reconnect>`__ option to disable automatic reconnection
- Handle disconnects more gracefully (`issue #3939 <https://github.com/platformio/platformio-core/issues/3939>`_)
* Fixed an issue when a custom `pio test --project-config <https://docs.platformio.org/en/latest/core/userguide/cmd_test.html#cmdoption-pio-test-c>`__ was not handled properly (`issue #4299 <https://github.com/platformio/platformio-core/issues/4299>`_)

2
docs

Submodule docs updated: c86b25dd81...f0acc3040f

View File

@ -33,30 +33,30 @@ from platformio.project.options import ProjectOptions
"--baud",
type=int,
default=ProjectOptions["env.monitor_speed"].default,
help="Set baud/speed, default=%d" % ProjectOptions["env.monitor_speed"].default,
show_default=True,
help="Set baud/speed",
)
@click.option(
"--parity",
default="N",
show_default=True,
type=click.Choice(["N", "E", "O", "S", "M"]),
help="Set parity, default=N",
)
@click.option("--rtscts", is_flag=True, help="Enable RTS/CTS flow control, default=Off")
@click.option(
"--xonxoff", is_flag=True, help="Enable software flow control, default=Off"
help="Set parity",
)
@click.option("--rtscts", is_flag=True, help="Enable RTS/CTS flow control")
@click.option("--xonxoff", is_flag=True, help="Enable software flow control")
@click.option(
"--rts", default=None, type=click.IntRange(0, 1), help="Set initial RTS line state"
)
@click.option(
"--dtr", default=None, type=click.IntRange(0, 1), help="Set initial DTR line state"
)
@click.option("--echo", is_flag=True, help="Enable local echo, default=Off")
@click.option("--echo", is_flag=True, help="Enable local echo")
@click.option(
"--encoding",
default="UTF-8",
help="Set the encoding for the serial port (e.g. hexlify, "
"Latin1, UTF-8), default: UTF-8",
show_default=True,
help="Set the encoding for the serial port (e.g. hexlify, Latin1, UTF-8)",
)
@click.option(
"-f", "--filter", "filters", multiple=True, help="Add filters/text transformations"
@ -64,36 +64,35 @@ from platformio.project.options import ProjectOptions
@click.option(
"--eol",
default="CRLF",
show_default=True,
type=click.Choice(["CR", "LF", "CRLF"]),
help="End of line mode, default=CRLF",
help="End of line mode",
)
@click.option("--raw", is_flag=True, help="Do not apply any encodings/transformations")
@click.option(
"--exit-char",
type=int,
default=3,
show_default=True,
help="ASCII code of special character that is used to exit "
"the application, default=3 (Ctrl+C)",
"the application [default=3 (Ctrl+C)]",
)
@click.option(
"--menu-char",
type=int,
default=20,
help="ASCII code of special character that is used to "
"control terminal (menu), default=20 (DEC)",
"control terminal (menu) [default=20 (DEC)]",
)
@click.option(
"--quiet",
is_flag=True,
help="Diagnostics: suppress non-error messages, default=Off",
help="Diagnostics: suppress non-error messages",
)
@click.option(
"--reconnect/--no-reconnect",
default=True,
help=(
"If established connection fails, "
"silently retry on the same port, default=True"
),
"--no-reconnect",
is_flag=True,
help="Disable automatic reconnection if the established connection fails",
)
@click.option(
"-d",
@ -104,7 +103,7 @@ from platformio.project.options import ProjectOptions
@click.option(
"-e",
"--environment",
help="Load configuration from `platformio.ini` and specified environment",
help="Load configuration from `platformio.ini` and the specified environment",
)
def device_monitor_cmd(**options):
platform = None
@ -131,6 +130,7 @@ def device_monitor_cmd(**options):
"--exit-char can not be the same as --menu-char"
)
print(options)
start_terminal(options)

View File

@ -68,7 +68,7 @@ def start_terminal(options):
fg="red",
err=True,
)
if options["reconnect"]:
if not options["no_reconnect"]:
raise UserSideException(term.pio_unexpected_exception)
return
except UserSideException as exc: