]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: format documentation links in status output as clickable links
authorLennart Poettering <lennart@poettering.net>
Thu, 19 Apr 2018 15:53:58 +0000 (17:53 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 19 Apr 2018 16:04:26 +0000 (18:04 +0200)
src/systemctl/systemctl.c

index 388eee47a1dfb637f87a5758853501bba0ce4e64..b5352068bdb9faa58b7483c16197c82f15079d11 100644 (file)
@@ -4143,8 +4143,17 @@ static void print_status_info(
         if (i->what)
                 printf("     What: %s\n", i->what);
 
-        STRV_FOREACH(t, i->documentation)
-                printf(" %*s %s\n", 9, t == i->documentation ? "Docs:" : "", *t);
+        STRV_FOREACH(t, i->documentation) {
+                _cleanup_free_ char *formatted = NULL;
+                const char *q;
+
+                if (terminal_urlify(*t, NULL, &formatted) >= 0)
+                        q = formatted;
+                else
+                        q = *t;
+
+                printf(" %*s %s\n", 9, t == i->documentation ? "Docs:" : "", q);
+        }
 
         STRV_FOREACH_PAIR(t, t2, i->listen)
                 printf(" %*s %s (%s)\n", 9, t == i->listen ? "Listen:" : "", *t2, *t);