forked from platformio/platformio-core
Allow for search args to be empty
This commit is contained in:
@ -11,7 +11,7 @@ Usage
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# Print all available development platforms
|
# Print all available development platforms
|
||||||
platformio search all
|
platformio search
|
||||||
|
|
||||||
# Filter platforms by "Query"
|
# Filter platforms by "Query"
|
||||||
platformio search QUERY
|
platformio search QUERY
|
||||||
|
@ -90,7 +90,7 @@ Examples
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ platformio lib search ""
|
$ platformio lib search
|
||||||
# Found N libraries:
|
# Found N libraries:
|
||||||
#
|
#
|
||||||
# [ ID ] Name Compatibility "Authors": Description
|
# [ ID ] Name Compatibility "Authors": Description
|
||||||
@ -112,7 +112,7 @@ Examples
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ platformio lib search "1-wire"
|
$ platformio lib search "1-wire"
|
||||||
# Found N libraries:
|
# Found N libraries:
|
||||||
#
|
#
|
||||||
# [ ID ] Name Compatibility "Authors": Description
|
# [ ID ] Name Compatibility "Authors": Description
|
||||||
@ -136,11 +136,10 @@ Examples
|
|||||||
# ...
|
# ...
|
||||||
|
|
||||||
4. Search for `libraries by "web" and "http" keywords <http://platformio.ikravets.com/#!/lib/search?query=keyword%253A%2522web%2522%2520keyword%253A%2522http%2522&page=1>`_.
|
4. Search for `libraries by "web" and "http" keywords <http://platformio.ikravets.com/#!/lib/search?query=keyword%253A%2522web%2522%2520keyword%253A%2522http%2522&page=1>`_.
|
||||||
The ``""`` here is for "empty" query argument
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ platformio lib search "" --keyword="web" --keyword="http"
|
$ platformio lib search --keyword="web" --keyword="http"
|
||||||
# Found N libraries:
|
# Found N libraries:
|
||||||
#
|
#
|
||||||
# [ ID ] Name Compatibility "Authors": Description
|
# [ ID ] Name Compatibility "Authors": Description
|
||||||
@ -153,7 +152,7 @@ Examples
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ platformio lib search "" --author="Adafruit Industries"
|
$ platformio lib search --author="Adafruit Industries"
|
||||||
# Found N libraries:
|
# Found N libraries:
|
||||||
#
|
#
|
||||||
# [ ID ] Name Compatibility "Authors": Description
|
# [ ID ] Name Compatibility "Authors": Description
|
||||||
|
@ -46,8 +46,11 @@ def cli():
|
|||||||
@click.option("-k", "--keyword", multiple=True)
|
@click.option("-k", "--keyword", multiple=True)
|
||||||
@click.option("-f", "--framework", multiple=True)
|
@click.option("-f", "--framework", multiple=True)
|
||||||
@click.option("-p", "--platform", multiple=True)
|
@click.option("-p", "--platform", multiple=True)
|
||||||
@click.argument("query")
|
@click.argument("query", required=False)
|
||||||
def lib_search(query, **filters):
|
def lib_search(query, **filters):
|
||||||
|
if not query:
|
||||||
|
query = ""
|
||||||
|
|
||||||
for key, values in filters.iteritems():
|
for key, values in filters.iteritems():
|
||||||
for value in values:
|
for value in values:
|
||||||
query += ' %s:"%s"' % (key, value)
|
query += ' %s:"%s"' % (key, value)
|
||||||
|
@ -7,7 +7,7 @@ from platformio.platforms.base import PlatformFactory
|
|||||||
|
|
||||||
|
|
||||||
@command("search", short_help="Search for development platforms")
|
@command("search", short_help="Search for development platforms")
|
||||||
@argument("query")
|
@argument("query", required=False)
|
||||||
def cli(query):
|
def cli(query):
|
||||||
for platform in PlatformFactory.get_platforms().keys():
|
for platform in PlatformFactory.get_platforms().keys():
|
||||||
p = PlatformFactory().newPlatform(platform)
|
p = PlatformFactory().newPlatform(platform)
|
||||||
|
Reference in New Issue
Block a user