diff --git a/doc/manual.md b/doc/manual.md index 88d3fbb3e..4cce3711b 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -46,10 +46,14 @@ in your home directory. You can specify a different file with the `-f` option or `LEDGER_FILE` environment variable, or standard input with `-f-`. Options are similar across most commands, with some variations; use -`hledger COMMAND --help` for details. Most options must appear -somewhere after COMMAND, not before it. These input and help-related -options can appear anywhere: `-f`, `--rules-file`, `--alias`, -`--ignore-assertions`, `--help`, `--debug`, `--version`. +`hledger COMMAND --help` for details. + +Most options must appear after COMMAND, not before it; but the +following general options can appear anywhere: `-f`, `--rules-file`, +`--alias`, `--ignore-assertions`, `--help`, `--debug`, `--version`. + +If an option is repeated, the last one takes precedence. Eg `-p jan -p +feb` is equivalent to `-p feb`. Arguments are also command-specific, but usually they form a [query](#queries) which selects a subset of the journal, eg transactions diff --git a/hledger-lib/Hledger/Data/RawOptions.hs b/hledger-lib/Hledger/Data/RawOptions.hs index 33b4c77fc..0d9f3b5a0 100644 --- a/hledger-lib/Hledger/Data/RawOptions.hs +++ b/hledger-lib/Hledger/Data/RawOptions.hs @@ -45,7 +45,7 @@ boolopt :: String -> RawOpts -> Bool boolopt = inRawOpts maybestringopt :: String -> RawOpts -> Maybe String -maybestringopt name = maybe Nothing (Just . stripquotes) . lookup name +maybestringopt name = maybe Nothing (Just . stripquotes) . lookup name . reverse stringopt :: String -> RawOpts -> String stringopt name = fromMaybe "" . maybestringopt name