mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-28 04:46:31 +03:00
allow command-line options to be anywhere when negativepatternchar is something other than -
This commit is contained in:
parent
5fcab59414
commit
c404ae45d6
@ -3,12 +3,13 @@ where
|
||||
import System
|
||||
import System.Console.GetOpt
|
||||
import System.Directory
|
||||
|
||||
import Ledger.RawLedger (negativepatternchar)
|
||||
|
||||
usagehdr = "Usage: hledger [OPTIONS] "++commands++" [ACCTPATTERNS] [-- DESCPATTERNS]\nOptions:"
|
||||
commands = "register|balance|print"
|
||||
defaultfile = "~/.ledger"
|
||||
fileenvvar = "LEDGER"
|
||||
optionorder = if negativepatternchar=='-' then RequireOrder else Permute
|
||||
|
||||
-- | Command-line options we accept.
|
||||
options :: [OptDescr Opt]
|
||||
@ -40,7 +41,7 @@ version = "hledger version 0.1 alpha\n"
|
||||
parseArguments :: IO ([Opt], String, [String])
|
||||
parseArguments = do
|
||||
args <- getArgs
|
||||
case (getOpt RequireOrder options args) of
|
||||
case (getOpt optionorder options args) of
|
||||
(opts,cmd:args,[]) -> return (opts, cmd, args)
|
||||
(opts,[],[]) -> return ([Help], [], [])
|
||||
(_,_,errs) -> ioError (userError (concat errs ++ usage))
|
||||
|
Loading…
Reference in New Issue
Block a user