Skip to content

Commit 6872df1

Browse files
Add GNU realpath equivalences
1 parent e67a6ca commit 6872df1

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/Streamly/Coreutils/ResolvePath.hs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,28 @@
2828
-- Each modifier's Haddock describes the default that applies in its
2929
-- absence.
3030
--
31+
-- == GNU @realpath@ equivalences
32+
--
33+
-- Each binding below corresponds to a common GNU @realpath@ flag
34+
-- combination.
35+
--
36+
-- Default (GNU @-E -P@, no relative output):
37+
--
38+
-- >>> _ = resolvePath id -- realpath
39+
-- >>> _ = resolvePath (requireExistence EntirePath) -- realpath -e
40+
-- >>> _ = resolvePath (requireExistence AllParents) -- realpath -E
41+
-- >>> _ = resolvePath (requireExistence DontRequire) -- realpath -m
42+
-- >>> _ = resolvePath (resolutionMode UseTargetParents) -- realpath -P
43+
-- >>> _ = resolvePath (resolutionMode UseOriginalParents) -- realpath -L
44+
-- >>> _ = resolvePath (resolutionMode DontResolveSymlinks) -- realpath -s
45+
-- >>> _ = resolvePath (relativeTo "/usr/bin") -- realpath --relative-to=/usr/bin
46+
-- >>> _ = resolvePath (relativeIfWithin "/usr") -- realpath --relative-base=/usr
47+
--
48+
-- Composed modifiers:
49+
--
50+
-- >>> -- realpath --relative-to=/usr/bin --relative-base=/usr
51+
-- >>> _ = resolvePath (relativeTo "/usr/bin" . relativeIfWithin "/usr")
52+
--
3153
-- == Caveats
3254
--
3355
-- * On Windows, @subst@ drives are resolved through to their

0 commit comments

Comments
 (0)