From a59e1adee1a84a32f72b1b93a5eddaf0ae0dcdd2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Aug 2022 14:05:11 +0530 Subject: [PATCH] Also hyperlink the :ac: role in CLI help output --- kitty/cli.py | 9 +++++++++ kitty/conf/types.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/kitty/cli.py b/kitty/cli.py index e68e22d4d..e80bdd21e 100644 --- a/kitty/cli.py +++ b/kitty/cli.py @@ -178,6 +178,15 @@ def ref(x: str) -> str: return t +@role +def ac(x: str) -> str: + t, q = text_and_target(x) + url = resolve_ref(q) + if url: + return hyperlink_for_url(url, t) + return t + + OptionSpecSeq = List[Union[str, OptionDict]] diff --git a/kitty/conf/types.py b/kitty/conf/types.py index 9d98e90bc..b3fcdb49d 100644 --- a/kitty/conf/types.py +++ b/kitty/conf/types.py @@ -65,7 +65,7 @@ def resolve_ref(ref: str, website_url: Callable[[str], str] = website_url) -> st elif ref.startswith('action-group-'): href = f'{website_url("generated/actions")}#{ref}' elif ref.startswith('action-'): - frag = ref.partition('-')[-1] + frag = ref.partition('-')[-1].replace('_', '-') href = f'{website_url("generated/actions")}#{frag}' return href