highlight 1.0.0.1 → 1.0.0.2
raw patch · 14 files changed
+66/−65 lines, 14 filesdep −QuickCheckdep −doctestdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: QuickCheck, doctest
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Highlight.Common.Monad: NoFilename :: FilenameHandlingFromFiles
+ Highlight.Common.Monad: OutputStderr :: !ByteString -> Output
+ Highlight.Common.Monad: OutputStdout :: !ByteString -> Output
+ Highlight.Common.Monad: PrintFilename :: FilenameHandlingFromFiles
+ Highlight.Common.Monad: createInputData :: forall m. MonadIO m => Recursive -> [InputFilename] -> Producer ByteString m () -> m (InputData m ())
+ Highlight.Common.Monad: data FilenameHandlingFromFiles
+ Highlight.Common.Monad: data InputData m a
+ Highlight.Common.Monad: data Output
+ Highlight.Common.Monad: handleInputData :: forall m. MonadIO m => (ByteString -> m [ByteString]) -> (FilenameHandlingFromFiles -> ByteString -> Int -> ByteString -> m [ByteString]) -> (ByteString -> IOException -> Maybe IOException -> m [ByteString]) -> InputData m () -> Producer Output m ()
+ Highlight.Common.Monad: runOutputProducer :: forall m. MonadIO m => Producer Output m () -> m ()
+ Highlight.Highlight.Monad: NoFilename :: FilenameHandlingFromFiles
+ Highlight.Highlight.Monad: PrintFilename :: FilenameHandlingFromFiles
+ Highlight.Highlight.Monad: compileHighlightRegexWithErr :: (HasIgnoreCase r, HasRawRegex r) => CommonHighlightM r s HighlightErr RE
+ Highlight.Highlight.Monad: createInputData :: forall m. MonadIO m => Recursive -> [InputFilename] -> Producer ByteString m () -> m (InputData m ())
+ Highlight.Highlight.Monad: data CommonHighlightM r s e a
+ Highlight.Highlight.Monad: data FilenameHandlingFromFiles
+ Highlight.Highlight.Monad: data InputData m a
+ Highlight.Highlight.Monad: data Output
+ Highlight.Highlight.Monad: getInputFilenamesM :: (HasInputFilenames r, MonadReader r m) => m [InputFilename]
+ Highlight.Highlight.Monad: getRecursiveM :: (HasRecursive r, MonadReader r m) => m Recursive
+ Highlight.Highlight.Monad: handleInputData :: forall m. MonadIO m => (ByteString -> m [ByteString]) -> (FilenameHandlingFromFiles -> ByteString -> Int -> ByteString -> m [ByteString]) -> (ByteString -> IOException -> Maybe IOException -> m [ByteString]) -> InputData m () -> Producer Output m ()
+ Highlight.Highlight.Monad: runCommonHighlightM :: r -> s -> CommonHighlightM r s e a -> IO (Either e a)
+ Highlight.Highlight.Monad: runOutputProducer :: forall m. MonadIO m => Producer Output m () -> m ()
+ Highlight.Highlight.Options: DoNotIgnoreCase :: IgnoreCase
+ Highlight.Highlight.Options: IgnoreCase :: IgnoreCase
+ Highlight.Highlight.Options: InputFilename :: FilePath -> InputFilename
+ Highlight.Highlight.Options: RawRegex :: String -> RawRegex
+ Highlight.Highlight.Options: Recursive :: Recursive
+ Highlight.Highlight.Options: [unInputFilename] :: InputFilename -> FilePath
+ Highlight.Highlight.Options: class HasCommonOptions r
+ Highlight.Highlight.Options: class HasIgnoreCase r
+ Highlight.Highlight.Options: class HasInputFilenames r
+ Highlight.Highlight.Options: class HasRawRegex r
+ Highlight.Highlight.Options: class HasRecursive r
+ Highlight.Highlight.Options: commonOptionsLens :: HasCommonOptions r => Lens' r CommonOptions
+ Highlight.Highlight.Options: commonOptionsParser :: Parser CommonOptions
+ Highlight.Highlight.Options: data CommonOptions
+ Highlight.Highlight.Options: data IgnoreCase
+ Highlight.Highlight.Options: data Recursive
+ Highlight.Highlight.Options: defaultCommonOptions :: CommonOptions
+ Highlight.Highlight.Options: ignoreCaseLens :: (HasIgnoreCase r, HasCommonOptions r) => Lens' r IgnoreCase
+ Highlight.Highlight.Options: inputFilenamesLens :: (HasInputFilenames r, HasCommonOptions r) => Lens' r [InputFilename]
+ Highlight.Highlight.Options: newtype InputFilename
+ Highlight.Highlight.Options: newtype RawRegex
+ Highlight.Highlight.Options: rawRegexLens :: (HasRawRegex r, HasCommonOptions r) => Lens' r RawRegex
+ Highlight.Highlight.Options: recursiveLens :: (HasRecursive r, HasCommonOptions r) => Lens' r Recursive
+ Highlight.Hrep.Monad: NoFilename :: FilenameHandlingFromFiles
+ Highlight.Hrep.Monad: PrintFilename :: FilenameHandlingFromFiles
+ Highlight.Hrep.Monad: compileHighlightRegexWithErr :: (HasIgnoreCase r, HasRawRegex r) => CommonHighlightM r s HighlightErr RE
+ Highlight.Hrep.Monad: createInputData :: forall m. MonadIO m => Recursive -> [InputFilename] -> Producer ByteString m () -> m (InputData m ())
+ Highlight.Hrep.Monad: data CommonHighlightM r s e a
+ Highlight.Hrep.Monad: data FilenameHandlingFromFiles
+ Highlight.Hrep.Monad: data InputData m a
+ Highlight.Hrep.Monad: data Output
+ Highlight.Hrep.Monad: getInputFilenamesM :: (HasInputFilenames r, MonadReader r m) => m [InputFilename]
+ Highlight.Hrep.Monad: getRecursiveM :: (HasRecursive r, MonadReader r m) => m Recursive
+ Highlight.Hrep.Monad: handleInputData :: forall m. MonadIO m => (ByteString -> m [ByteString]) -> (FilenameHandlingFromFiles -> ByteString -> Int -> ByteString -> m [ByteString]) -> (ByteString -> IOException -> Maybe IOException -> m [ByteString]) -> InputData m () -> Producer Output m ()
+ Highlight.Hrep.Monad: runCommonHighlightM :: r -> s -> CommonHighlightM r s e a -> IO (Either e a)
+ Highlight.Hrep.Monad: runOutputProducer :: forall m. MonadIO m => Producer Output m () -> m ()
- Highlight.Common.Monad.Input: FileReaderErr :: !FileOrigin -> !IOException -> !(Maybe IOException) -> FileReader a
+ Highlight.Common.Monad.Input: FileReaderErr :: !FileOrigin -> !IOException -> !Maybe IOException -> FileReader a
- Highlight.Common.Monad.Input: InputData :: !FilenameHandlingFromFiles -> !(Producer (FileReader ByteString) m a) -> InputData m a
+ Highlight.Common.Monad.Input: InputData :: !FilenameHandlingFromFiles -> !Producer (FileReader ByteString) m a -> InputData m a
- Highlight.Common.Options: class HasIgnoreCase r where ignoreCaseLens = commonOptionsLens . ignoreCaseLens
+ Highlight.Common.Options: class HasIgnoreCase r
- Highlight.Common.Options: class HasInputFilenames r where inputFilenamesLens = commonOptionsLens . inputFilenamesLens
+ Highlight.Common.Options: class HasInputFilenames r
- Highlight.Common.Options: class HasRawRegex r where rawRegexLens = commonOptionsLens . rawRegexLens
+ Highlight.Common.Options: class HasRawRegex r
- Highlight.Common.Options: class HasRecursive r where recursiveLens = commonOptionsLens . recursiveLens
+ Highlight.Common.Options: class HasRecursive r
- Highlight.Highlight.Monad: FromGrepFilenameState :: {-# UNPACK #-} !Int -> !(Maybe ByteString) -> FromGrepFilenameState
+ Highlight.Highlight.Monad: FromGrepFilenameState :: {-# UNPACK #-} !Int -> !Maybe ByteString -> FromGrepFilenameState
- Highlight.Highlight.Monad: [fromGrepFilenameStatePrevFilename] :: FromGrepFilenameState -> !(Maybe ByteString)
+ Highlight.Highlight.Monad: [fromGrepFilenameStatePrevFilename] :: FromGrepFilenameState -> !Maybe ByteString
Files
- LICENSE +1/−1
- README.md +42/−2
- highlight.cabal +15/−12
- src/Highlight/Common/Error.hs +0/−2
- src/Highlight/Common/Monad/Input.hs +8/−4
- src/Highlight/Common/Options.hs +0/−1
- src/Highlight/Highlight.hs +0/−1
- src/Highlight/Highlight/Options.hs +0/−1
- src/Highlight/Highlight/Run.hs +0/−1
- src/Highlight/Hrep.hs +0/−1
- src/Highlight/Hrep/Run.hs +0/−1
- src/Highlight/Util.hs +0/−1
- test/DocTest.hs +0/−36
- test/Test/Golden.hs +0/−1
LICENSE view
@@ -1,4 +1,4 @@-Copyright Dennis Gosnell (c) 2017+Copyright Dennis Gosnell (c) 2017-2022 All rights reserved.
README.md view
@@ -2,7 +2,7 @@ Highlight ========= -[](http://travis-ci.org/cdepillabout/highlight)+[](https://github.com/cdepillabout/highlight/actions) [](https://hackage.haskell.org/package/highlight) [](http://stackage.org/lts/package/highlight) [](http://stackage.org/nightly/package/highlight)@@ -19,6 +19,25 @@  +<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-generate-toc again -->+**Table of Contents**++- [Highlight](#highlight)+ - [Uses](#uses)+ - [`highlight`](#highlight)+ - [highlight output from `grep`](#highlight-output-from-grep)+ - [`hrep`](#hrep)+ - [Installation](#installation)+ - [Other ways to highlight parts of files](#other-ways-to-highlight-parts-of-files)+ - [Contributions](#contributions)+ - [Additional flags](#additional-flags)+ - [Development](#development)+ - [Build](#build)+ - [Test](#test)++<!-- markdown-toc end -->++ ## Uses This package installs two binaries, `highlight` and `hrep`. The following@@ -64,9 +83,11 @@ [`stack`](https://docs.haskellstack.org/en/stable/README/): ```sh-$ stack install highlight+$ stack --resolver nightly-2017-07-03 install highlight ``` +By default, `stack` will install binaries into `~/.local/bin/`.+ It should also be possible to use `cabal` to install this package. ## Other ways to highlight parts of files@@ -106,3 +127,22 @@ `highlight` or `hrep`, please feel free to open an issue or PR. Some flags/options will be relatively easy to support, while some may require quite a large amount of additional code.++## Development++### Build++`highlight` and `hrep` can be built will the following command. See the+[Installation](#installation) section above for information about `stack`.++```sh+$ stack build+```++### Test++The tests can be run with the following command:++```sh+$ stack test+```
highlight.cabal view
@@ -1,5 +1,5 @@ name: highlight-version: 1.0.0.1+version: 1.0.0.2 synopsis: Command line tool for highlighting parts of files matching a regex. description: Please see <https://github.com/cdepillabout/highlight#readme README.md>. homepage: https://github.com/cdepillabout/highlight@@ -7,7 +7,7 @@ license-file: LICENSE author: Dennis Gosnell maintainer: cdep.illabout@gmail.com-copyright: 2017 Dennis Gosnell+copyright: 2017-2022 Dennis Gosnell category: Text build-type: Simple extra-source-files: README.md@@ -56,7 +56,7 @@ , Highlight.Hrep.Run , Highlight.Pipes , Highlight.Util- build-depends: base >= 4.7 && < 5+ build-depends: base >= 4.14 && < 5 , base-compat >= 0.8 , ansi-terminal >= 0.6 , bytestring >= 0.9@@ -103,15 +103,18 @@ default-language: Haskell2010 ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -test-suite highlight-doctest- type: exitcode-stdio-1.0- main-is: DocTest.hs- hs-source-dirs: test- build-depends: base- , doctest- , QuickCheck- default-language: Haskell2010- ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N+-- TODO: The doctests have been disabled because they are not using+-- cabal-doctest (or one of the other doctest solutions).+-- I'd like to eventually turn the doctests back on and get them working again.+-- test-suite highlight-doctest+-- type: exitcode-stdio-1.0+-- main-is: DocTest.hs+-- hs-source-dirs: test+-- build-depends: base+-- , doctest+-- , QuickCheck+-- default-language: Haskell2010+-- ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N test-suite highlight-test type: exitcode-stdio-1.0
src/Highlight/Common/Error.hs view
@@ -4,8 +4,6 @@ import Prelude () import Prelude.Compat -import Data.Monoid ((<>))- import Highlight.Common.Options (RawRegex(RawRegex)) import Highlight.Util (die)
src/Highlight/Common/Monad/Input.hs view
@@ -23,7 +23,7 @@ import Data.ByteString (ByteString) import Data.List (sort) import Pipes- (Pipe, Producer, Producer', Proxy, (>->), await, each, for, next,+ (Pipe, Producer, Proxy, (>->), await, each, for, next, yield) import Pipes.Prelude (toListM) import qualified Pipes.Prelude as Pipes@@ -264,14 +264,18 @@ -- >>> toListM $ fileListProducer Recursive fileOrigin4 -- [FileReaderErr (FileSpecifiedByUser "thisdirdoesnotexist") thisdirdoesnotexist: openBinaryFile: does not exist (No such file or directory) (Just ...)] fileListProducer- :: forall m.+ :: forall x' x m. MonadIO m => Recursive -> FileOrigin- -> Producer' (FileReader Handle) m ()+ -- -> Producer' (FileReader Handle) m ()+ -> Proxy x' x () (FileReader Handle) m () fileListProducer recursive = go where- go :: FileOrigin -> Producer' (FileReader Handle) m ()+ go+ :: FileOrigin+ -- -> Producer' (FileReader Handle) m ()+ -> Proxy x' x () (FileReader Handle) m () go fileOrigin = do let maybeFilePath = getFilePathFromFileOrigin fileOrigin case maybeFilePath of
src/Highlight/Common/Options.hs view
@@ -10,7 +10,6 @@ import Control.Applicative (many) import Control.Lens (Lens', lens)-import Data.Monoid ((<>)) import Data.String (IsString) import Options.Applicative (Parser, flag, help, long, metavar, short, strArgument)
src/Highlight/Highlight.hs view
@@ -13,7 +13,6 @@ module Highlight.Highlight where -import Data.Monoid ((<>)) import Options.Applicative (InfoMod, ParserInfo, (<**>), execParser, fullDesc, helper, info, progDesc)
src/Highlight/Highlight/Options.hs view
@@ -16,7 +16,6 @@ import Prelude.Compat import Control.Lens (Lens', lens)-import Data.Monoid ((<>)) import Options.Applicative (Parser, flag, help, long, short) import Highlight.Common.Options
src/Highlight/Highlight/Run.hs view
@@ -12,7 +12,6 @@ import Control.Monad.State (MonadState) import Data.ByteString (ByteString, empty) import qualified Data.ByteString.Char8-import Data.Monoid ((<>)) import Pipes (Producer) import Text.RE.PCRE (RE, (*=~)) import Text.RE.Replace (replaceAll)
src/Highlight/Hrep.hs view
@@ -1,7 +1,6 @@ module Highlight.Hrep where -import Data.Monoid ((<>)) import Options.Applicative (InfoMod, ParserInfo, (<**>), execParser, fullDesc, helper, info, progDesc)
src/Highlight/Hrep/Run.hs view
@@ -10,7 +10,6 @@ import Control.Exception (IOException) import Data.ByteString (ByteString) import Data.Maybe (maybeToList)-import Data.Monoid ((<>)) import Pipes (Producer) import Text.RE.PCRE (RE, (*=~), anyMatches) import Text.RE.Replace (replaceAll)
src/Highlight/Util.hs view
@@ -8,7 +8,6 @@ import Control.Monad.State (MonadState, get, put) import Data.ByteString (ByteString) import Data.ByteString.Unsafe (unsafePackMallocCStringLen)-import Data.Semigroup (Semigroup, (<>)) import Foreign.C (newCStringLen) import System.Exit (ExitCode(ExitFailure), exitWith) import System.IO (Handle, IOMode(ReadMode), hClose, hIsEOF, openBinaryFile)
− test/DocTest.hs
@@ -1,36 +0,0 @@--module Main (main) where--import Prelude--import Data.Monoid ((<>))-import Test.DocTest (doctest)--main :: IO ()-main = doctest $ ["src/"] <> ghcExtensions--ghcExtensions :: [String]-ghcExtensions =- [- -- "-XConstraintKinds"- -- , "-XDataKinds"- -- , "-XDeriveDataTypeable"- -- , "-XDeriveGeneric"- -- , "-XEmptyDataDecls"- -- , "-XFlexibleContexts"- -- , "-XFlexibleInstances"- -- , "-XGADTs"- -- , "-XGeneralizedNewtypeDeriving"- -- , "-XInstanceSigs"- -- , "-XMultiParamTypeClasses"- -- , "-XNoImplicitPrelude"- -- , "-XOverloadedStrings"- -- , "-XPolyKinds"- -- , "-XRankNTypes"- -- , "-XRecordWildCards"- -- , "-XScopedTypeVariables"- -- , "-XStandaloneDeriving"- -- , "-XTupleSections"- -- , "-XTypeFamilies"- -- , "-XTypeOperators"- ]
test/Test/Golden.hs view
@@ -13,7 +13,6 @@ import Data.ByteString.Lazy (fromStrict) import qualified Data.ByteString.Lazy as LByteString import Data.Foldable (fold)-import Data.Monoid ((<>)) import Pipes (Pipe, Producer, (>->)) import Pipes.Prelude (mapFoldable, toListM) import System.Directory