Skip to content

Commit 01d38b8

Browse files
authored
Accept whole action name in the try command (#2691)
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]>
1 parent e1eef9c commit 01d38b8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tmt/trying.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,13 @@ def menu(self) -> str:
7979
return before + key + after + padding + self.description
8080

8181
@classmethod
82-
def find(cls, key: str) -> "Action":
83-
""" Return action for given keyboard shortcut """
82+
def find(cls, answer: str) -> "Action":
83+
""" Return action for given keyboard input (shortcut or whole word) """
84+
85+
answer = answer.lower()
8486

8587
for action in cls:
86-
if action.key == key:
88+
if answer in (action.key, action.action):
8789
return action
8890

8991
raise KeyError

0 commit comments

Comments
 (0)