lib: drop unused widthFromOpts

This commit is contained in:
Simon Michael 2023-01-10 17:07:19 -10:00
parent 18f264595b
commit 5c289ac92e

View File

@ -58,7 +58,7 @@ module Hledger.Cli.CliOptions (
outputFileFromOpts, outputFileFromOpts,
outputFormatFromOpts, outputFormatFromOpts,
defaultWidth, defaultWidth,
widthFromOpts, -- widthFromOpts,
replaceNumericFlags, replaceNumericFlags,
-- | For register: -- | For register:
registerWidthsFromOpts, registerWidthsFromOpts,
@ -78,7 +78,6 @@ import Control.Monad (when)
import Data.Char import Data.Char
import Data.Default import Data.Default
import Data.Either (fromRight, isRight) import Data.Either (fromRight, isRight)
import Data.Functor.Identity (Identity)
import Data.List.Extra (groupSortOn, intercalate, isInfixOf, nubSort) import Data.List.Extra (groupSortOn, intercalate, isInfixOf, nubSort)
import Data.List.Split (splitOneOf) import Data.List.Split (splitOneOf)
import Data.Maybe import Data.Maybe
@ -637,16 +636,16 @@ rulesFilePathFromOpts opts = do
d <- getCurrentDirectory d <- getCurrentDirectory
maybe (return Nothing) (fmap Just . expandPath d) $ mrules_file_ $ inputopts_ opts maybe (return Nothing) (fmap Just . expandPath d) $ mrules_file_ $ inputopts_ opts
-- | Get the width in characters to use for console output. -- -- | Get the width in characters to use for console output.
-- This comes from the --width option, or the COLUMNS environment -- -- This comes from the --width option, or the COLUMNS environment
-- variable, or (on posix platforms) the current terminal width, or 80. -- -- variable, or (on posix platforms) the current terminal width, or 80.
-- Will raise a parse error for a malformed --width argument. -- -- Will raise a parse error for a malformed --width argument.
widthFromOpts :: CliOpts -> Int -- widthFromOpts :: CliOpts -> Int
widthFromOpts CliOpts{width_=Nothing, available_width_=w} = w -- widthFromOpts CliOpts{width_=Nothing, available_width_=w} = w
widthFromOpts CliOpts{width_=Just s} = -- widthFromOpts CliOpts{width_=Just s} =
case runParser (read `fmap` some digitChar <* eof :: ParsecT Void String Identity Int) "(unknown)" s of -- case runParser (read `fmap` some digitChar <* eof :: ParsecT Void String Identity Int) "(unknown)" s of
Left e -> usageError $ "could not parse width option: "++show e -- Left e -> usageError $ "could not parse width option: "++errorBundlePretty e
Right w -> w -- Right w -> w
-- for register: -- for register: