diff --git a/circup/command_utils.py b/circup/command_utils.py index fc8e483..afbdcf0 100644 --- a/circup/command_utils.py +++ b/circup/command_utils.py @@ -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) diff --git a/circup/commands.py b/circup/commands.py index 58c6d0b..ce446bc 100644 --- a/circup/commands.py +++ b/circup/commands.py @@ -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: