diff --git a/hledger/Hledger/Cli/Commands/Add.hs b/hledger/Hledger/Cli/Commands/Add.hs index 61c9bee28..7a3fbb951 100644 --- a/hledger/Hledger/Cli/Commands/Add.hs +++ b/hledger/Hledger/Cli/Commands/Add.hs @@ -348,9 +348,10 @@ amountAndCommentWizard PrevInput{..} EntryState{..} = do where parseAmountAndComment s = if s == "<" then return Nothing else either (const Nothing) (return . Just) $ runParser - (evalStateT (amountandcommentp <* eof) esJournal) + (evalStateT (amountandcommentp <* eof) nodefcommodityj) "" (T.pack s) + nodefcommodityj = esJournal{jparsedefaultcommodity=Nothing} amountandcommentp :: JournalParser Identity (Amount, Text) amountandcommentp = do a <- amountp diff --git a/hledger/Hledger/Cli/Commands/Add.md b/hledger/Hledger/Cli/Commands/Add.md index 6ca0f4941..85c3d6da2 100644 --- a/hledger/Hledger/Cli/Commands/Add.md +++ b/hledger/Hledger/Cli/Commands/Add.md @@ -62,6 +62,12 @@ Starting the next transaction (. or ctrl-D/ctrl-C to quit) Date [2015/05/22]: $ ``` +If you enter a number with no commodity symbol, +and you have declared a default commodity with a `D` directive, +you might expect `add` to add this symbol for you. +It does not do this; we assume that if you are using a `D` directive +you prefer not to see the commodity symbol repeated on amounts in the journal. + On Microsoft Windows, the add command makes sure that no part of the file path ends with a period, as that would cause problems ([#1056](https://github.com/simonmichael/hledger/issues/1056)). diff --git a/hledger/test/add.test b/hledger/test/add.test index 3cb03635b..5b77040a6 100644 --- a/hledger/test/add.test +++ b/hledger/test/add.test @@ -60,7 +60,7 @@ $ printf 'D A1000.0\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm - > /a +A1000\.00/ >2 // -# ** 6. default commodity symbol is added when not entered +# ** 6. default commodity symbol is not added when not provided (#815) < @@ -71,7 +71,7 @@ b . $ printf 'D A1000.00\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm -f t$$.j -> /a +A1000\.00/ +> /a +1000\.00/ >2 // # ** 7. existing commodity with greater precision