Fix Reckless search command not finding partial matches
The Reckless search command was only returning a result if you searched a perfect match, which is not too helpful. This updates the command so that partial search matches return a result. Before: reckless search bolt Search exhausted all sources reckless search bol Search exhausted all sources reckless search bolt12-pris Search exhausted all sources After: reckless search bolt Plugins matching 'bolt': bolt12-prism (https://github.com/lightningd/plugins) reckless search bol Plugins matching 'bol': bolt12-prism (https://github.com/lightningd/plugins) reckless search bolt12-pris Plugins matching 'bolt12-pris': bolt12-prism (https://github.com/lightningd/plugins) Changelog-Fixed: reckless search now returns partial matches instead of requiring exact plugin names.
This commit is contained in:
committed by
Alex Myers
parent
ff34e485bc
commit
0173610527
@@ -224,6 +224,32 @@ def test_search(node_factory):
|
||||
assert r.search_stdout('found testplugpass in source: https://github.com/lightningd/plugins')
|
||||
|
||||
|
||||
def test_search_partial_match(node_factory):
|
||||
"""test that partial/substring search returns multiple matches"""
|
||||
n = get_reckless_node(node_factory)
|
||||
|
||||
# Search for partial name "testplug" - should find all test plugins
|
||||
r = reckless([f"--network={NETWORK}", "search", "testplug"], dir=n.lightning_dir)
|
||||
# Should show the "Plugins matching" header
|
||||
assert r.search_stdout("Plugins matching 'testplug':")
|
||||
# Should list multiple plugins (all start with "testplug")
|
||||
assert r.search_stdout('testplugpass')
|
||||
assert r.search_stdout('testplugfail')
|
||||
assert r.search_stdout('testplugpyproj')
|
||||
assert r.search_stdout('testpluguv')
|
||||
|
||||
# Search for "pass" - should find testplugpass
|
||||
r = reckless([f"--network={NETWORK}", "search", "pass"], dir=n.lightning_dir)
|
||||
assert r.search_stdout("Plugins matching 'pass':")
|
||||
assert r.search_stdout('testplugpass')
|
||||
# Should not find plugins without "pass" in name
|
||||
assert not r.search_stdout('testplugfail')
|
||||
|
||||
# Search for something that doesn't exist
|
||||
r = reckless([f"--network={NETWORK}", "search", "nonexistent"], dir=n.lightning_dir)
|
||||
assert r.search_stdout("Search exhausted all sources")
|
||||
|
||||
|
||||
def test_install(node_factory):
|
||||
"""test search, git clone, and installation to folder."""
|
||||
n = get_reckless_node(node_factory)
|
||||
|
||||
Reference in New Issue
Block a user