From 01d38b80c43f522072845939beecf662acd4219a Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Wed, 18 Dec 2024 09:56:46 +0100 Subject: [PATCH] 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 --- tmt/trying.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tmt/trying.py b/tmt/trying.py index 4ba4c2d702..d1905d6c3b 100644 --- a/tmt/trying.py +++ b/tmt/trying.py @@ -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