diff options
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | app/Issue.hs | 2 | ||||
-rw-r--r-- | app/Main.hs | 7 |
3 files changed, 9 insertions, 9 deletions
@@ -1,16 +1,13 @@ test: test-sh test-elm test-nix test-sh: tests/sh.sh - src/extract-sh.sh tests/sh.sh | \ - jq .text -r | \ + cabal run anissue -- show tests/sh.sh | \ cmp tests/expect test-elm: tests/elm.elm - src/extract-elm.sh tests/elm.elm | \ - jq .text -r | \ + cabal run anissue -- show tests/elm.elm | \ cmp tests/expect test-nix: tests/nix.nix - src/extract-nix.sh tests/nix.nix | \ - jq .text -r | \ + cabal run anissue -- show tests/nix.nix | \ cmp tests/expect diff --git a/app/Issue.hs b/app/Issue.hs index 66047b6..72fbad3 100644 --- a/app/Issue.hs +++ b/app/Issue.hs @@ -39,7 +39,7 @@ fromMatch result match = } else Nothing where - text = stripComments result.file_type match.text + text = stripComments result.file_type (T.strip match.text) lns = T.lines text title = takeWhile (not . isEmpty) lns description = drop (length title + 1) lns diff --git a/app/Main.hs b/app/Main.hs index 723a0a1..87951b6 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE BlockArguments #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE OverloadedRecordDot #-} {-# LANGUAGE OverloadedStrings #-} @@ -43,6 +44,7 @@ module Main where import Control.Exception (Exception, catch, throw, throwIO) +import Control.Monad (when) import Data.Aeson qualified as A import Data.ByteString.Lazy qualified as L import Data.ByteString.Lazy.Char8 qualified as L8 @@ -124,8 +126,9 @@ main = do showMatches :: Issue -> IO () showMatches issue = do T.putStrLn issue.title - T.putStrLn "" - T.putStrLn issue.description + when (not (T.null issue.description)) do + T.putStrLn "" + T.putStrLn issue.description listMatches :: Issue -> IO () listMatches issue = |