mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-21 03:08:10 +03:00
Parsing of separator
This commit is contained in:
parent
f7a61737f1
commit
4fc2374b2b
@ -17,7 +17,8 @@ module Hledger.Data.RawOptions (
|
||||
maybestringopt,
|
||||
listofstringopt,
|
||||
intopt,
|
||||
maybeintopt
|
||||
maybeintopt,
|
||||
maybecharopt
|
||||
)
|
||||
where
|
||||
|
||||
@ -50,6 +51,9 @@ maybestringopt name = maybe Nothing (Just . T.unpack . stripquotes . T.pack) . l
|
||||
stringopt :: String -> RawOpts -> String
|
||||
stringopt name = fromMaybe "" . maybestringopt name
|
||||
|
||||
maybecharopt :: String -> RawOpts -> Maybe Char
|
||||
maybecharopt name rawopts = lookup name rawopts >>= readMay
|
||||
|
||||
listofstringopt :: String -> RawOpts -> [String]
|
||||
listofstringopt name rawopts = [v | (k,v) <- rawopts, k==name]
|
||||
|
||||
|
@ -178,7 +178,7 @@ rawOptsToInputOpts rawopts = InputOpts{
|
||||
-- files_ = map (T.unpack . stripquotes . T.pack) $ listofstringopt "file" rawopts
|
||||
mformat_ = Nothing
|
||||
,mrules_file_ = maybestringopt "rules-file" rawopts
|
||||
,separator_ = ','
|
||||
,separator_ = fromMaybe ',' (maybecharopt "separator" rawopts)
|
||||
,aliases_ = map (T.unpack . stripquotes . T.pack) $ listofstringopt "alias" rawopts
|
||||
,anon_ = boolopt "anon" rawopts
|
||||
,ignore_assertions_ = boolopt "ignore-assertions" rawopts
|
||||
|
Loading…
Reference in New Issue
Block a user