cli: rename --infer-value to --infer-market-price

For clarity; infer-value was too vague. The old spelling remains
supported for compatibility, but is now deprecated.
When typing, --infer-market or even --infer (for now) is sufficient.
This commit is contained in:
Simon Michael 2021-02-05 15:13:10 -08:00
parent 681965e2d4
commit 37e49ada70
9 changed files with 58 additions and 56 deletions

View File

@ -158,8 +158,8 @@ m4_define({{_reportingoptions_}}, {{
`--value`
: convert amounts to cost or market value, more flexibly than -B/-V/-X
`--infer-value`
: with -V/-X/--value, also infer market prices from transactions
`--infer-market-prices`
: use transaction prices (recorded with @ or @@) as additional market prices, as if they were P directives
`--auto`
: apply [automated posting rules](hledger.html#auto-postings) to modify transactions.

View File

@ -365,7 +365,7 @@ prefix l = if null l then (""++) else ((l++": ")++)
--
-- 1. A *declared market price* or *inferred market price*:
-- A's latest market price in B on or before the valuation date
-- as declared by a P directive, or (with the `--infer-value` flag)
-- as declared by a P directive, or (with the `--infer-market-price` flag)
-- inferred from transaction prices.
--
-- 2. A *reverse market price*:
@ -390,7 +390,7 @@ prefix l = if null l then (""++) else ((l++": ")++)
-- prices before the valuation date.)
--
-- 3. If there are no P directives at all (any commodity or date), and
-- the `--infer-value` flag is used, then the price commodity from
-- the `--infer-market-price` flag is used, then the price commodity from
-- the latest transaction price for A on or before valuation date."
--
makePriceGraph :: [MarketPrice] -> [MarketPrice] -> Day -> PriceGraph
@ -429,7 +429,7 @@ makePriceGraph alldeclaredprices allinferredprices d =
where
ps | not $ null visibledeclaredprices = visibledeclaredprices
| not $ null alldeclaredprices = alldeclaredprices
| otherwise = visibleinferredprices -- will be null without --infer-value
| otherwise = visibleinferredprices -- will be null without --infer-market-price
-- | Given a list of P-declared market prices in parse order and a
-- list of transaction-inferred market prices in parse order, select

View File

@ -185,7 +185,7 @@ rawOptsToReportOpts rawopts = do
,statuses_ = statusesFromRawOpts rawopts
,cost_ = costing
,value_ = valuation
,infer_value_ = boolopt "infer-value" rawopts
,infer_value_ = boolopt "infer-market-price" rawopts
,depth_ = maybeposintopt "depth" rawopts
,date2_ = boolopt "date2" rawopts
,empty_ = boolopt "empty" rawopts

View File

@ -176,7 +176,9 @@ reportflags = [
,"'now': convert to current market value, in default valuation commodity or COMM"
,"YYYY-MM-DD: convert to market value on the given date, in default valuation commodity or COMM"
])
,flagNone ["infer-value"] (setboolopt "infer-value") "with -V/-X/--value, also infer market prices from transactions"
-- XXX infer-value renamed to infer-market-price and deprecated 2021-02
,flagNone ["infer-market-price","infer-value"] (setboolopt "infer-market-price")
"use transaction prices (recorded with @ or @@) as additional market prices, as if they were P directives"
-- generated postings/transactions
,flagNone ["auto"] (setboolopt "auto") "apply automated posting rules to modify transactions"

View File

@ -273,7 +273,7 @@ unMix a =
Just a -> aquantity a
Nothing -> error' $ "Amounts could not be converted to a single cost basis: " ++ show (map showAmount $ amounts a) ++
"\nConsider using --value to force all costs to be in a single commodity." ++
"\nFor example, \"--cost --value=end,<commodity> --infer-value\", where commodity is the one that was used to pay for the investment."
"\nFor example, \"--cost --value=end,<commodity> --infer-market-price\", where commodity is the one that was used to pay for the investment."
-- Show Decimal rounded to two decimal places, unless it has less places already. This ensures that "2" won't be shown as "2.00"
showDecimal :: Decimal -> String

View File

@ -769,7 +769,7 @@ in this order of preference
1. A *declared market price* or *inferred market price*:
A's latest market price in B on or before the valuation date
as declared by a [P directive](hledger.html#declaring-market-prices),
or (with the `--infer-value` flag)
or (with the `--infer-market-price` flag)
inferred from [transaction prices](hledger.html#transaction-prices).
<!-- (Latest by date, then parse order.) -->
<!-- (A declared price overrides an inferred price on the same date.) -->
@ -792,7 +792,7 @@ visible in `--debug=2` output). That limit is currently 1000.
Amounts for which no suitable market price can be found, are not converted.
## --infer-value: market prices from transactions
## --infer-market-price: market prices from transactions
Normally, market value in hledger is fully controlled by, and requires,
[P directives](hledger.html#declaring-market-prices) in your journal.
@ -802,8 +802,8 @@ why not use the recorded [transaction prices](hledger.html#transaction-prices)
as additional market prices (as Ledger does) ?
We could produce value reports without needing P directives at all.
Adding the `--infer-value` flag to `-V`, `-X` or `--value` enables
this. So for example, `hledger bs -V --infer-value` will get market
Adding the `--infer-market-price` flag to `-V`, `-X` or `--value` enables
this. So for example, `hledger bs -V --infer-market-price` will get market
prices both from P directives and from transactions.
There is a downside: value reports can sometimes be affected in
@ -811,7 +811,7 @@ confusing/undesired ways by your journal entries. If this happens to
you, read all of this [Valuation](#valuation) section carefully,
and try adding `--debug` or `--debug=2` to troubleshoot.
`--infer-value` can infer market prices from:
`--infer-market-price` can infer market prices from:
- multicommodity transactions with explicit prices (`@`/`@@`)
@ -840,7 +840,7 @@ follows, in this order of preference:
prices before the valuation date.)
3. If there are no P directives at all (any commodity or date) and the
`--infer-value` flag is used: the price commodity from the latest
`--infer-market-price` flag is used: the price commodity from the latest
transaction-inferred price for A on or before valuation date.
This means:
@ -848,7 +848,7 @@ This means:
- If you have [P directives](hledger.html#declaring-market-prices),
they determine which commodities `-V` will convert, and to what.
- If you have no P directives, and use the `--infer-value` flag,
- If you have no P directives, and use the `--infer-market-price` flag,
[transaction prices](hledger.html#transaction-prices) determine it.
Amounts for which no valuation commodity can be found are not converted.

View File

@ -232,9 +232,9 @@ $ hledger -f- bal -N -V -e 2002-01-01
$ hledger -f- bal -N -V
1 A a
# 23. Market price is inferred from transactions with --infer-value,
# 23. Market price is inferred from transactions with --infer-market-price,
# and -V can work with no P directives.
$ hledger -f- bal -N -V --infer-value
$ hledger -f- bal -N -V --infer-market-price
B2 a
# 24. A P-declared market price on the same date as a transaction price has precedence.
@ -244,7 +244,7 @@ P 2020-01-01 A 1 B
2020-01-01
(a) 1 A @ 2 B
$ hledger -f- bal -N -V --infer-value
$ hledger -f- bal -N -V --infer-market-price
1 B a
# 25. A transaction-inferred price newer than a P-declared price has precedence.
@ -254,7 +254,7 @@ P 2020-01-01 A 1 B
2020-01-02
(a) 1 A @ 2 B
$ hledger -f- bal -N -V --infer-value
$ hledger -f- bal -N -V --infer-market-price
2 B a
# 26. A later-dated P directive sets the valuation commodity even if parsed out of order.
@ -275,7 +275,7 @@ $ hledger -f- bal -N -V
(a) 1 A @ 1 D ; date: 2020-01-02
(a) 1 A @ 1 B
$ hledger -f- bal -N -V --infer-value
$ hledger -f- bal -N -V --infer-market-price
D3 a
# 28. #1402 It should pick the direct (forward) A 3.00 price for B here,

View File

@ -240,11 +240,11 @@ hledger -f- roi -p 2019-11 --inv Investment --pnl PnL
>>>2
hledger: Amounts could not be converted to a single cost basis: ["10 B","-10 B @@ 100 A"]
Consider using --value to force all costs to be in a single commodity.
For example, "--cost --value=end,<commodity> --infer-value", where commodity is the one that was used to pay for the investment.
For example, "--cost --value=end,<commodity> --infer-market-price", where commodity is the one that was used to pay for the investment.
>>>=1
# 10. Forcing valuation via --value
hledger -f- roi -p 2019-11 --inv Investment --pnl PnL --cost --value=then,A --infer-value
hledger -f- roi -p 2019-11 --inv Investment --pnl PnL --cost --value=then,A --infer-market-price
<<<
2019/11/01 Example
Assets:Checking -100 A

View File

@ -199,7 +199,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/generic-options.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -276,7 +276,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-import.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--new
@ -334,7 +334,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-check-dates.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -391,7 +391,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-check-dupes.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -451,7 +451,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-close.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--interleaved
--market
--monthly
@ -532,7 +532,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-rewrite.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -590,7 +590,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-aregister.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--no-elide
@ -662,7 +662,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-balancesheet.txt"
--help
--historical
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--no-elide
@ -742,7 +742,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-balancesheetequity.txt"
--help
--historical
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--no-elide
@ -822,7 +822,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-cashflow.txt"
--help
--historical
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--no-elide
@ -902,7 +902,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-incomestatement.txt"
--help
--historical
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--no-elide
@ -976,7 +976,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-roi.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--inv
--investment
--market
@ -1038,7 +1038,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-accounts.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -1098,7 +1098,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-activity.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -1163,7 +1163,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-balance.txt"
--help
--historical
--ignore-assertions
--infer-value
--infer-market-price
--invert
--market
--monthly
@ -1239,7 +1239,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-codes.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -1310,7 +1310,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-descriptions.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -1381,7 +1381,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-notes.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -1437,7 +1437,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-payees.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -1494,7 +1494,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-prices.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--inverted-costs
--market
--monthly
@ -1552,7 +1552,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-print.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--match
--monthly
@ -1616,7 +1616,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-print-unique.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -1675,7 +1675,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-register.txt"
--help
--historical
--ignore-assertions
--infer-value
--infer-market-price
--invert
--market
--monthly
@ -1742,7 +1742,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-register-match.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -1798,7 +1798,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-stats.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--output-file
@ -1856,7 +1856,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-tags.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--parsed
@ -1936,7 +1936,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-equity.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--interleaved
--market
--monthly
@ -2000,7 +2000,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-areg.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--no-elide
@ -2072,7 +2072,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-bs.txt"
--help
--historical
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--no-elide
@ -2152,7 +2152,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-bse.txt"
--help
--historical
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--no-elide
@ -2232,7 +2232,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-cf.txt"
--help
--historical
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--no-elide
@ -2312,7 +2312,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-is.txt"
--help
--historical
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--no-elide
@ -2387,7 +2387,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-ui.txt"
--forecast
--help
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending
@ -2455,7 +2455,7 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/options-web.txt"
--help
--host
--ignore-assertions
--infer-value
--infer-market-price
--market
--monthly
--pending