]> git.ipfire.org Git - thirdparty/systemd.git/commit
systemctl: link to all non-man-page files in help
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 8 Sep 2023 15:02:57 +0000 (17:02 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 21 Sep 2023 16:09:48 +0000 (18:09 +0200)
commit67bc612cbc4e0720b37022a6a00d94130258adc7
tree78e0b36bfd6973b1394a6bb7f06656dd59085c51
parenteb5e1fe7e87ffa25d9a67e9b5538ccfb9de901c9
systemctl: link to all non-man-page files in help

For file:// links, we urlify the link so that the user can click and either
open the file in a editor or some viewer. The detection is chosen via some
mechanism implemented by the terminal emulator. This seems too DTRT for text
files and PDFs, which should cover the majority of realistic cases. If the file
is not viable, the terminal emulator will say
  "Could not open file://…. No application is registered to view this file type."
or similar.

For all other links, which are primarily http:// and https://, we just show the
link, letting the terminal handle the hyperlinking. The user can then ctrl-click
and open the file it their browser. If we tried to open the files automatically,
we'd would need to open many pages, and we'd need to figure out what browser to
use, etc. When the user picks whether to open the file, this leads to a nicer
user experience.

Man pages are separated by an empty line from preceding in and following output.
In my testing, this makes the output easier to read. A bit of explicit flushing
is needed to make sure that various outputs are not interleaved.

Fixes https://github.com/systemd/systemd/issues/29061.
src/systemctl/systemctl-show.c