imp: cli: --infer-market-price renamed to --infer-market-prices

It was too easy to get this wrong, even some of the docs did.
Now either plural or singular spelling works
(since we accept flag prefixes).
This commit is contained in:
Simon Michael 2021-09-09 12:01:39 -10:00
parent c784cf4a38
commit daa9fddec9
8 changed files with 57 additions and 56 deletions

View File

@ -378,7 +378,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-market-price` flag)
-- as declared by a P directive, or (with the `--infer-market-prices` flag)
-- inferred from transaction prices.
--
-- 2. A *reverse market price*:
@ -403,7 +403,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-market-price` flag is used, then the price commodity from
-- the `--infer-market-prices` flag is used, then the price commodity from
-- the latest transaction price for A on or before valuation date."
--
makePriceGraph :: [MarketPrice] -> [MarketPrice] -> Day -> PriceGraph
@ -442,7 +442,7 @@ makePriceGraph alldeclaredprices allinferredprices d =
where
ps | not $ null visibledeclaredprices = visibledeclaredprices
| not $ null alldeclaredprices = alldeclaredprices
| otherwise = visibleinferredprices -- will be null without --infer-market-price
| otherwise = visibleinferredprices -- will be null without --infer-market-prices
-- | 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

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

View File

@ -188,7 +188,8 @@ reportflags = [
-- originally --infer-value
-- 2021-02, --infer-market-price added, --infer-value deprecated
-- 2021-09, --infer-value hidden
,flagNone ["infer-market-price"] (setboolopt "infer-market-price")
-- --infer-market-price renamed to --infer-market-prices, old spelling still works
,flagNone ["infer-market-prices"] (setboolopt "infer-market-prices")
"use transaction prices (recorded with @ or @@) as additional market prices, as if they were P directives"
-- generated postings/transactions
@ -229,7 +230,7 @@ flattreeflags showamounthelp = [
hiddenflags :: [Flag RawOpts]
hiddenflags = [
flagNone ["effective","aux-date"] (setboolopt "date2") "Ledger-compatible aliases for --date2"
,flagNone ["infer-value"] (setboolopt "infer-market-price") "legacy flag that was renamed"
,flagNone ["infer-value"] (setboolopt "infer-market-prices") "legacy flag that was renamed"
]
-- | Common output-related flags: --output-file, --output-format...

View File

@ -303,7 +303,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-market-price\", where commodity is the one that was used to pay for the investment."
"\nFor example, \"--cost --value=end,<commodity> --infer-market-prices\", 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

@ -968,7 +968,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](#declaring-market-prices),
or (with the `--infer-market-price` flag)
or (with the `--infer-market-prices` flag)
inferred from [transaction prices](#transaction-prices).
<!-- (Latest by date, then parse order.) -->
<!-- (A declared price overrides an inferred price on the same date.) -->
@ -991,7 +991,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-market-price: market prices from transactions
## --infer-market-prices: market prices from transactions
Normally, market value in hledger is fully controlled by, and requires,
[P directives](#declaring-market-prices) in your journal.
@ -1001,8 +1001,8 @@ why not use the recorded [transaction prices](#transaction-prices)
as additional market prices (as Ledger does) ?
We could produce value reports without needing P directives at all.
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
Adding the `--infer-market-prices` flag to `-V`, `-X` or `--value` enables
this. So for example, `hledger bs -V --infer-market-prices` will get market
prices both from P directives and from transactions.
(And if both occur on the same day, the P directive takes precedence).
@ -1011,7 +1011,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-market-price` can infer market prices from:
`--infer-market-prices` can infer market prices from:
- multicommodity transactions with explicit prices (`@`/`@@`)
@ -1040,7 +1040,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-market-price` flag is used: the price commodity from the latest
`--infer-market-prices` flag is used: the price commodity from the latest
transaction-inferred price for A on or before valuation date.
This means:
@ -1048,7 +1048,7 @@ This means:
- If you have [P directives](#declaring-market-prices),
they determine which commodities `-V` will convert, and to what.
- If you have no P directives, and use the `--infer-market-price` flag,
- If you have no P directives, and use the `--infer-market-prices` flag,
[transaction prices](#transaction-prices) determine it.
Amounts for which no valuation commodity can be found are not converted.
@ -2868,7 +2868,7 @@ Notes:
types can cause confusion.
For example, here liabilities is declared to be Equity, but would also
be auto-detected as Liability, since no Liability account is declared:
```journal
account liabilities ; type:Equity

View File

@ -485,7 +485,7 @@ read -r -d "" _hledger_complist_generic_options <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -529,7 +529,7 @@ read -r -d "" _hledger_complist_options_accounts <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -569,7 +569,7 @@ read -r -d "" _hledger_complist_options_activity <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -623,7 +623,7 @@ read -r -d "" _hledger_complist_options_areg <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -666,7 +666,7 @@ read -r -d "" _hledger_complist_options_aregister <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -717,7 +717,7 @@ read -r -d "" _hledger_complist_options_bal <<"__TEXT__"
--help
--historical
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--invert
--man
@ -776,7 +776,7 @@ read -r -d "" _hledger_complist_options_balance <<"__TEXT__"
--help
--historical
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--invert
--man
@ -835,7 +835,7 @@ read -r -d "" _hledger_complist_options_balancesheet <<"__TEXT__"
--help
--historical
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -892,7 +892,7 @@ read -r -d "" _hledger_complist_options_balancesheetequity <<"__TEXT__"
--help
--historical
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -949,7 +949,7 @@ read -r -d "" _hledger_complist_options_bs <<"__TEXT__"
--help
--historical
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1006,7 +1006,7 @@ read -r -d "" _hledger_complist_options_bse <<"__TEXT__"
--help
--historical
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1063,7 +1063,7 @@ read -r -d "" _hledger_complist_options_cashflow <<"__TEXT__"
--help
--historical
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1120,7 +1120,7 @@ read -r -d "" _hledger_complist_options_cf <<"__TEXT__"
--help
--historical
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1169,7 +1169,7 @@ read -r -d "" _hledger_complist_options_check <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1211,7 +1211,7 @@ read -r -d "" _hledger_complist_options_close <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--interleaved
--man
@ -1254,7 +1254,7 @@ read -r -d "" _hledger_complist_options_codes <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1307,7 +1307,7 @@ read -r -d "" _hledger_complist_options_descriptions <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1381,7 +1381,7 @@ read -r -d "" _hledger_complist_options_import <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1427,7 +1427,7 @@ read -r -d "" _hledger_complist_options_incomestatement <<"__TEXT__"
--help
--historical
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1484,7 +1484,7 @@ read -r -d "" _hledger_complist_options_is <<"__TEXT__"
--help
--historical
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1533,7 +1533,7 @@ read -r -d "" _hledger_complist_options_notes <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1572,7 +1572,7 @@ read -r -d "" _hledger_complist_options_payees <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1612,7 +1612,7 @@ read -r -d "" _hledger_complist_options_prices <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--inverted-costs
--man
@ -1652,7 +1652,7 @@ read -r -d "" _hledger_complist_options_print <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1694,7 +1694,7 @@ read -r -d "" _hledger_complist_options_print_unique <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1735,7 +1735,7 @@ read -r -d "" _hledger_complist_options_reg <<"__TEXT__"
--help
--historical
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--invert
--man
@ -1781,7 +1781,7 @@ read -r -d "" _hledger_complist_options_register <<"__TEXT__"
--help
--historical
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--invert
--man
@ -1824,7 +1824,7 @@ read -r -d "" _hledger_complist_options_register_match <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1864,7 +1864,7 @@ read -r -d "" _hledger_complist_options_rewrite <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1903,7 +1903,7 @@ read -r -d "" _hledger_complist_options_roi <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--investment=
--man
@ -1943,7 +1943,7 @@ read -r -d "" _hledger_complist_options_stats <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -1982,7 +1982,7 @@ read -r -d "" _hledger_complist_options_tags <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -2032,7 +2032,7 @@ read -r -d "" _hledger_complist_options_ui <<"__TEXT__"
--forecast
--help
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market
@ -2080,7 +2080,7 @@ read -r -d "" _hledger_complist_options_web <<"__TEXT__"
--help
--host=
--ignore-assertions
--infer-market-price
--infer-market-prices
--info
--man
--market

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-market-price,
# 23. Market price is inferred from transactions with --infer-market-prices,
# and -V can work with no P directives.
$ hledger -f- bal -N -V --infer-market-price
$ hledger -f- bal -N -V --infer-market-prices
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-market-price
$ hledger -f- bal -N -V --infer-market-prices
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-market-price
$ hledger -f- bal -N -V --infer-market-prices
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-market-price
$ hledger -f- bal -N -V --infer-market-prices
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-market-price", where commodity is the one that was used to pay for the investment.
For example, "--cost --value=end,<commodity> --infer-market-prices", 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-market-price
hledger -f- roi -p 2019-11 --inv Investment --pnl PnL --cost --value=then,A --infer-market-prices
<<<
2019/11/01 Example
Assets:Checking -100 A