MCPcopy Create free account
hub / github.com/aitjcize/cppman / find

Method find

cppman/main.py:598–614  ·  view source on GitHub ↗

Find pages in database.

(self, pattern)

Source from the content-addressed store, hash-verified

596 return pid
597
598 def find(self, pattern):
599 """Find pages in database."""
600
601 results = self._search_keyword(pattern)
602
603 pat = re.compile(r'(.*?)(%s)(.*?)( \(.*\))?$' %
604 re.escape(pattern), re.I)
605
606 if results:
607 for name, keyword, url in results:
608
609 if os.isatty(sys.stdout.fileno()):
610 keyword = pat.sub(
611 r'\1\033[1;31m\2\033[0m\3\033[1;33m\4\033[0m', keyword)
612 print("%s - %s" % (keyword, name))
613 else:
614 raise RuntimeError('%s: nothing appropriate.' % pattern)
615
616 def fuzzy_find(self, pattern, max_results, show_menu=False):
617 """Find pages in database and optionally present an interactive selection menu."""

Callers 5

_sort_crawlFunction · 0.80
_sort_searchFunction · 0.80
process_documentMethod · 0.80
_extract_keywordsMethod · 0.80
member_type_functionFunction · 0.80

Calls 1

_search_keywordMethod · 0.95

Tested by

no test coverage detected