You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
797 B
Python
25 lines
797 B
Python
from textual.command import DiscoveryHit, Provider, Hits, Hit
|
|
|
|
class AboutCommand(Provider):
|
|
'''Class to represent the About command in the menu'''
|
|
|
|
async def discover(self) -> Hits:
|
|
yield DiscoveryHit(
|
|
display='About',
|
|
command=self.app.action_toggle_sidebar,
|
|
help='Link to repo etc.'
|
|
)
|
|
|
|
async def search(self, query: str) -> Hits:
|
|
'''Called when the search functionality is used'''
|
|
matcher = self.matcher(query)
|
|
command = "About"
|
|
score = matcher.match(command)
|
|
if score > 0:
|
|
yield Hit(
|
|
score,
|
|
matcher.highlight(command),
|
|
self.app.action_toggle_sidebar,
|
|
'Link to repo etc.'
|
|
)
|