Skip to content

Commit f8a2f03

Browse files
Rename doesExist to doesItExist
1 parent adbd430 commit f8a2f03

9 files changed

Lines changed: 26 additions & 29 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ contents concurrently for improved performance.
1515
Currently, this library provides implementations for the
1616
following coreutils-inspired as well as some additional commands:
1717

18-
Filesystem: `cp`, `rm`, `mv`, `ln`, `readlink`, `test`, `stat`, `touch`
19-
Directories: `ls`, `dirname`, `mkdir`, `cd`, `pwd`, `home` and others
20-
Text Processing: `cut`, `tail`
21-
Processes: `sleep`
22-
Shell: `which`, executing shell commands with streaming
18+
* Filesystem: `cp`, `rm`, `mv`, `ln`, `readlink`, `test`, `stat`, `touch`
19+
* Directories: `ls`, `dirname`, `mkdir`, `cd`, `pwd`, `home` and others
20+
* Text Processing: `cut`, `tail`
21+
* Processes: `sleep`
22+
* Shell: `which`, executing shell commands with streaming
2323

2424
## Important API Notice
2525

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ environment:
5555
# If you have not committed packcheck.sh in your repo at PACKCHECK_LOCAL_PATH
5656
# then it is automatically pulled from this URL.
5757
PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck"
58-
PACKCHECK_GITHUB_COMMIT: "4efa717bc63b4bbd0501a07df5c610849e5d6281"
58+
PACKCHECK_GITHUB_COMMIT: "b91dd7daf50d91047ca8c1cce47e8634e34dfcbc"
5959

6060
# Override the temp directory to avoid sed escaping issues
6161
# See https://github.com/haskell/cabal/issues/5386

src/Streamly/Coreutils/Cp.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ cpShouldOverwrite :: CpOverwrite -> FilePath -> FilePath -> IO Bool
112112
cpShouldOverwrite option src dest =
113113
case option of
114114
OverwriteAlways -> return True
115-
OverwriteOnly -> test dest doesExist
116-
OverwriteNever -> not <$> test dest doesExist
115+
OverwriteOnly -> test dest doesItExist
116+
OverwriteNever -> not <$> test dest doesItExist
117117
OverwriteUpdate -> do
118-
r <- test dest doesExist
118+
r <- test dest doesItExist
119119
if r
120120
then test src $ newerThanFile dest
121121
else return True

src/Streamly/Coreutils/FileTest.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
-- > test -b file -> isBlockDevice
4040
-- > test -c file -> isCharDevice
4141
-- > test -d file -> isDir
42-
-- > test -e file -> doesExist
42+
-- > test -e file -> doesItExist
4343
-- > test -f file -> isFile
4444
-- > test -g file -> hasSetGid
4545
-- > test -G file -> isOwnedByCurrentGroup
@@ -63,7 +63,7 @@
6363
--
6464
-- Example:
6565
--
66-
-- > test path doesExist
66+
-- > test path doesItExist
6767
-- > test path isReadable
6868
-- > test path (size (> 4096))
6969
-- > test path (modifyTimeComparedTo (>) "reference.txt")
@@ -97,7 +97,7 @@ module Streamly.Coreutils.FileTest
9797

9898
-- ** General
9999
-- , predicate -- exposes FileStatus
100-
, doesExist -- XXX doesItExist or doesPathExist
100+
, doesItExist
101101

102102
-- ** File Type
103103
, isDir

src/Streamly/Coreutils/FileTest/Common.hs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
--
4747
-- Naming: unary predicates are either isSomething or hasSomething. Binary
4848
-- predicates are nouns. Predicates are named so that they read well on the
49-
-- call site e.g. "test path doesExist" or "test path isReadable".
49+
-- call site e.g. "test path doesItExist" or "test path isReadable".
5050
--
5151
-- Files supported by windows:
5252
--
@@ -102,7 +102,7 @@ module Streamly.Coreutils.FileTest.Common
102102
-- * Predicates
103103

104104
-- ** General
105-
, doesExist
105+
, doesItExist
106106

