fix: lib: avoid using pager on Windows, the package is not supported
This commit is contained in:
parent
3206b0e278
commit
41e838ef83
@ -9,7 +9,7 @@ The colour scheme may be somewhat hard-coded.
|
||||
|
||||
-}
|
||||
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
{-# LANGUAGE CPP, LambdaCase #-}
|
||||
|
||||
module Hledger.Utils.IO (
|
||||
|
||||
@ -84,7 +84,9 @@ import System.IO
|
||||
(Handle, IOMode (..), hGetEncoding, hSetEncoding, hSetNewlineMode,
|
||||
openFile, stdin, stdout, stderr, universalNewlineMode, utf8_bom, hIsTerminalDevice)
|
||||
import System.IO.Unsafe (unsafePerformIO)
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Pager
|
||||
#endif
|
||||
import Text.Pretty.Simple
|
||||
(CheckColorTty(CheckColorTty), OutputOptions(..),
|
||||
defaultOutputOptionsDarkBg, defaultOutputOptionsNoColor, pShowOpt, pPrintOpt)
|
||||
@ -130,7 +132,12 @@ pprint' = pPrintOpt CheckColorTty prettyopts'
|
||||
pager :: String -> IO ()
|
||||
pager s = do
|
||||
dumbterm <- (== Just "dumb") <$> lookupEnv "TERM"
|
||||
(if dumbterm then putStrLn else printOrPage . pack) s
|
||||
#ifdef mingw32_HOST_OS
|
||||
putStrLn
|
||||
#else
|
||||
(if dumbterm then putStrLn else printOrPage . pack)
|
||||
#endif
|
||||
s
|
||||
|
||||
-- Command line arguments
|
||||
|
||||
|
||||
@ -59,7 +59,6 @@ dependencies:
|
||||
- microlens >=0.4
|
||||
- microlens-th >=0.4
|
||||
- mtl >=2.2.1
|
||||
- pager >=0.1.1.0
|
||||
- parser-combinators >=0.4.0
|
||||
- pretty-simple >4 && <5
|
||||
- regex-tdfa
|
||||
@ -78,10 +77,11 @@ dependencies:
|
||||
- utf8-string >=0.3.5
|
||||
- extra >=1.6.3
|
||||
- Glob >= 0.9
|
||||
# for ledger-parse:
|
||||
#- parsers >=0.5
|
||||
#- system-filepath
|
||||
#- trifecta >=0.91
|
||||
|
||||
when:
|
||||
- condition: (!(os(windows)))
|
||||
dependencies:
|
||||
- pager >=0.1.1.0
|
||||
|
||||
ghc-options:
|
||||
- -Wall
|
||||
|
||||
Loading…
Reference in New Issue
Block a user