mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 10:37:13 +02:00
Rename `platformio serialports
command to
platformio device
`
This commit is contained in:
@ -67,6 +67,7 @@ PlatformIO 3.0
|
|||||||
|
|
||||||
* Removed ``enable_prompts`` setting. Now, all PlatformIO CLI is non-blocking!
|
* Removed ``enable_prompts`` setting. Now, all PlatformIO CLI is non-blocking!
|
||||||
* Switched to SSL PlatformIO API
|
* Switched to SSL PlatformIO API
|
||||||
|
* Renamed ``platformio serialports`` command to ``platformio device``
|
||||||
* Build System: Attach custom Before/Pre and After/Post actions for targets
|
* Build System: Attach custom Before/Pre and After/Post actions for targets
|
||||||
(`issue #542 <https://github.com/platformio/platformio/issues/542>`_)
|
(`issue #542 <https://github.com/platformio/platformio/issues/542>`_)
|
||||||
* Print human-readable information when processing environments without
|
* Print human-readable information when processing environments without
|
||||||
|
@ -55,7 +55,7 @@ Embedded Development. *Easier Than Ever.*
|
|||||||
* :ref:`IDE Integration <ide>` with *Arduino, Atom, CLion, Eclipse, Emacs,
|
* :ref:`IDE Integration <ide>` with *Arduino, Atom, CLion, Eclipse, Emacs,
|
||||||
Energia, Qt Creator, Sublime Text, Vim, Visual Studio*
|
Energia, Qt Creator, Sublime Text, Vim, Visual Studio*
|
||||||
* Cloud compiling and :ref:`ci` with *AppVeyor, Circle CI, Drone, Shippable, Travis CI*
|
* Cloud compiling and :ref:`ci` with *AppVeyor, Circle CI, Drone, Shippable, Travis CI*
|
||||||
* Built-in :ref:`Serial Port Monitor <cmd_serialports_monitor>` and
|
* Built-in :ref:`Serial Port Monitor <cmd_device_monitor>` and
|
||||||
configurable build :ref:`-flags/-options <projectconf_build_flags>`
|
configurable build :ref:`-flags/-options <projectconf_build_flags>`
|
||||||
* Pre-built toolchains, :ref:`frameworks` for the :ref:`platforms`
|
* Pre-built toolchains, :ref:`frameworks` for the :ref:`platforms`
|
||||||
|
|
||||||
|
@ -647,7 +647,7 @@ This option is used by "uploader" tool when sending firmware to board via
|
|||||||
If ``upload_port`` isn't specified, then *PlatformIO* will try to detect it
|
If ``upload_port`` isn't specified, then *PlatformIO* will try to detect it
|
||||||
automatically.
|
automatically.
|
||||||
|
|
||||||
To print all available serial ports use :ref:`cmd_serialports` command.
|
To print all available serial ports use :ref:`cmd_device` command.
|
||||||
|
|
||||||
This option can be set by global environment variable
|
This option can be set by global environment variable
|
||||||
:envvar:`PLATFORMIO_UPLOAD_PORT`.
|
:envvar:`PLATFORMIO_UPLOAD_PORT`.
|
||||||
|
@ -9,14 +9,14 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|
||||||
.. _cmd_serialports:
|
.. _cmd_device:
|
||||||
|
|
||||||
platformio serialports
|
platformio device
|
||||||
======================
|
======================
|
||||||
|
|
||||||
.. contents::
|
.. contents::
|
||||||
|
|
||||||
platformio serialports list
|
platformio device list
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
@ -24,7 +24,7 @@ Usage
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
platformio serialports list [OPTIONS]
|
platformio device list [OPTIONS]
|
||||||
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
@ -35,7 +35,7 @@ List available `Serial Ports <http://en.wikipedia.org/wiki/Serial_port>`_
|
|||||||
Options
|
Options
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. program:: platformio serialports list
|
.. program:: platformio device list
|
||||||
|
|
||||||
.. option::
|
.. option::
|
||||||
--json-output
|
--json-output
|
||||||
@ -50,7 +50,7 @@ Examples
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ platformio serialports list
|
$ platformio device list
|
||||||
/dev/cu.SLAB_USBtoUART
|
/dev/cu.SLAB_USBtoUART
|
||||||
----------
|
----------
|
||||||
Hardware ID: USB VID:PID=10c4:ea60 SNR=0001
|
Hardware ID: USB VID:PID=10c4:ea60 SNR=0001
|
||||||
@ -66,7 +66,7 @@ Examples
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ platformio serialports list
|
$ platformio device list
|
||||||
COM4
|
COM4
|
||||||
----------
|
----------
|
||||||
Hardware ID: USB VID:PID=0451:F432
|
Hardware ID: USB VID:PID=0451:F432
|
||||||
@ -78,9 +78,9 @@ Examples
|
|||||||
Description: Silicon Labs CP210x USB to UART Bridge (COM3)
|
Description: Silicon Labs CP210x USB to UART Bridge (COM3)
|
||||||
|
|
||||||
|
|
||||||
.. _cmd_serialports_monitor:
|
.. _cmd_device_monitor:
|
||||||
|
|
||||||
platformio serialports monitor
|
platformio device monitor
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
@ -88,7 +88,7 @@ Usage
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
platformio serialports monitor [OPTIONS]
|
platformio device monitor [OPTIONS]
|
||||||
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
@ -112,7 +112,7 @@ To control *monitor* please use these "hot keys":
|
|||||||
Options
|
Options
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
|
||||||
.. program:: platformio serialports monitor
|
.. program:: platformio device monitor
|
||||||
|
|
||||||
.. option::
|
.. option::
|
||||||
-p, --port
|
-p, --port
|
||||||
@ -194,7 +194,7 @@ ASCII code of special character that is used to exit the application,
|
|||||||
default ``29`` (DEC).
|
default ``29`` (DEC).
|
||||||
|
|
||||||
For example, to use ``Ctrl+Q`` run
|
For example, to use ``Ctrl+Q`` run
|
||||||
``platformio serialports monitor --exit-char 17``.
|
``platformio device monitor --exit-char 17``.
|
||||||
|
|
||||||
.. option::
|
.. option::
|
||||||
--menu-char
|
--menu-char
|
||||||
@ -238,8 +238,8 @@ multiple times:
|
|||||||
3. hex dump everything
|
3. hex dump everything
|
||||||
|
|
||||||
**REMOVED**: Is not available in Miniterm/PySerial 3.0.
|
**REMOVED**: Is not available in Miniterm/PySerial 3.0.
|
||||||
See :option:`platformio serialports monitor --encoding` and
|
See :option:`platformio device monitor --encoding` and
|
||||||
:option:`platformio serialports monitor --filter` options.
|
:option:`platformio device monitor --filter` options.
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
@ -248,8 +248,8 @@ Examples
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ platformio serialports monitor --help
|
$ platformio device monitor --help
|
||||||
Usage: platformio serialports monitor [OPTIONS]
|
Usage: platformio device monitor [OPTIONS]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-p, --port TEXT Port, a number or a device name
|
-p, --port TEXT Port, a number or a device name
|
||||||
@ -276,7 +276,7 @@ Examples
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ platformio serialports monitor
|
$ platformio device monitor
|
||||||
|
|
||||||
--- Available ports:
|
--- Available ports:
|
||||||
--- /dev/cu.Bluetooth-Incoming-Port n/a
|
--- /dev/cu.Bluetooth-Incoming-Port n/a
|
@ -64,7 +64,7 @@ Pre-built targets:
|
|||||||
--upload-port
|
--upload-port
|
||||||
|
|
||||||
Upload port of embedded board. To print all available ports use
|
Upload port of embedded board. To print all available ports use
|
||||||
:ref:`cmd_serialports` command.
|
:ref:`cmd_device` command.
|
||||||
|
|
||||||
If upload port is not specified, PlatformIO will try to detect it automatically.
|
If upload port is not specified, PlatformIO will try to detect it automatically.
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ For example, ``platformio test --ignore "mytest*" -i "test[13]"``
|
|||||||
--upload-port
|
--upload-port
|
||||||
|
|
||||||
Upload port of embedded board. To print all available ports use
|
Upload port of embedded board. To print all available ports use
|
||||||
:ref:`cmd_serialports` command.
|
:ref:`cmd_device` command.
|
||||||
|
|
||||||
If upload port is not specified, PlatformIO will try to detect it automatically.
|
If upload port is not specified, PlatformIO will try to detect it automatically.
|
||||||
|
|
||||||
|
@ -60,10 +60,10 @@ Commands
|
|||||||
|
|
||||||
cmd_boards
|
cmd_boards
|
||||||
cmd_ci
|
cmd_ci
|
||||||
|
cmd_device
|
||||||
cmd_init
|
cmd_init
|
||||||
platformio platform <platforms/index>
|
platformio platform <platforms/index>
|
||||||
cmd_run
|
cmd_run
|
||||||
cmd_serialports
|
|
||||||
cmd_settings
|
cmd_settings
|
||||||
cmd_test
|
cmd_test
|
||||||
cmd_update
|
cmd_update
|
||||||
|
@ -52,8 +52,11 @@ class PlatformioCLI(click.MultiCommand): # pylint: disable=R0904
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _handle_obsolate_command(name):
|
def _handle_obsolate_command(name):
|
||||||
if name == "platforms":
|
if name == "platforms":
|
||||||
from platformio.commands import platform
|
from platformio.commands.platform import cli
|
||||||
return platform.cli
|
return cli
|
||||||
|
elif name == "serialports":
|
||||||
|
from platformio.commands.device import cli
|
||||||
|
return cli
|
||||||
raise AttributeError()
|
raise AttributeError()
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,14 +24,14 @@ from platformio.exception import MinitermException
|
|||||||
from platformio.util import get_serialports
|
from platformio.util import get_serialports
|
||||||
|
|
||||||
|
|
||||||
@click.group(short_help="List or Monitor Serial ports")
|
@click.group(short_help="Monitor device or list existing")
|
||||||
def cli():
|
def cli():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@cli.command("list", short_help="List Serial ports")
|
@cli.command("list", short_help="List devices")
|
||||||
@click.option("--json-output", is_flag=True)
|
@click.option("--json-output", is_flag=True)
|
||||||
def serialports_list(json_output):
|
def device_list(json_output):
|
||||||
|
|
||||||
if json_output:
|
if json_output:
|
||||||
click.echo(json.dumps(get_serialports()))
|
click.echo(json.dumps(get_serialports()))
|
||||||
@ -47,7 +47,7 @@ def serialports_list(json_output):
|
|||||||
|
|
||||||
if int(PYSERIAL_VERSION[0]) == 3:
|
if int(PYSERIAL_VERSION[0]) == 3:
|
||||||
|
|
||||||
@cli.command("monitor", short_help="Monitor Serial port")
|
@cli.command("monitor", short_help="Monitor device (Serial)")
|
||||||
@click.option("--port", "-p", help="Port, a number or a device name")
|
@click.option("--port", "-p", help="Port, a number or a device name")
|
||||||
@click.option(
|
@click.option(
|
||||||
"--baud",
|
"--baud",
|
||||||
@ -112,7 +112,7 @@ if int(PYSERIAL_VERSION[0]) == 3:
|
|||||||
"--quiet",
|
"--quiet",
|
||||||
is_flag=True,
|
is_flag=True,
|
||||||
help="Diagnostics: suppress non-error messages, default=Off")
|
help="Diagnostics: suppress non-error messages, default=Off")
|
||||||
def serialports_monitor(**kwargs):
|
def device_monitor(**kwargs):
|
||||||
if not kwargs['port']:
|
if not kwargs['port']:
|
||||||
for item in get_serialports():
|
for item in get_serialports():
|
||||||
if "VID:PID" in item['hwid']:
|
if "VID:PID" in item['hwid']:
|
||||||
@ -143,7 +143,7 @@ if int(PYSERIAL_VERSION[0]) == 3:
|
|||||||
raise MinitermException(e)
|
raise MinitermException(e)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
@cli.command("monitor", short_help="Monitor Serial port")
|
@cli.command("monitor", short_help="Monitor device (Serial)")
|
||||||
@click.option("--port", "-p", help="Port, a number or a device name")
|
@click.option("--port", "-p", help="Port, a number or a device name")
|
||||||
@click.option(
|
@click.option(
|
||||||
"--baud",
|
"--baud",
|
||||||
@ -210,7 +210,7 @@ else:
|
|||||||
"--quiet",
|
"--quiet",
|
||||||
is_flag=True,
|
is_flag=True,
|
||||||
help="Diagnostics: suppress non-error messages, default=Off")
|
help="Diagnostics: suppress non-error messages, default=Off")
|
||||||
def serialports_monitor(**kwargs):
|
def device_monitor(**kwargs):
|
||||||
sys.argv = app.get_session_var("command_ctx").args[1:]
|
sys.argv = app.get_session_var("command_ctx").args[1:]
|
||||||
|
|
||||||
if not kwargs['port']:
|
if not kwargs['port']:
|
@ -42,7 +42,8 @@ def validate_boards(ctx, param, value): # pylint: disable=W0613
|
|||||||
", ".join(unknown_boards))
|
", ".join(unknown_boards))
|
||||||
|
|
||||||
|
|
||||||
@click.command("init", short_help="Initialize new PlatformIO based project")
|
@click.command(
|
||||||
|
"init", short_help="Initialize PlatformIO project or update existing")
|
||||||
@click.option(
|
@click.option(
|
||||||
"--project-dir",
|
"--project-dir",
|
||||||
"-d",
|
"-d",
|
||||||
|
@ -27,6 +27,7 @@ from platformio.downloader import FileDownloader
|
|||||||
from platformio.unpacker import FileUnpacker
|
from platformio.unpacker import FileUnpacker
|
||||||
from platformio.vcsclient import VCSClientFactory
|
from platformio.vcsclient import VCSClientFactory
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
# pylint: disable=too-many-arguments
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,8 +15,11 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
import requests
|
||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
|
|
||||||
|
requests.packages.urllib3.disable_warnings()
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def platformio_setup(request):
|
def platformio_setup(request):
|
||||||
@ -40,10 +43,12 @@ def clirunner():
|
|||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def validate_cliresult():
|
def validate_cliresult():
|
||||||
|
|
||||||
def decorator(result):
|
def decorator(result):
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert not result.exception
|
assert not result.exception
|
||||||
assert "error" not in result.output.lower()
|
assert "error" not in result.output.lower()
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user