107107
-- ** File Type
108108
, isDir
@@ -418,7 +418,7 @@ applyCatchENOENT f fs =
418418
-- to lack of permissions. The exception type can be used to determine the
419419
-- reason for failure.
420420
-- * test 'isSymLink' always returns false.
421-
-- * test 'doesExist' returns false if the path is symlink but it does not
421+
-- * test 'doesItExist' returns false if the path is symlink but it does not
422422
-- point to an existing file.
423423
--
424424
test :: FilePath -> FileTest -> IO Bool
@@ -430,7 +430,7 @@ test path (FileTest (Predicate f)) = do
430430
-- symlink.
431431
--
432432
-- * 'isSymLink' returns true if path is a symlink, false otherwise.
433-
-- * 'doesExist' returns true if the link exists irrespective of whether it
433+
-- * 'doesItExist' returns true if the link exists irrespective of whether it
434434
-- points to an existing file.
435435
-- * Predicates related to file permission mode bits are meaningless, and
436436
-- should not be used.
@@ -493,19 +493,17 @@ false = FileTest $ Predicate $ const (pure False)
493493
-- with anything else. But as a FileTest the same predicate can be used with
494494
-- either "test" or "testl" to execute the predicate.
495495

496-
-- XXX Rename to doesItExist or pathExists
497-
498496
-- | True if the path exists. In case of symlink whether it tests the link file
499497
-- or the file pointed to by it depends on whether you use 'test' or 'testl' to
500498
-- execute the predicate.
501499
--
502500
-- Like coreutil @test -e file@
503-
doesExist :: FileTest
504-
doesExist = withStatus (const True)
501+
doesItExist :: FileTest
502+
doesItExist = withStatus (const True)
505503

506-
{-# DEPRECATED isExisting "Use doesExist instead." #-}
504+
{-# DEPRECATED isExisting "Use doesItExist instead." #-}
507505
isExisting :: FileTest
508-
isExisting = doesExist
506+
isExisting = doesItExist
509507

510508
---------------
511509
-- Type of file

src/Streamly/Coreutils/Ln.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module Streamly.Coreutils.Ln
1919
where
2020

2121
import Control.Monad (when)
22-
import Streamly.Coreutils.FileTest (test, doesExist)
22+
import Streamly.Coreutils.FileTest (test, doesItExist)
2323

2424
import qualified System.PosixCompat.Files as Posix
2525

@@ -41,7 +41,7 @@ ln :: (Ln -> Ln) -> FilePath -> FilePath -> IO ()
4141
ln f src tgt = do
4242
let opt = f defaultConfig
4343
when (lnForce opt == False) $ do
44-
found <- test tgt doesExist
44+
found <- test tgt doesItExist
4545
when found $ error msg
4646
case lnSymbolic opt of
4747
False -> Posix.createLink src tgt

src/Streamly/Coreutils/Rm.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ where
8686

8787
import Control.Monad (forM_, when)
8888
import Streamly.Coreutils.FileTest
89-
(doesExist, test, testl, isDir, isWritableByMode)
89+
(doesItExist, test, testl, isDir, isWritableByMode)
9090
#if defined(mingw32_HOST_OS)
9191
import Streamly.Coreutils.FileTest.Windows (isDirSymLink)
9292
#endif
@@ -259,7 +259,7 @@ rm f path = do
259259
-- Note this test is required not just for existence check but also so that
260260
-- we fail if there is no permission to access the path.
261261
--
262-
found <- testl path doesExist
262+
found <- testl path doesItExist
263263
if found
264264
then performRm options path
265265
else

src/Streamly/Coreutils/Touch.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module Streamly.Coreutils.Touch
2020
where
2121

2222
import Control.Monad (unless)
23-
import Streamly.Coreutils.FileTest (test, doesExist)
23+
import Streamly.Coreutils.FileTest (test, doesItExist)
2424
import System.IO (openFile, IOMode(WriteMode), hClose)
2525

2626
#if !defined (CABAL_OS_WINDOWS)
@@ -65,7 +65,7 @@ touch f path = do
6565
let opt = f defaultConfig
6666
if (createNew opt == True && deRef opt == True)
6767
then do
68-
found <- test path doesExist
68+
found <- test path doesItExist
6969
unless found $ openFile path WriteMode >>= hClose
7070
else
7171
case deRef opt of

streamly-coreutils.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ test-suite Streamly.Coreutils.Rm
184184
, hspec
185185
, streamly-coreutils
186186
, temporary
187-
-- , unix
188187
, unix-compat
189188
default-language: Haskell2010
190189
ghc-options: -main-is Streamly.Test.Coreutils.Rm.main

0 commit comments

Comments
 (0)