refactor AboutCommand into own file
parent
2879d2abb1
commit
a885298d00
@ -0,0 +1,24 @@
|
||||
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.'
|
||||
)
|
Loading…
Reference in New Issue