lsfrom 0.1 → 0.1.1
raw patch · 4 files changed
+44/−15 lines, 4 filesdep ~directorydep ~simple-cmd-args
Dependency ranges changed: directory, simple-cmd-args
Files
- ChangeLog.md +4/−0
- Main.hs +1/−1
- README.md +27/−5
- lsfrom.cabal +12/−9
ChangeLog.md view
@@ -1,5 +1,9 @@ # Release history for lsfrom +## 0.1.1 (2022-04-24)+- use `ls -A`+- improve documentation+ ## 0.1 (2021-02-06) - initial Hackage release - supports filepaths now not just file pattern
Main.hs view
@@ -19,7 +19,7 @@ (dir,pat) = splitFileName file' pat' = pat ++ if isdir then [pathSeparator] else "" sorted <- do- files <- cmd "ls" $ ["-a" | hidden || head pat == '.'] ++ [dir]+ files <- cmd "ls" $ ["-A" | hidden || head pat == '.'] ++ [dir] lines <$> cmdStdIn "sort" [] (pat' ++ "\n" ++ files) let result = tail $ dropWhile (pat' /=) sorted mapM_ (putStrLn . (renderDir dir </>)) result
README.md view
@@ -1,12 +1,16 @@ # lsfrom -`lsfrom` lists files in the current directory that start with a-particular sequence of characters and those after it with respect to-collation.+`lsfrom` lists the files and dirs in a directory starting from the first one+that matches the given filename prefix or the first filename after that+if there is no match, using the current locale collation order. ``` $ ls A a B C+$ lsfrom a+a+B+C $ lsfrom a/ B C@@ -18,5 +22,23 @@ /var ``` -This may be useful for continuing a script on the files in a dir-after a failure, etc.+This may be useful for continuing a script on the content of a directory+after a failure, etc:++```shellsession+$ myscript.sh $(lsfrom next)+```++## Requirements++It uses system `ls` order to preserve locale collation+and requires ls with the `-A` option to exclude `.` and `..` (eg coreutils).+It has been tested on Linux.++## Installation++`stack install lsfrom` or `cabal install lsfrom`.++## Contribute or feedback+lsfrom is distributed with BSD license+and the project is hosted at <https://github.com/juhp/lsfrom>.
lsfrom.cabal view
@@ -1,18 +1,18 @@ name: lsfrom-version: 0.1-synopsis: List dir files starting from a specific name+version: 0.1.1+synopsis: List directory files starting from a specific name description:- `lsfrom` lists files in a directory that start with- a particular sequence of characters and those after it+ `lsfrom` lists the contents of a directory starting from+ a particular prefix and those files after it with respect to locale collation. - This can be useful for continuing a script on the files in a dir- after a failure, etc.+ This can be useful for example for continuing a command or script+ in a directory after a failure. license: BSD3 license-file: LICENSE author: Jens Petersen <petersen@redhat.com> maintainer: Jens Petersen <petersen@redhat.com>-copyright: 2018,2021 Jens Petersen+copyright: 2018,2021-2022 Jens Petersen category: Utility homepage: https://github.com/juhp/lsfrom bug-reports: https://github.com/juhp/lsfrom/issues@@ -31,7 +31,7 @@ build-depends: base < 5, filepath, simple-cmd,- simple-cmd-args+ simple-cmd-args >= 0.1.1 default-language: Haskell2010 ghc-options: -fwarn-missing-signatures -Wall if impl(ghc >= 8.0)@@ -57,6 +57,9 @@ ghc-options: -Wall build-depends: base >= 4 && < 5- , directory+ , directory >= 1.2.3.0 , filepath , simple-cmd+ build-tools: lsfrom+ if impl(ghc < 8.0)+ buildable: False