Skip to content

Commit

Permalink
Accept whole action name in the try command (#2691)
Browse files Browse the repository at this point in the history
When I was trying out the `try` command I hit the similar issue as
described in #2564, as not being able to see the highlighted letter,
I typed out the whole action name which got denied.

Adding support for using whole action name in addition to the shortcut
as it is relatively common e.g., interactive git rebase.

Related to #2564

Signed-off-by: Matej Focko <[email protected]>
  • Loading branch information
mfocko authored Dec 18, 2024
1 parent e1eef9c commit 01d38b8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tmt/trying.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ def menu(self) -> str:
return before + key + after + padding + self.description

@classmethod
def find(cls, key: str) -> "Action":
""" Return action for given keyboard shortcut """
def find(cls, answer: str) -> "Action":
""" Return action for given keyboard input (shortcut or whole word) """

answer = answer.lower()

for action in cls:
if action.key == key:
if answer in (action.key, action.action):
return action

raise KeyError
Expand Down

0 comments on commit 01d38b8

Please sign in to comment.