From 4b9b932834860add4ef8fcd7618f2867902fcbd4 Mon Sep 17 00:00:00 2001 From: Fabian Kirchner Date: Mon, 2 Oct 2023 15:21:08 +0200 Subject: get list of files which should be checked --- anissue.cabal | 4 +++- 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" -- cgit v1.2.3