diff --git a/HISTORY.rst b/HISTORY.rst index 50efce56..d194ee84 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -19,7 +19,7 @@ PlatformIO Core 6 * **Device Monitor** - Automatically reconnect if a connection fails - - Added new `pio device monitor --no-reconnect `__ option to disable automatic reconnection + - Added new `pio device monitor --no-reconnect `__ option to disable automatic reconnection - Handle disconnects more gracefully (`issue #3939 `_) * Fixed an issue when a custom `pio test --project-config `__ was not handled properly (`issue #4299 `_) diff --git a/docs b/docs index c86b25dd..f0acc304 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit c86b25dd81f4bfec721a66415f052d2c20d9e044 +Subproject commit f0acc3040fa8132d59ef7b930052a36d4c6e0bd6 diff --git a/platformio/device/monitor/command.py b/platformio/device/monitor/command.py index ae63c1a6..0a9a518a 100644 --- a/platformio/device/monitor/command.py +++ b/platformio/device/monitor/command.py @@ -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) diff --git a/platformio/device/monitor/terminal.py b/platformio/device/monitor/terminal.py index 8da37f7a..6cb78e20 100644 --- a/platformio/device/monitor/terminal.py +++ b/platformio/device/monitor/terminal.py @@ -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: