rename/update doc

This commit is contained in:
Simon Michael 2011-09-23 14:09:12 +00:00
parent c9f1f5c663
commit 17b1fcefed

View File

@ -318,7 +318,7 @@ toCliOpts rawopts = do
getHledgerCliOpts :: [String] -> IO CliOpts
getHledgerCliOpts addons = do
args <- getArgs
toCliOpts (decodeRawOpts $ processValue (mainmode addons) $ moveFileOption args) >>= checkCliOpts
toCliOpts (decodeRawOpts $ processValue (mainmode addons) $ rearrangeForCmdArgs args) >>= checkCliOpts
-- utils
@ -344,12 +344,12 @@ getDirectoryContentsSafe d = getDirectoryContents d `catch` (\_ -> return [])
-- | Convert possibly encoded option values to regular unicode strings.
decodeRawOpts = map (\(name,val) -> (name, fromPlatformString val))
-- A workaround related to http://code.google.com/p/ndmitchell/issues/detail?id=457 :
-- we'd like to permit options before COMMAND as well as after it. Here we
-- make sure at least -f FILE will be accepted in either position.
moveFileOption (fopt@('-':'f':_:_):cmd:rest) = cmd:fopt:rest
moveFileOption ("-f":fval:cmd:rest) = cmd:"-f":fval:rest
moveFileOption as = as
-- A hacky workaround for http://code.google.com/p/ndmitchell/issues/detail?id=470 :
-- we'd like to permit options before COMMAND as well as after it.
-- Here we make sure at least -f FILE will be accepted in either position.
rearrangeForCmdArgs (fopt@('-':'f':_:_):cmd:rest) = cmd:fopt:rest
rearrangeForCmdArgs ("-f":fval:cmd:rest) = cmd:"-f":fval:rest
rearrangeForCmdArgs as = as
optserror = error' . (++ " (run with --help for usage)")