terminal: add internal API to format URLs for display in capable terminals
authorLennart Poettering <lennart@poettering.net>
Thu, 19 Apr 2018 15:48:53 +0000 (17:48 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 19 Apr 2018 16:04:26 +0000 (18:04 +0200)
commit23b27b39d2a3a002ad827a2e8a9872a51495d797
tree41a12d6cad4dcd8e647b1a262f0cc70aebf1f359
parent2c75088094a1c3b0d743145ba224d078025eb5bc
terminal: add internal API to format URLs for display in capable terminals

Newer terminals (in particular gnome-terminal) understand special escape
sequence for formatting clickable links. Let's support that to make our
tool output more clickable where that's appropriate.

For details see this:

https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

The one big issue is that 'less' currently doesn't grok this, and
doesn't ignore sequence like regular terminal implementations do if they
don't support it. Hence for now, let's disable URL output if a pager is
used. We should revisit that though as soon as less added support for it
and enough time passed for it to enter various distributions.
man/systemd.xml
src/basic/terminal-util.c
src/basic/terminal-util.h
src/test/test-terminal-util.c