doc: expand period expressions, rename "report interval"
This commit is contained in:
parent
3c724efe4f
commit
985ca50814
@ -177,7 +177,7 @@ tests_summarisePostingsByInterval = [
|
|||||||
-- interval's end date attached with a tuple.
|
-- interval's end date attached with a tuple.
|
||||||
type SummaryPosting = (Posting, Maybe Day)
|
type SummaryPosting = (Posting, Maybe Day)
|
||||||
|
|
||||||
-- | Given a date span (representing a reporting interval) and a list of
|
-- | Given a date span (representing a report interval) and a list of
|
||||||
-- postings within it, aggregate the postings into one summary posting per
|
-- postings within it, aggregate the postings into one summary posting per
|
||||||
-- account.
|
-- account.
|
||||||
--
|
--
|
||||||
|
|||||||
@ -9,7 +9,7 @@ Here is a description/specification for the balance command. See also
|
|||||||
|
|
||||||
/Basic balance report/
|
/Basic balance report/
|
||||||
|
|
||||||
With no reporting interval (@--monthly@ etc.), hledger's balance
|
With no report interval (@--monthly@ etc.), hledger's balance
|
||||||
command emulates ledger's, showing accounts indented according to
|
command emulates ledger's, showing accounts indented according to
|
||||||
hierarchy, along with their total amount posted (including subaccounts).
|
hierarchy, along with their total amount posted (including subaccounts).
|
||||||
|
|
||||||
|
|||||||
@ -133,7 +133,7 @@ reportflags = [
|
|||||||
,flagNone ["monthly","M"] (setboolopt "monthly") "multiperiod/multicolumn report by month"
|
,flagNone ["monthly","M"] (setboolopt "monthly") "multiperiod/multicolumn report by month"
|
||||||
,flagNone ["quarterly","Q"] (setboolopt "quarterly") "multiperiod/multicolumn report by quarter"
|
,flagNone ["quarterly","Q"] (setboolopt "quarterly") "multiperiod/multicolumn report by quarter"
|
||||||
,flagNone ["yearly","Y"] (setboolopt "yearly") "multiperiod/multicolumn report by year"
|
,flagNone ["yearly","Y"] (setboolopt "yearly") "multiperiod/multicolumn report by year"
|
||||||
,flagReq ["period","p"] (\s opts -> Right $ setopt "period" s opts) "PERIODEXP" "set start date, end date, and/or reporting interval all at once (overrides the flags above)"
|
,flagReq ["period","p"] (\s opts -> Right $ setopt "period" s opts) "PERIODEXP" "set start date, end date, and/or report interval all at once (overrides the flags above)"
|
||||||
,flagNone ["date2"] (setboolopt "date2") "show, and make -b/-e/-p/date: match, secondary dates instead"
|
,flagNone ["date2"] (setboolopt "date2") "show, and make -b/-e/-p/date: match, secondary dates instead"
|
||||||
|
|
||||||
,flagNone ["cleared","C"] (setboolopt "cleared") "include only cleared postings/txns"
|
,flagNone ["cleared","C"] (setboolopt "cleared") "include only cleared postings/txns"
|
||||||
|
|||||||
@ -33,7 +33,7 @@ activitymode = (defCommandMode $ ["activity"] ++ aliases) {
|
|||||||
barchar :: Char
|
barchar :: Char
|
||||||
barchar = '*'
|
barchar = '*'
|
||||||
|
|
||||||
-- | Print a histogram of some statistic per reporting interval, such as
|
-- | Print a histogram of some statistic per report interval, such as
|
||||||
-- number of postings per day.
|
-- number of postings per day.
|
||||||
histogram :: CliOpts -> Journal -> IO ()
|
histogram :: CliOpts -> Journal -> IO ()
|
||||||
histogram CliOpts{reportopts_=ropts} j = do
|
histogram CliOpts{reportopts_=ropts} j = do
|
||||||
|
|||||||
@ -111,7 +111,7 @@ tests_postingsReportAsText = [
|
|||||||
-- If description's width is specified, account will use the remaining space.
|
-- If description's width is specified, account will use the remaining space.
|
||||||
-- Otherwise, description and account divide up the space equally.
|
-- Otherwise, description and account divide up the space equally.
|
||||||
--
|
--
|
||||||
-- With a reporting interval, the layout is like so:
|
-- With a report interval, the layout is like so:
|
||||||
-- @
|
-- @
|
||||||
-- <---------------- width (specified, terminal width, or 80) -------------------->
|
-- <---------------- width (specified, terminal width, or 80) -------------------->
|
||||||
-- date (21) account amount (12) balance (12)
|
-- date (21) account amount (12) balance (12)
|
||||||
|
|||||||
@ -101,11 +101,11 @@ Examples:
|
|||||||
`today`, `yesterday`, `tomorrow`
|
`today`, `yesterday`, `tomorrow`
|
||||||
---
|
---
|
||||||
|
|
||||||
## Reporting interval
|
## Report interval
|
||||||
|
|
||||||
A reporting interval can be specified so that commands like
|
A report interval can be specified so that commands like
|
||||||
[register](#register), [balance](#balance) and [activity](#activity) will divide their
|
[register](#register), [balance](#balance) and [activity](#activity) will divide their
|
||||||
reports into multiple report periods. The basic intervals can be
|
reports into multiple subperiods. The basic intervals can be
|
||||||
selected with one of `-D/--daily`, `-W/--weekly`, `-M/--monthly`,
|
selected with one of `-D/--daily`, `-W/--weekly`, `-M/--monthly`,
|
||||||
`-Q/--quarterly`, or `-Y/--yearly`. More complex intervals may be
|
`-Q/--quarterly`, or `-Y/--yearly`. More complex intervals may be
|
||||||
specified with a period expression.
|
specified with a period expression.
|
||||||
@ -113,11 +113,9 @@ specified with a period expression.
|
|||||||
## Period expressions
|
## Period expressions
|
||||||
|
|
||||||
The `-p/--period` option accepts period expressions, a shorthand way
|
The `-p/--period` option accepts period expressions, a shorthand way
|
||||||
of expressing a start date, end date, and or reporting interval all at
|
of expressing a start date, end date, and/or report interval all at
|
||||||
once. Note a period expression on the command line will cause any other date
|
once.
|
||||||
flags (`-b`/`-e`/`-D`/`-W`/`-M`/`-Q`/`-Y`) to be ignored.
|
|
||||||
|
|
||||||
hledger's period expressions are similar to Ledger's, though not identical.
|
|
||||||
Here's a basic period expression specifying the first quarter of 2009. Note,
|
Here's a basic period expression specifying the first quarter of 2009. Note,
|
||||||
hledger always treats start dates as inclusive and end dates as exclusive:
|
hledger always treats start dates as inclusive and end dates as exclusive:
|
||||||
|
|
||||||
@ -161,23 +159,41 @@ like so:
|
|||||||
`-p "2009/1/1"` just that day; equivalent to "2009/1/1 to 2009/1/2"
|
`-p "2009/1/1"` just that day; equivalent to "2009/1/1 to 2009/1/2"
|
||||||
--------------------- ------------------------------------------------------
|
--------------------- ------------------------------------------------------
|
||||||
|
|
||||||
Period expressions can also start with (or be) a reporting interval:
|
The argument of `-p` can also begin with, or be, a [report interval](#report-interval) expression.
|
||||||
`daily`, `weekly`, `monthly`, `quarterly`, `yearly`, or one of the
|
The basic report intervals are `daily`, `weekly`, `monthly`, `quarterly`, or `yearly`,
|
||||||
`every ...` expressions below. Optionally the word `in` may appear
|
which have the same effect as the `-D`,`-W`,`-M`,`-Q`, or `-Y` flags.
|
||||||
between the reporting interval and the start/end dates.
|
Between report interval and start/end dates (if any), the word `in` is optional.
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
`-p "weekly from 2009/1/1 to 2009/4/1"`
|
`-p "weekly from 2009/1/1 to 2009/4/1"`
|
||||||
`-p "monthly in 2008"`
|
`-p "monthly in 2008"`
|
||||||
`-p "bimonthly from 2008"`
|
|
||||||
`-p "quarterly"`
|
`-p "quarterly"`
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
The following more complex report intervals are also supported:
|
||||||
|
`biweekly`,
|
||||||
|
`bimonthly`,
|
||||||
|
`every N days|weeks|months|quarters|years`,
|
||||||
|
`every Nth day [of month]`,
|
||||||
|
`every Nth day of week`.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
`-p "bimonthly from 2008"`
|
||||||
`-p "every 2 weeks"`
|
`-p "every 2 weeks"`
|
||||||
`-p "every 5 days from 1/3"`
|
`-p "every 5 days from 1/3"`
|
||||||
`-p "every 15th day of month"`
|
|
||||||
`-p "every 4th day of week"`
|
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
|
|
||||||
|
Show historical balances at end of 15th each month (N is exclusive end date):
|
||||||
|
|
||||||
|
`hledger balance -H -p "every 16th day"`
|
||||||
|
|
||||||
|
Group postings from start of wednesday to end of next tuesday (N is start date and exclusive end date):
|
||||||
|
|
||||||
|
`hledger register checking -p "every 3rd day of week"`
|
||||||
|
|
||||||
## Regular Expressions
|
## Regular Expressions
|
||||||
|
|
||||||
hledger uses [regular expressions](http://www.regular-expressions.info) in a number of places:
|
hledger uses [regular expressions](http://www.regular-expressions.info) in a number of places:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user