treat arguments as possibly-encoded platform strings, not unconditionally utf-8

This commit is contained in:
Simon Michael 2011-01-21 01:16:55 +00:00
parent 6a845eb5e4
commit 6208ed017b

View File

@ -4,7 +4,6 @@ Command-line options for the application.
module Hledger.Cli.Options module Hledger.Cli.Options
where where
import Codec.Binary.UTF8.String (decodeString)
import System.Console.GetOpt import System.Console.GetOpt
import System.Environment import System.Environment
@ -147,7 +146,7 @@ optValuesForConstructors fs opts = concatMap get opts
-- provided usage string. -- provided usage string.
parseArgumentsWith :: [OptDescr Opt] -> IO ([Opt], [String]) parseArgumentsWith :: [OptDescr Opt] -> IO ([Opt], [String])
parseArgumentsWith options = do parseArgumentsWith options = do
rawargs <- map decodeString `fmap` getArgs rawargs <- map fromPlatformString `fmap` getArgs
let (opts,args,errs) = getOpt Permute options rawargs let (opts,args,errs) = getOpt Permute options rawargs
opts' <- fixOptDates opts opts' <- fixOptDates opts
let opts'' = if Debug `elem` opts' then Verbose:opts' else opts' let opts'' = if Debug `elem` opts' then Verbose:opts' else opts'