Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions circup/command_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,14 @@ def completion_for_example(ctx, param, incomplete):

# pylint: disable=unused-argument, consider-iterating-dictionary
available_examples = get_bundle_examples(get_bundles_list(), avoid_download=True)

matching_examples = [
example_path
for example_path in available_examples.keys()
if example_path.startswith(incomplete)
]
matching_examples = []
for term in incomplete:
_examples = [
example_path
for example_path in available_examples.keys()
if term in example_path
]
matching_examples.extend(_examples)

return sorted(matching_examples)

Expand Down
17 changes: 15 additions & 2 deletions circup/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,24 @@ def install(
)
@click.pass_context
def example(ctx, examples, op_list, rename, overwrite):
"""
"""\b
Copy named example(s) from a bundle onto the device. Multiple examples
can be installed at once by providing more than one example name, each
separated by a space.
separated by a space. Example names are in the form of:
[short_library_name]/[example_file_name_without_py_extension]
ex: circup example bmp5xx/bmp5xx_simpletest
\b
For a list of all available library short names run:
circup example --list
\b
To search for examples run:
circup example [searchterm] --list
ex: circup example mlx --list
"""
examples = list(examples)
for i, cur_example in enumerate(examples):
if cur_example.startswith("adafruit_"):
examples[i] = cur_example.replace("adafruit_", "")

if op_list:
if examples:
Expand Down