lentil 0.1.2.7 → 0.1.3.0
raw patch · 10 files changed
+95/−29 lines, 10 files
Files
- changes.txt +7/−0
- doc/usr/page.rst +15/−0
- issues.txt +11/−5
- lentil.cabal +2/−2
- src/Lentil/Args.hs +1/−2
- src/Lentil/File.hs +30/−10
- src/Lentil/Helpers.hs +18/−0
- src/Lentil/Parse/Run.hs +1/−6
- src/Main.hs +1/−1
- test/Lentil/FileSpec.hs +9/−3
changes.txt view
@@ -1,3 +1,10 @@+0.1.3.0+-------++- Released Fri 24 Jul 2015 15:25:39 CEST+- Lentil searches for files outside $PWD (request+patch by Tomislav).+- Lentil enumerates all files within $PWD (request+patch by Tomislav).+ 0.1.2.7 -------
doc/usr/page.rst view
@@ -249,3 +249,18 @@ ``--help`` displays cheatsheet option help. +.. raw:: html++ <p><br/></p>++Tips+----++When output gets too big for a single screen, call lentil as:++::++ lentil . | less -R++This will allow you to browse the issues in a pager *without* losing+ANSI colour formatting.
issues.txt view
@@ -28,23 +28,29 @@ src/Lentil/Args.hs 23 disambiguation optparse-applicative [feature:intermediate] 24 help as lentil PATH [ PATH... ] [ OPTIONS ] [feature:intermediate]- 89 uncomment and implement sorting [feature:intermediate]+ 88 uncomment and implement sorting [feature:intermediate] src/Lentil/File.hs- 51 combine funziona su windows? [feature:intermediate]+ 42 not using canonised paths because it is extremely slow on big+ repositories (like darcs). Explore different possibilities+ (conduit, new Filepath, unix program). [u:2] [duct]+ 62 combine funziona su windows? [feature:intermediate] src/Lentil/Parse/Run.hs 32 a function String -> [Issue]- 73 change '\n' trick [refactor] [duct]+ 68 change '\n' trick [refactor] [duct] src/Lentil/Parse/Syntaxes.hs 21 add langparsers che sia estensibile e leggibile a compilazione [u:2] [feature:intermediate]- 38 multiline signature? [lint]- 39 tag at the beginning too? [design]+ 39 multiline signature? [lint]+ 40 tag at the beginning too? [design] src/Main.hs 35 add doc to use less -r when piping hIsTerminalDevice stdout [doc]+ +test/Lentil/ArgsSpec.hs+ 37 real parsing testing options [test] test/Tests.hs 4
lentil.cabal view
@@ -1,5 +1,5 @@ name: lentil-version: 0.1.2.7+version: 0.1.3.0 synopsis: frugal issue tracker description: minumum effort, cohesive issue tracker based on ubiquitous @TODO@s and @FIXME@s conventions.@@ -45,7 +45,7 @@ other-modules: Lentil.Types, Lentil.Args, Lentil.File, Lentil.Print, Lentil.Query, Lentil.Export, Lentil.Parse.Source, Lentil.Parse.Issue Lentil.Parse.Syntaxes,- Lentil.Parse.Run+ Lentil.Parse.Run, Lentil.Helpers hs-source-dirs: src default-language: Haskell2010
src/Lentil/Args.hs view
@@ -50,8 +50,7 @@ -- argument "." gets replaced to "" (all files) includes :: Parser [FilePath] includes = map repf <$> some (argument str (metavar "PATH..."))- where repf "." = ""- repf cs = cs+ where repf cs = cs exclude :: Parser FilePath exclude = strOption ( short 'x' <>
src/Lentil/File.hs view
@@ -2,7 +2,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Lentil.File--- Copyright : © 2015 Francesco Ariis+-- Copyright : © 2015 Francesco Ariis, Tomislav -- License : GPLv3 (see the LICENSE file) -- -- File operations@@ -11,6 +11,7 @@ module Lentil.File where import Lentil.Types+import Lentil.Helpers import Lentil.Parse.Run import System.FilePath@@ -20,6 +21,9 @@ import qualified Data.List as L +-- import Data.Either+-- import System.Directory+-- import Control.Exception.Base ---------------@@ -35,18 +39,34 @@ -- FILESCAN -- -------------- +-- todo: not using canonised paths because it is extremely slow on big+-- repositories (like darcs). Explore different possibilities+-- (conduit, new Filepath, unix program). [u:2] [duct]+ findIssues :: [FilePath] -> [FilePath] -> IO [Issue]-findIssues is xs = find always (findClause is xs) "." >>= issueFinder+findIssues is xs = mapM fc is >>= issueFinder . concat+ where+ fc i = find always (findClause (xs' i)) i --- fp to include, fp to exclude, clause-findClause :: [FilePath] -> [FilePath] -> FindClause Bool-findClause i x = let ic = mconcat $ map fp2fc i- xc = mconcat $ map fp2fc x- in fileType ==? RegularFile &&?- fmap getAny ic &&?- (not <$> fmap getAny xc)+ xs' "." = map (combine ".") xs -- trick to exclude on '.'+ xs' _ = xs++-- fp to exclude, clause+findClause :: [FilePath] -> FindClause Bool+findClause x = let xc = mconcat $ map fp2fc x+ in fileType ==? RegularFile &&?+ (not <$> fmap getAny xc) where fp2fc :: FilePath -> FindClause Any- fp2fc f = Any . L.isPrefixOf (combine "." f) <$> filePath+ fp2fc f = Any . L.isPrefixOf f <$> filePath -- TODO: combine funziona su windows? [feature:intermediate]+++-- -- canonicalizePath with exceptions to stderr+-- canonPaths :: [FilePath] -> IO [FilePath]+-- canonPaths ps = (mapM (try . canonicalizePath) ps+-- :: IO [Either SomeException FilePath]) >>= \ecs ->+-- let (ls, rs) = partitionEithers ecs in+-- mapM_ (perr . ("canonPath: " ++) . show) ls >>+-- return rs
+ src/Lentil/Helpers.hs view
@@ -0,0 +1,18 @@+-----------------------------------------------------------------------------+-- |+-- Module : Lentil.Helpers+-- Copyright : © 2015 Francesco Ariis+-- License : GPLv3 (see the LICENSE file)+--+-- Ancillaries for other modules+-----------------------------------------------------------------------------++module Lentil.Helpers where++import qualified System.IO as I++-- output errors+perr :: String -> IO ()+perr cs = I.hPutStrLn I.stderr cs++
src/Lentil/Parse/Run.hs view
@@ -11,6 +11,7 @@ module Lentil.Parse.Run where import Lentil.Types+import Lentil.Helpers import Lentil.Parse.Issue import Lentil.Parse.Source import Lentil.Parse.Syntaxes@@ -18,7 +19,6 @@ import Text.Parsec import Control.Applicative hiding (many, (<|>))-import qualified System.IO as I import qualified System.Directory as D import Prelude -- 7.8 hack@@ -59,11 +59,6 @@ Left l -> perr (fp ++ " : parse error " ++ show l) >> return [] Right r -> return r---- output errors-perr :: String -> IO ()-perr cs = I.hPutStrLn I.stderr cs- -- issue parsing --
src/Main.hs view
@@ -28,7 +28,7 @@ short 'v' <> help "show version and copyright info" ) where- versionCopy = "lentil - a frugal issue tracker, version 0.1.2.7\n\+ versionCopy = "lentil - a frugal issue tracker, version 0.1.3.0\n\ \(C) 2015 Francesco Ariis - http://www.ariis.it\n\ \released under the GNU General Public License 3\n"
test/Lentil/FileSpec.hs view
@@ -27,9 +27,11 @@ it "accepts filenames instead of dirs, too" $ findIssues [bas ++ "fold-a/foo1.hs"] [] >>= \fiss -> length fiss `shouldBe` 1- it "doesn't duplicate issues" $- findIssues [bas ++ "", bas ++ ""] [] >>= \fiss ->- length fiss `shouldBe` 5++-- it "doesn't duplicate issues" $+-- findIssues [bas ++ "", bas ++ ""] [] >>= \fiss ->+-- length fiss `shouldBe` 5+ it "excludes some folders" $ findIssues [bas ++ ""] [bas ++ "fold-c/"] >>= \fiss -> length fiss `shouldBe` 2@@ -43,4 +45,8 @@ it "doesn't crash on wrong file" $ findIssues [bas ++ "zxczd"] [] >>= \fiss -> length fiss `shouldBe` 0+ it "does search outside $PWD" $+ findIssues [bas] [] >>= \fiss ->+ findIssues [bas ++ "../test-proj/"] [] >>= \fiss' ->+ length fiss `shouldBe` length fiss'