;all: drop dummy decodeRawOpts

This commit is contained in:
Mykola Orliuk 2019-10-20 00:30:10 +02:00 committed by Simon Michael
parent 31ae3d3aaf
commit 8991419c68
4 changed files with 5 additions and 11 deletions

View File

@ -106,10 +106,10 @@ checkUIOpts opts =
-- XXX some refactoring seems due
getHledgerUIOpts :: IO UIOpts
--getHledgerUIOpts = processArgs uimode >>= return . decodeRawOpts >>= rawOptsToUIOpts
--getHledgerUIOpts = processArgs uimode >>= return >>= rawOptsToUIOpts
getHledgerUIOpts = do
args <- getArgs >>= expandArgsAt
let args' = replaceNumericFlags args
let cmdargopts = either usageError id $ process uimode args'
rawOptsToUIOpts $ decodeRawOpts cmdargopts
rawOptsToUIOpts cmdargopts

View File

@ -157,7 +157,7 @@ checkWebOpts wopts = do
getHledgerWebOpts :: IO WebOpts
getHledgerWebOpts = do
args <- fmap replaceNumericFlags . expandArgsAt =<< getArgs
rawOptsToWebOpts . decodeRawOpts . either usageError id $ process webmode args
rawOptsToWebOpts . either usageError id $ process webmode args
data Capability
= CapView

View File

@ -35,7 +35,6 @@ module Hledger.Cli.CliOptions (
CliOpts(..),
defcliopts,
getHledgerCliOpts,
decodeRawOpts,
rawOptsToCliOpts,
checkCliOpts,
outputFormats,
@ -394,10 +393,6 @@ defcliopts = CliOpts
def
defaultWidth
-- | Convert possibly encoded option values to regular unicode strings.
decodeRawOpts :: RawOpts -> RawOpts
decodeRawOpts = id -- TODO: drop usage of this
-- | Default width for hledger console output, when not otherwise specified.
defaultWidth :: Int
defaultWidth = 80
@ -477,7 +472,7 @@ checkCliOpts opts =
getHledgerCliOpts :: Mode RawOpts -> IO CliOpts
getHledgerCliOpts mode' = do
args' <- getArgs >>= expandArgsAt
let rawopts = either usageError decodeRawOpts $ process mode' args'
let rawopts = either usageError id $ process mode' args'
opts <- rawOptsToCliOpts rawopts
debugArgs args' opts
when ("help" `inRawOpts` rawopts_ opts) $ putStr shorthelp >> exitSuccess

View File

@ -207,8 +207,7 @@ argsToCliOpts args addons = do
let
args' = moveFlagsAfterCommand $ replaceNumericFlags args
cmdargsopts = either usageError id $ C.process (mainmode addons) args'
cmdargsopts' = decodeRawOpts cmdargsopts
rawOptsToCliOpts cmdargsopts'
rawOptsToCliOpts cmdargsopts
-- | A hacky workaround for cmdargs not accepting flags before the
-- subcommand name: try to detect and move such flags after the