aboutsummaryrefslogtreecommitdiffstats
path: root/app/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs42
1 files changed, 13 insertions, 29 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 553ca38..fb81f07 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -216,10 +216,6 @@
--
-- @topic dependencies
--- FIXME Render all unicode symbols correctly
---
--- Some symbols like e.g. `╬` are not rendered properly.
-
-- TODO Add fulltext search
--
-- Additional to `--filter` it should be possible to search for issues
@@ -301,11 +297,6 @@
--
-- COMMENT Sounds good!
--- FIXME Crash when displaying some unicode emojis
---
--- Running `anissue show tool-crashes-when-displaying-unicode-emojis`
--- will crash because of 🏗️.
-
-- TODO Support issue comments
-- Currently, comments do not get picked up in issue descriptions; see the
-- issue below.
@@ -432,13 +423,10 @@
module Main where
-import Data.ByteString.Lazy qualified as LB
import Data.Function ((&))
import Data.List (find)
-import Data.Maybe (catMaybes, fromMaybe)
-import Data.String qualified as String
+import Data.Maybe (catMaybes)
import Data.Text qualified as T
-import Data.Text.Encoding qualified as T
import Data.Text.Lazy qualified as LT
import Data.Text.Lazy.IO qualified as LT
import Data.Time.Clock (UTCTime (utctDay))
@@ -454,7 +442,7 @@ import Options.Applicative qualified as O
import Prettyprinter ((<+>))
import Prettyprinter qualified as P
import Prettyprinter.Render.Terminal qualified as P
-import Process (sh_)
+import Process (proc, sh_, textInput)
import System.Console.Terminal.Size qualified as Terminal
import System.Exit (ExitCode (ExitFailure), exitWith)
import System.Process.Typed qualified as P
@@ -630,20 +618,16 @@ main = do
)
++ "\n\n"
sh_
- ( P.setStdin
- ( String.fromString
- ( "# "
- ++ T.unpack issue.title
- ++ "\n\n"
- ++ fromMaybe "" (fmap T.unpack issue.description)
- )
- )
- ( case width of
- Nothing ->
- "mdcat --local"
- Just width' ->
- String.fromString (printf "mdcat --columns %d --local" width')
- )
+ ( ( case width of
+ Nothing -> "mdcat --local"
+ Just width' -> proc "mdcat --columns % --local" width'
+ )
+ & P.setStdin
+ ( textInput
+ ( ("# " <> LT.fromStrict issue.title)
+ <> maybe "" (("\n\n" <>) . LT.fromStrict) issue.description
+ )
+ )
)
putDoc colorize $
P.pretty $
@@ -673,7 +657,7 @@ putDoc colorize doc = do
sh_
( "${PAGER-less}"
& P.shell
- & P.setStdin (P.byteStringInput (LB.fromStrict (T.encodeUtf8 (LT.toStrict s))))
+ & P.setStdin (textInput s)
)
else LT.putStr s