From 9539a9d3dbec4cc628584d7c279ffe110bf67ef7 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 12 Jun 2018 15:43:59 +0200 Subject: [PATCH] terminal-util: make file names in --cat-config output clickable links --- src/basic/terminal-util.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index 8b1d2e5dc57..234a1722df7 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -1376,16 +1376,21 @@ int terminal_urlify_path(const char *path, const char *text, char **ret) { static int cat_file(const char *filename, bool newline) { _cleanup_fclose_ FILE *f = NULL; + _cleanup_free_ char *urlified = NULL; int r; f = fopen(filename, "re"); if (!f) return -errno; + r = terminal_urlify_path(filename, NULL, &urlified); + if (r < 0) + return r; + printf("%s%s# %s%s\n", newline ? "\n" : "", ansi_highlight_blue(), - filename, + urlified, ansi_normal()); fflush(stdout);