doc: Remove references to --value=cost, replacing them with --cost.

Since this is option is now just an alias for -B/--cost, and since it
may be removed soon, we make it undocumented, though it will still
behave as before. --value=cost,COMM is unsupported as well.
This commit is contained in:
Stephen Morgan 2021-01-26 14:47:29 +11:00 committed by Simon Michael
parent c9eb7d1bcf
commit b619b68f71
5 changed files with 9 additions and 14 deletions

View File

@ -458,7 +458,7 @@ flat_ = not . tree_
-- depthFromOpts opts = min (fromMaybe 99999 $ depth_ opts) (queryDepth $ queryFromOpts nulldate opts)
-- | Convert this journal's postings' amounts to cost using their
-- transaction prices, if specified by options (-B/--value=cost).
-- transaction prices, if specified by options (-B/--cost).
-- Maybe soon superseded by newer valuation code.
journalSelectingAmountFromOpts :: ReportOpts -> Journal -> Journal
journalSelectingAmountFromOpts opts = case cost_ opts of

View File

@ -156,7 +156,7 @@ reportflags = [
-- valuation
,flagNone ["B","cost"] (setboolopt "B")
"show amounts converted to their cost/selling amount, using the transaction price. Equivalent to --value=cost."
"show amounts converted to their cost/selling amount, using the transaction price."
,flagNone ["V","market"] (setboolopt "V")
(unwords
["show amounts converted to period-end market value in their default valuation commodity."
@ -166,12 +166,11 @@ reportflags = [
(unwords
["show amounts converted to current (single period reports)"
,"or period-end (multiperiod reports) market value in the specified commodity."
,"Equivalent to --value=now,COMM / --value=end,COMM."
,"Equivalent to --value=end,COMM."
])
,flagReq ["value"] (\s opts -> Right $ setopt "value" s opts) "TYPE[,COMM]"
(unlines
["show amounts converted with valuation TYPE, and optionally to specified commodity COMM. TYPE can be:"
,"'cost': convert to cost using transaction prices, then optionally to COMM using period-end market prices"
,"'then': convert to contemporaneous market value, in default valuation commodity or COMM (print & register commands only)"
,"'end': convert to period-end market value, in default valuation commodity or COMM"
,"'now': convert to current market value, in default valuation commodity or COMM"

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

@ -885,12 +885,11 @@ $ hledger -f t.j bal -N euros -V
## --value: Flexible valuation
`-B`, `-V` and `-X` are special cases of the more general `--value` option:
`-V` and `-X` are special cases of the more general `--value` option:
--value=TYPE[,COMM] TYPE is cost, then, end, now or YYYY-MM-DD.
--value=TYPE[,COMM] TYPE is then, end, now or YYYY-MM-DD.
COMM is an optional commodity symbol.
Shows amounts converted to:
- cost commodity using transaction prices (then optionally to COMM using market prices at period end(s))
- default valuation commodity (or COMM) using market prices at posting dates
- default valuation commodity (or COMM) using market prices at period end(s)
- default valuation commodity (or COMM) using current market prices
@ -898,9 +897,6 @@ $ hledger -f t.j bal -N euros -V
The TYPE part selects cost or value and valuation date:
`--value=cost`
: Convert amounts to cost, using the prices recorded in transactions.
`--value=then`
: Convert amounts to their value in the [default valuation commodity](#valuation-commodity),
using market prices on each posting's date.
@ -945,7 +941,7 @@ P 2000-04-01 A 4 B
Show the cost of each posting:
```shell
$ hledger -f- print --value=cost
$ hledger -f- print --cost
2000-01-01
(a) 5 B
@ -1056,7 +1052,7 @@ Related:
[#329](https://github.com/simonmichael/hledger/issues/329),
[#1083](https://github.com/simonmichael/hledger/issues/1083).
| Report type | `-B`, `--value=cost` | `-V`, `-X` | `--value=then` | `--value=end` | `--value=DATE`, `--value=now` |
| Report type | `-B`, `--cost` | `-V`, `-X` | `--value=then` | `--value=end` | `--value=DATE`, `--value=now` |
|-----------------------------------------------------|------------------------------------------------------------------|-------------------------------------------------------------------|------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|-----------------------------------------|
| **print** | | | | | |
| posting amounts | cost | value at report end or today | value at posting date | value at report or journal end | value at DATE/today |

View File

@ -240,7 +240,7 @@ 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, "--value cost,<commodity> --infer-value", where commodity is the one that was used to pay for the investment.
For example, "--cost --value=end,<commodity> --infer-value", where commodity is the one that was used to pay for the investment.
>>>=1
# 10. Forcing valuation via --value