forked from platformio/platformio-core
Add "--json-output" option to "platformio boards" command // Resolve issue #42
This commit is contained in:
@ -1,6 +1,14 @@
|
||||
Release History
|
||||
===============
|
||||
|
||||
0.11.0 (2015-01-?)
|
||||
------------------
|
||||
|
||||
* Added ``--json-output`` option to
|
||||
`platformio boards <http://docs.platformio.org/en/latest/userguide/cmd_boards.html>`__
|
||||
command which allows to return the output in `JSON <http://en.wikipedia.org/wiki/JSON>`_ format
|
||||
(`issue #42 <https://github.com/ivankravets/platformio/issues/42>`_)
|
||||
|
||||
0.10.2 (2015-01-06)
|
||||
-------------------
|
||||
|
||||
|
@ -10,7 +10,19 @@ from platformio.util import get_boards
|
||||
|
||||
@click.command("list", short_help="Pre-configured Embedded Boards")
|
||||
@click.argument("query", required=False)
|
||||
def cli(query):
|
||||
@click.option("--json-output", is_flag=True)
|
||||
def cli(query, json_output):
|
||||
|
||||
if json_output:
|
||||
result = {}
|
||||
for type_, data in get_boards().items():
|
||||
if query:
|
||||
search_data = "%s %s" % (type_, json.dumps(data).lower())
|
||||
if query.lower() not in search_data.lower():
|
||||
continue
|
||||
result[type_] = data
|
||||
click.echo(json.dumps(result))
|
||||
return
|
||||
|
||||
BOARDLIST_TPL = ("{type:<30} {mcu:<13} {frequency:<8} "
|
||||
" {flash:<7} {ram:<6} {name}")
|
||||
|
Reference in New Issue
Block a user