drop the --options-anywhere flag, make it the default
Also drop support for ledger-2-style - and -- in account patterns. For the time being ^ and ^^ must be used.
This commit is contained in:
parent
a99457f2d4
commit
4037d56080
26
Options.hs
26
Options.hs
@ -38,7 +38,7 @@ usagehdr = printf (
|
|||||||
" happs - run a web server providing a minimal web ui\n" ++
|
" happs - run a web server providing a minimal web ui\n" ++
|
||||||
#endif
|
#endif
|
||||||
"\n" ++
|
"\n" ++
|
||||||
"Options (before command, unless using --options-anywhere):"
|
"Options:"
|
||||||
) progname timeprogname
|
) progname timeprogname
|
||||||
|
|
||||||
|
|
||||||
@ -47,13 +47,12 @@ usageftr = printf (
|
|||||||
"All dates can be y/m/d or ledger-style smart dates like \"last month\".\n" ++
|
"All dates can be y/m/d or ledger-style smart dates like \"last month\".\n" ++
|
||||||
"\n" ++
|
"\n" ++
|
||||||
"Account and description patterns are regular expressions which filter by\n" ++
|
"Account and description patterns are regular expressions which filter by\n" ++
|
||||||
"account name and entry description. Prefix a pattern with - to negate it,\n" ++
|
"account name and entry description. Prefix a pattern with ^ to negate it,\n" ++
|
||||||
"and separate account and description patterns with --.\n" ++
|
"and separate account and description patterns with ^^.\n" ++
|
||||||
"(With --options-anywhere, use ^ and ^^. \"%s\" implies --options-anywhere.)\n" ++
|
|
||||||
"\n" ++
|
"\n" ++
|
||||||
"Also: %s [-v] test [TESTPATTERNS] to run self-tests.\n" ++
|
"Also: %s [-v] test [TESTPATTERNS] to run self-tests.\n" ++
|
||||||
"\n"
|
"\n"
|
||||||
) timeprogname progname
|
) progname
|
||||||
|
|
||||||
usage = usageInfo usagehdr options ++ usageftr
|
usage = usageInfo usagehdr options ++ usageftr
|
||||||
|
|
||||||
@ -81,7 +80,6 @@ options = [
|
|||||||
,Option ['v'] ["verbose"] (NoArg Verbose) "verbose test output"
|
,Option ['v'] ["verbose"] (NoArg Verbose) "verbose test output"
|
||||||
,Option ['V'] ["version"] (NoArg Version) "show version"
|
,Option ['V'] ["version"] (NoArg Version) "show version"
|
||||||
,Option [] ["debug-no-ui"] (NoArg DebugNoUI) "run ui commands without no output"
|
,Option [] ["debug-no-ui"] (NoArg DebugNoUI) "run ui commands without no output"
|
||||||
,Option [] ["options-anywhere"] (NoArg OptionsAnywhere) "allow options anywhere on the command line"
|
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
filehelp = printf "ledger file; - means use standard input. Defaults\nto the %s environment variable or %s"
|
filehelp = printf "ledger file; - means use standard input. Defaults\nto the %s environment variable or %s"
|
||||||
@ -99,7 +97,6 @@ data Opt =
|
|||||||
Display {value::String} |
|
Display {value::String} |
|
||||||
Empty |
|
Empty |
|
||||||
Real |
|
Real |
|
||||||
OptionsAnywhere |
|
|
||||||
Collapse |
|
Collapse |
|
||||||
SubTotal |
|
SubTotal |
|
||||||
WeeklyOpt |
|
WeeklyOpt |
|
||||||
@ -130,10 +127,7 @@ parseArguments :: IO ([Opt], String, [String])
|
|||||||
parseArguments = do
|
parseArguments = do
|
||||||
args <- getArgs
|
args <- getArgs
|
||||||
istimequery <- usingTimeProgramName
|
istimequery <- usingTimeProgramName
|
||||||
let order = if "--options-anywhere" `elem` args || istimequery
|
let (os,as,es) = getOpt Permute options args
|
||||||
then Permute
|
|
||||||
else RequireOrder
|
|
||||||
let (os,as,es) = getOpt order options args
|
|
||||||
os' <- fixOptDates os
|
os' <- fixOptDates os
|
||||||
case istimequery of
|
case istimequery of
|
||||||
False ->
|
False ->
|
||||||
@ -239,14 +233,12 @@ tildeExpand xs = return xs
|
|||||||
|
|
||||||
-- | Gather any ledger-style account/description pattern arguments into
|
-- | Gather any ledger-style account/description pattern arguments into
|
||||||
-- two lists. These are 0 or more account patterns optionally followed by
|
-- two lists. These are 0 or more account patterns optionally followed by
|
||||||
-- a separator and then 0 or more description patterns. The separator is
|
-- a separator and then 0 or more description patterns. Each pattern may
|
||||||
-- usually -- but with --options-anywhere is ^^ so we need to provide the
|
-- have a negation prefix. The separator and negation prefix are, for now,
|
||||||
-- options as well.
|
-- ^^ and ^ .
|
||||||
parseAccountDescriptionArgs :: [Opt] -> [String] -> ([String],[String])
|
parseAccountDescriptionArgs :: [Opt] -> [String] -> ([String],[String])
|
||||||
parseAccountDescriptionArgs opts args = (as, ds')
|
parseAccountDescriptionArgs opts args = (as, ds')
|
||||||
where (as, ds) = break (==patseparator) args
|
where (as, ds) = break (==patseparator) args
|
||||||
ds' = dropWhile (==patseparator) ds
|
ds' = dropWhile (==patseparator) ds
|
||||||
patseparator = replicate 2 negchar
|
patseparator = replicate 2 negchar
|
||||||
negchar
|
negchar = '^'
|
||||||
| OptionsAnywhere `elem` opts = '^'
|
|
||||||
| otherwise = '-'
|
|
||||||
|
|||||||
14
README
14
README
@ -75,8 +75,8 @@ convenient querying::
|
|||||||
|
|
||||||
hours [OPTIONS] [PERIOD [COMMAND [PATTERNS]]]
|
hours [OPTIONS] [PERIOD [COMMAND [PATTERNS]]]
|
||||||
|
|
||||||
PERIOD and COMMAND default to "today" and "balance --subtotal"
|
PERIOD and COMMAND default to "today" and "balance --subtotal" respectively.
|
||||||
respectively, and --options-anywhere is assumed. Examples::
|
Examples::
|
||||||
|
|
||||||
hours # today's balances
|
hours # today's balances
|
||||||
hours today # the same
|
hours today # the same
|
||||||
@ -128,8 +128,6 @@ hledger-specific features are supported::
|
|||||||
ui,ansi interactive curses and ansi-based text uis
|
ui,ansi interactive curses and ansi-based text uis
|
||||||
happs rudimentary web interface on port 5000
|
happs rudimentary web interface on port 5000
|
||||||
--depth=N balance report: maximum account depth to show
|
--depth=N balance report: maximum account depth to show
|
||||||
--options-anywhere allow options anywhere, use ^ for negative patterns
|
|
||||||
easier time reporting with "hours" alias
|
|
||||||
|
|
||||||
ledger features not supported
|
ledger features not supported
|
||||||
.............................
|
.............................
|
||||||
@ -203,9 +201,11 @@ gnucash files, and the following options::
|
|||||||
Other differences
|
Other differences
|
||||||
.................
|
.................
|
||||||
|
|
||||||
* hledger keeps differently-priced amounts of the same commodity separate at the moment
|
* hledger accepts options anywhere on the command line. Instead of - and --
|
||||||
* hledger refers to the entry's and transaction's "description", ledger calls it "note"
|
for pattern negation and separation, use ^ and ^^.
|
||||||
* hledger doesn't require a space before command-line option values
|
* hledger always keeps differently-priced amounts of the same commodity separate
|
||||||
|
* hledger calls ledger's "note" field "description"
|
||||||
|
* hledger doesn't require a space before command-line option values, eg: -f-
|
||||||
* hledger provides "--cost" as a synonym for "--basis"
|
* hledger provides "--cost" as a synonym for "--basis"
|
||||||
* hledger's "weekly" reporting intervals always start on mondays
|
* hledger's "weekly" reporting intervals always start on mondays
|
||||||
* hledger shows start and end dates of full intervals, not just the span containing data
|
* hledger shows start and end dates of full intervals, not just the span containing data
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user