Implement getScreenDimensions
This commit is contained in:
parent
5c113326e7
commit
48f054df37
1 changed files with 7 additions and 0 deletions
|
|
@ -4,6 +4,8 @@ module HCat.Internal where
|
|||
import Data.Text (Text)
|
||||
import Data.Text qualified as T
|
||||
|
||||
import System.Process qualified as P
|
||||
|
||||
-- | @parseArgs@ takes a list of strings and returns a single FilePath if there was exactly one element.
|
||||
--
|
||||
-- >>> parseArgs ["foo"]
|
||||
|
|
@ -67,3 +69,8 @@ paginate (ScreenDimensions rows cols) =
|
|||
|
||||
type Pages = [Page]
|
||||
type Page = Text
|
||||
|
||||
getScreenDimensions :: IO ScreenDimensions
|
||||
getScreenDimensions = ScreenDimensions <$> tput "lines" <*> tput "cols"
|
||||
where
|
||||
tput cmd = read <$> P.readProcess "tput" [cmd] ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue