aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs35
1 files changed, 21 insertions, 14 deletions
diff --git a/app/Main.hs b/app/Main.hs
index b5d927b..bf8db29 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -82,7 +82,7 @@ import Data.Aeson qualified as A
import Data.ByteString.Lazy qualified as L
import Data.ByteString.Lazy.Char8 qualified as L8
import Data.List (find, intercalate)
-import Data.Maybe (catMaybes)
+import Data.Maybe (catMaybes, fromMaybe)
import Data.String qualified as String
import Data.Text qualified as T
import Issue (Issue (..))
@@ -188,19 +188,19 @@ main = do
case find ((==) (Just id) . I.id) issues of
Nothing -> die (printf "no issue with id `%s'\n" id)
Just issue ->
- putDoc $
- P.vsep
- ( concat
- [ [P.annotate P.bold (P.pretty issue.title)],
- maybe [] ((: []) . P.pretty) issue.description,
- map
- ( \(I.Tag k v) ->
- P.annotate (P.colorDull P.Yellow) $
- P.pretty ("@" `T.append` k `T.append` " " `T.append` v)
- )
- issue.tags
- ]
- )
+ sh_
+ ( P.setStdin
+ ( String.fromString
+ ( T.unpack issue.title
+ ++ "\n\n"
+ ++ fromMaybe "" (fmap T.unpack issue.description)
+ )
+ )
+ -- TODO Make columns configurable
+ --
+ -- @topic formatting
+ "mdcat --columns 80 --local"
+ )
putDoc :: P.Doc P.AnsiStyle -> IO ()
putDoc doc = do
@@ -287,6 +287,13 @@ sh proc = do
then pure out
else throwIO $ ProcessException (show proc) exitCode err
+sh_ :: P.ProcessConfig stdin stdoutIgnored stderr -> IO ()
+sh_ proc = do
+ (exitCode, err) <- P.readProcessStderr proc
+ if exitCode == P.ExitSuccess
+ then pure ()
+ else throwIO $ ProcessException (show proc) exitCode err
+
fixTreeGrepper :: G.Result -> G.Result
fixTreeGrepper treeGrepperResult =
treeGrepperResult {G.matches = G.merge treeGrepperResult.matches}