;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 -- XXX some refactoring seems due
getHledgerUIOpts :: IO UIOpts getHledgerUIOpts :: IO UIOpts
--getHledgerUIOpts = processArgs uimode >>= return . decodeRawOpts >>= rawOptsToUIOpts --getHledgerUIOpts = processArgs uimode >>= return >>= rawOptsToUIOpts
getHledgerUIOpts = do getHledgerUIOpts = do
args <- getArgs >>= expandArgsAt args <- getArgs >>= expandArgsAt
let args' = replaceNumericFlags args let args' = replaceNumericFlags args
let cmdargopts = either usageError id $ process uimode 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 :: IO WebOpts
getHledgerWebOpts = do getHledgerWebOpts = do
args <- fmap replaceNumericFlags . expandArgsAt =<< getArgs args <- fmap replaceNumericFlags . expandArgsAt =<< getArgs
rawOptsToWebOpts . decodeRawOpts . either usageError id $ process webmode args rawOptsToWebOpts . either usageError id $ process webmode args
data Capability data Capability
= CapView = CapView

View File

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

View File

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