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.
This commit is contained in:
Lennart Poettering
2018-08-20 11:33:04 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent 53c442ef63
commit 37ec0fdd34
52 changed files with 854 additions and 232 deletions
+9
View File
@@ -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;
+1
View File
@@ -157,6 +157,7 @@ int vt_reset_keyboard(int fd);
int terminal_urlify(const char *url, const char *text, char **ret);
int terminal_urlify_path(const char *path, const char *text, char **ret);
int terminal_urlify_man(const char *page, const char *section, char **ret);
typedef enum CatFlags {
CAT_FLAGS_MAIN_FILE_OPTIONAL = 1 << 0,