ls: support --hyperlink to output file:// URIs
commit799bac0d06cfabe9491498727308df8d1aca6d98
authorPádraig Brady <P@draigBrady.com>
Mon, 21 Aug 2017 10:53:36 +0000 (21 03:53 -0700)
committerPádraig Brady <P@draigBrady.com>
Tue, 29 Aug 2017 07:38:19 +0000 (29 00:38 -0700)
tree736be92f6cb5421eeebd6d3e7a701c8042f22d21
parent4e112e90b11b70bd6dc5b441f820803fc2aadd69
ls: support --hyperlink to output file:// URIs

Terminals such as iTerm2 and VTE based terminals
(as of version 0.49.1), support hyperlinks when
passed terminals codes as described at:
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

* src/ls.c (gobble_file): Allocate an absolute file name to output.
(quote_name): Output the absolute name with the appropriate codes.
(file_escape): A new function to encode file names as per rfc8089.
(main): Handle the new option and call the file_escape_init() helper.
Disable --dired when --hyperlink is specified.
(print_dir): Get the absolute file name here too, so that the
directory name can be linkified.
* NEWS: Mention the new feature.
* tests/ls/hyperlink.sh: Add a new test.
* tests/local.mk: Reference the new test.
* doc/coreutils.texi (ls invocation): Describe --hyperlink.
NEWS
doc/coreutils.texi
src/ls.c
tests/local.mk
tests/ls/hyperlink.sh [new file with mode: 0755]