diff options
author | Fabian Kirchner <kirchner@posteo.de> | 2023-10-02 15:21:08 +0200 |
---|---|---|
committer | Fabian Kirchner <kirchner@posteo.de> | 2023-10-02 15:21:08 +0200 |
commit | 4b9b932834860add4ef8fcd7618f2867902fcbd4 (patch) | |
tree | 44fa5e180231daccde130d1e707459c8e882189d | |
parent | 737bf192f4b74104b7e8f78ed9732e70aa44a5da (diff) |
get list of files which should be checked
-rw-r--r-- | anissue.cabal | 4 | ||||
-rw-r--r-- | app/Main.hs | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/anissue.cabal b/anissue.cabal index 39aed05..4bae665 100644 --- a/anissue.cabal +++ b/anissue.cabal @@ -72,7 +72,9 @@ executable anissue -- Other library packages from which modules are imported. build-depends: base ^>=4.16.4.0, - optparse-applicative + bytestring, + optparse-applicative, + typed-process -- Directories containing source files. hs-source-dirs: app diff --git a/app/Main.hs b/app/Main.hs index e3c1a28..351bcac 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,7 +1,12 @@ +{-# LANGUAGE OverloadedStrings #-} + module Main where +import Data.ByteString.Lazy (ByteString) +import Data.ByteString.Lazy qualified as LB import Options.Applicative ((<**>)) import Options.Applicative qualified as O +import System.Process.Typed qualified as P data Options = Options { optCommand :: Command @@ -36,4 +41,10 @@ showCommandParser = main :: IO () main = do options <- O.execParser (O.info (commandParser <**> O.helper) O.idm) - print options + files <- getFiles + print files + +getFiles :: IO [ByteString] +getFiles = + fmap (LB.split 10 . snd) $ + P.readProcessStdout "git ls-files --cached --exclude-standard --other" |