summaryrefslogtreecommitdiff
path: root/src/basic/terminal-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-08-09 10:32:31 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-08-20 11:33:04 +0200
commit37ec0fdd3443a77a5120cf55002fedcb5b1dd069 (patch)
tree75c684fd19b60094f5a89220c728f5e12e4c34b8 /src/basic/terminal-util.c
parent53c442ef634ecc0e29de046a2c39114013004a57 (diff)
downloadsystemd-37ec0fdd3443a77a5120cf55002fedcb5b1dd069.tar.gz
tree-wide: add clickable man page link to all --help texts
This is a bit like the info link in most of GNU's --help texts, but we don't do info but man pages, and we make them properly clickable on terminal supporting that, because awesome. I think it's generally advisable to link up our (brief) --help texts and our (more comprehensive) man pages a bit, so this should be an easy and straight-forward way to do it.
Diffstat (limited to 'src/basic/terminal-util.c')
-rw-r--r--src/basic/terminal-util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
index f4af0e6522..a667154270 100644
--- a/src/basic/terminal-util.c
+++ b/src/basic/terminal-util.c
@@ -1369,6 +1369,15 @@ int terminal_urlify_path(const char *path, const char *text, char **ret) {
return terminal_urlify(url, text, ret);
}
+int terminal_urlify_man(const char *page, const char *section, char **ret) {
+ const char *url, *text;
+
+ url = strjoina("man:", page, "(", section, ")");
+ text = strjoina(page, "(", section, ") man page");
+
+ return terminal_urlify(url, text, ret);
+}
+
static int cat_file(const char *filename, bool newline) {
_cleanup_fclose_ FILE *f = NULL;
_cleanup_free_ char *urlified = NULL;