builtin realpath: Add --no-symlinks option

Taken from GNU realpath, this one makes realpath not resolve symlinks.

It still makes paths absolute and handles duplicate and trailing
slashes.

(useful in fish_add_path)
This commit is contained in:
Fabian Homborg
2020-09-12 19:26:04 +02:00
parent 8cf389baf2
commit 568f9031aa
5 changed files with 83 additions and 19 deletions

View File

@@ -15,6 +15,10 @@ Description
``realpath`` resolves a path to its absolute path.
fish provides a ``realpath`` builtin as a fallback for systems where there is no ``realpath`` command. fish's implementation always resolves its first argument, and does not support any options.
fish provides a ``realpath`` builtin as a fallback for systems where there is no ``realpath`` command, your OS might provide a version with more features.
If the operation fails, an error will be reported.
If a ``realpath`` command exists, it will be preferred, so if you want to use the builtin you should use ``builtin realpath`` explicitly.
The following options are available:
- ``-s`` or ``--no-symlink``: Don't resolve symlinks, only make paths absolute, squash multiple slashes and remove trailing slashes.