mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-20 02:37:12 +03:00
import: sort new transactions by date, across files
This commit is contained in:
parent
25074aec0e
commit
0b7a50d0f0
@ -8,6 +8,8 @@ module Hledger.Cli.Commands.Import (
|
|||||||
where
|
where
|
||||||
|
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
import Data.List
|
||||||
|
import Data.Ord
|
||||||
import Data.String.Here
|
import Data.String.Here
|
||||||
import Hledger
|
import Hledger
|
||||||
import Hledger.Cli.CliOptions
|
import Hledger.Cli.CliOptions
|
||||||
@ -46,7 +48,7 @@ importcmd opts@CliOpts{rawopts_=rawopts,inputopts_=iopts} j = do
|
|||||||
case enewj of
|
case enewj of
|
||||||
Left e -> error' e
|
Left e -> error' e
|
||||||
Right newj ->
|
Right newj ->
|
||||||
case jtxns newj of
|
case sortBy (comparing tdate) $ jtxns newj of
|
||||||
[] -> putStrLn "no new transactions"
|
[] -> putStrLn "no new transactions"
|
||||||
newts | dryrun -> do
|
newts | dryrun -> do
|
||||||
printf "would import %d new transactions:\n\n" (length newts)
|
printf "would import %d new transactions:\n\n" (length newts)
|
||||||
|
Loading…
Reference in New Issue
Block a user