move basic reports into hledger-lib
This commit is contained in:
		
							parent
							
								
									85f83c00fc
								
							
						
					
					
						commit
						cbb0fc5c59
					
				| @ -1,9 +1,11 @@ | |||||||
| module Hledger ( | module Hledger ( | ||||||
|                 module Hledger.Data |                 module Hledger.Data | ||||||
|                ,module Hledger.Read |                ,module Hledger.Read | ||||||
|  |                ,module Hledger.Reports | ||||||
|                ,module Hledger.Utils |                ,module Hledger.Utils | ||||||
| ) | ) | ||||||
| where | where | ||||||
| import Hledger.Data | import Hledger.Data | ||||||
| import Hledger.Read | import Hledger.Read | ||||||
|  | import Hledger.Reports | ||||||
| import Hledger.Utils | import Hledger.Utils | ||||||
|  | |||||||
| @ -10,6 +10,7 @@ module Hledger.Read ( | |||||||
|        readJournalFile, |        readJournalFile, | ||||||
|        readJournal, |        readJournal, | ||||||
|        journalFromPathAndString, |        journalFromPathAndString, | ||||||
|  |        ledgeraccountname, | ||||||
|        myJournalPath, |        myJournalPath, | ||||||
|        myTimelogPath, |        myTimelogPath, | ||||||
|        myJournal, |        myJournal, | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ on the command-line options, should move to hledger-lib later. | |||||||
| 
 | 
 | ||||||
| -} | -} | ||||||
| 
 | 
 | ||||||
| module Hledger.Cli.Reports ( | module Hledger.Reports ( | ||||||
|   ReportOpts(..), |   ReportOpts(..), | ||||||
|   DisplayExp, |   DisplayExp, | ||||||
|   FormatStr, |   FormatStr, | ||||||
| @ -43,7 +43,7 @@ module Hledger.Cli.Reports ( | |||||||
|   accountsReport, |   accountsReport, | ||||||
|   accountsReport2, |   accountsReport2, | ||||||
|   -- * Tests |   -- * Tests | ||||||
|   tests_Hledger_Cli_Reports |   tests_Hledger_Reports | ||||||
| ) | ) | ||||||
| where | where | ||||||
| 
 | 
 | ||||||
| @ -61,7 +61,6 @@ import Text.Printf | |||||||
| 
 | 
 | ||||||
| import Hledger.Data | import Hledger.Data | ||||||
| import Hledger.Utils | import Hledger.Utils | ||||||
| -- import Hledger.Cli.Utils |  | ||||||
| 
 | 
 | ||||||
| -- report options, used in hledger-lib and above | -- report options, used in hledger-lib and above | ||||||
| data ReportOpts = ReportOpts { | data ReportOpts = ReportOpts { | ||||||
| @ -550,8 +549,8 @@ isInterestingIndented opts l a | |||||||
| 
 | 
 | ||||||
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ||||||
| 
 | 
 | ||||||
| tests_Hledger_Cli_Reports :: Test | tests_Hledger_Reports :: Test | ||||||
| tests_Hledger_Cli_Reports = TestList | tests_Hledger_Reports = TestList | ||||||
|  [ |  [ | ||||||
| 
 | 
 | ||||||
|   "summarisePostingsByInterval" ~: do |   "summarisePostingsByInterval" ~: do | ||||||
| @ -48,6 +48,7 @@ library | |||||||
|                   Hledger.Read.JournalReader |                   Hledger.Read.JournalReader | ||||||
|                   Hledger.Read.TimelogReader |                   Hledger.Read.TimelogReader | ||||||
|                   Hledger.Read.Utils |                   Hledger.Read.Utils | ||||||
|  |                   Hledger.Reports | ||||||
|                   Hledger.Utils |                   Hledger.Utils | ||||||
|                   Hledger.Utils.UTF8 |                   Hledger.Utils.UTF8 | ||||||
|   Build-Depends: |   Build-Depends: | ||||||
|  | |||||||
| @ -10,7 +10,6 @@ module Hledger.Cli ( | |||||||
|                      module Hledger.Cli.Histogram, |                      module Hledger.Cli.Histogram, | ||||||
|                      module Hledger.Cli.Print, |                      module Hledger.Cli.Print, | ||||||
|                      module Hledger.Cli.Register, |                      module Hledger.Cli.Register, | ||||||
|                      module Hledger.Cli.Reports, |  | ||||||
|                      module Hledger.Cli.Stats, |                      module Hledger.Cli.Stats, | ||||||
|                      module Hledger.Cli.Options, |                      module Hledger.Cli.Options, | ||||||
|                      module Hledger.Cli.Utils, |                      module Hledger.Cli.Utils, | ||||||
| @ -31,7 +30,6 @@ import Hledger.Cli.Convert | |||||||
| import Hledger.Cli.Histogram | import Hledger.Cli.Histogram | ||||||
| import Hledger.Cli.Print | import Hledger.Cli.Print | ||||||
| import Hledger.Cli.Register | import Hledger.Cli.Register | ||||||
| import Hledger.Cli.Reports |  | ||||||
| import Hledger.Cli.Stats | import Hledger.Cli.Stats | ||||||
| import Hledger.Cli.Options | import Hledger.Cli.Options | ||||||
| import Hledger.Cli.Utils | import Hledger.Cli.Utils | ||||||
| @ -51,7 +49,6 @@ tests_Hledger_Cli = TestList | |||||||
|    ,tests_Hledger_Cli_Options |    ,tests_Hledger_Cli_Options | ||||||
|    -- ,tests_Hledger_Cli_Print |    -- ,tests_Hledger_Cli_Print | ||||||
|    ,tests_Hledger_Cli_Register |    ,tests_Hledger_Cli_Register | ||||||
|    ,tests_Hledger_Cli_Reports |  | ||||||
|    -- ,tests_Hledger_Cli_Stats |    -- ,tests_Hledger_Cli_Stats | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -34,7 +34,6 @@ import Hledger.Utils.UTF8 (putStr, putStrLn, appendFile) | |||||||
| import Hledger.Cli.Options | import Hledger.Cli.Options | ||||||
| import Hledger.Cli.Register (postingsReportAsText) | import Hledger.Cli.Register (postingsReportAsText) | ||||||
| import Hledger.Cli.Utils | import Hledger.Cli.Utils | ||||||
| import Hledger.Cli.Reports |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| {- | Information used as the basis for suggested account names, amounts, | {- | Information used as the basis for suggested account names, amounts, | ||||||
|  | |||||||
| @ -111,7 +111,6 @@ import Hledger.Utils.UTF8 (putStr) | |||||||
| import Hledger.Cli.Format | import Hledger.Cli.Format | ||||||
| import qualified Hledger.Cli.Format as Format | import qualified Hledger.Cli.Format as Format | ||||||
| import Hledger.Cli.Options | import Hledger.Cli.Options | ||||||
| import Hledger.Cli.Reports |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| -- | Print a balance report. | -- | Print a balance report. | ||||||
|  | |||||||
| @ -4,7 +4,6 @@ format, and print it on stdout. See the manual for more details. | |||||||
| -} | -} | ||||||
| 
 | 
 | ||||||
| module Hledger.Cli.Convert where | module Hledger.Cli.Convert where | ||||||
| import Prelude hiding (getContents) |  | ||||||
| import Control.Monad (when, guard, liftM) | import Control.Monad (when, guard, liftM) | ||||||
| import Data.Maybe | import Data.Maybe | ||||||
| import Data.Time.Format (parseTime) | import Data.Time.Format (parseTime) | ||||||
| @ -19,18 +18,13 @@ import Text.CSV (parseCSV, parseCSVFromFile, printCSV, CSV) | |||||||
| import Text.ParserCombinators.Parsec | import Text.ParserCombinators.Parsec | ||||||
| import Text.Printf (hPrintf) | import Text.Printf (hPrintf) | ||||||
| 
 | 
 | ||||||
|  | import Prelude hiding (getContents) | ||||||
|  | import Hledger.Utils.UTF8 (getContents) | ||||||
|  | import Hledger | ||||||
| import Hledger.Cli.Format | import Hledger.Cli.Format | ||||||
| import qualified Hledger.Cli.Format as Format | import qualified Hledger.Cli.Format as Format | ||||||
| import Hledger.Cli.Version | import Hledger.Cli.Version | ||||||
| import Hledger.Cli.Options | import Hledger.Cli.Options | ||||||
| import Hledger.Cli.Reports |  | ||||||
| import Hledger.Data.Amount (nullmixedamt, costOfMixedAmount) |  | ||||||
| import Hledger.Data.Dates (firstJust, showDate, parsedate) |  | ||||||
| import Hledger.Data (Journal,AccountName,Transaction(..),Posting(..),PostingType(..)) |  | ||||||
| import Hledger.Data.Journal (nullctx) |  | ||||||
| import Hledger.Read.JournalReader (someamount,ledgeraccountname) |  | ||||||
| import Hledger.Utils |  | ||||||
| import Hledger.Utils.UTF8 (getContents) |  | ||||||
| 
 | 
 | ||||||
| {- | | {- | | ||||||
| A set of data definitions and account-matching patterns sufficient to | A set of data definitions and account-matching patterns sufficient to | ||||||
|  | |||||||
| @ -13,8 +13,8 @@ import Data.Ord | |||||||
| import Text.Printf | import Text.Printf | ||||||
| 
 | 
 | ||||||
| import Hledger.Cli.Options | import Hledger.Cli.Options | ||||||
| import Hledger.Cli.Reports |  | ||||||
| import Hledger.Data | import Hledger.Data | ||||||
|  | import Hledger.Reports | ||||||
| import Prelude hiding (putStr) | import Prelude hiding (putStr) | ||||||
| import Hledger.Utils.UTF8 (putStr) | import Hledger.Utils.UTF8 (putStr) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -20,12 +20,9 @@ import Test.HUnit | |||||||
| import Text.Parsec | import Text.Parsec | ||||||
| import Text.Printf | import Text.Printf | ||||||
| 
 | 
 | ||||||
|  | import Hledger | ||||||
| import Hledger.Cli.Format as Format | import Hledger.Cli.Format as Format | ||||||
| import Hledger.Cli.Reports |  | ||||||
| import Hledger.Cli.Version | import Hledger.Cli.Version | ||||||
| import Hledger.Data |  | ||||||
| import Hledger.Read |  | ||||||
| import Hledger.Utils |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| progname = "hledger" | progname = "hledger" | ||||||
|  | |||||||
| @ -15,7 +15,6 @@ import Hledger | |||||||
| import Prelude hiding (putStr) | import Prelude hiding (putStr) | ||||||
| import Hledger.Utils.UTF8 (putStr) | import Hledger.Utils.UTF8 (putStr) | ||||||
| import Hledger.Cli.Options | import Hledger.Cli.Options | ||||||
| import Hledger.Cli.Reports |  | ||||||
| 
 | 
 | ||||||
| -- | Print journal transactions in standard format. | -- | Print journal transactions in standard format. | ||||||
| print' :: CliOpts -> Journal -> IO () | print' :: CliOpts -> Journal -> IO () | ||||||
|  | |||||||
| @ -21,7 +21,6 @@ import Hledger | |||||||
| import Prelude hiding (putStr) | import Prelude hiding (putStr) | ||||||
| import Hledger.Utils.UTF8 (putStr) | import Hledger.Utils.UTF8 (putStr) | ||||||
| import Hledger.Cli.Options | import Hledger.Cli.Options | ||||||
| import Hledger.Cli.Reports |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| -- | Print a (posting) register report. | -- | Print a (posting) register report. | ||||||
|  | |||||||
| @ -14,9 +14,8 @@ import Data.Time.Calendar | |||||||
| import Text.Printf | import Text.Printf | ||||||
| import qualified Data.Map as Map | import qualified Data.Map as Map | ||||||
| 
 | 
 | ||||||
|  | import Hledger | ||||||
| import Hledger.Cli.Options | import Hledger.Cli.Options | ||||||
| import Hledger.Cli.Reports |  | ||||||
| import Hledger.Data |  | ||||||
| import Prelude hiding (putStr) | import Prelude hiding (putStr) | ||||||
| import Hledger.Utils.UTF8 (putStr) | import Hledger.Utils.UTF8 (putStr) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -32,9 +32,8 @@ import Control.Monad | |||||||
| import System.Exit | import System.Exit | ||||||
| import Test.HUnit | import Test.HUnit | ||||||
| 
 | 
 | ||||||
|  | import Hledger | ||||||
| import Hledger.Cli | import Hledger.Cli | ||||||
| import Hledger.Data |  | ||||||
| import Hledger.Utils |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| -- | Run unit tests and exit with success or failure. | -- | Run unit tests and exit with success or failure. | ||||||
|  | |||||||
| @ -54,7 +54,6 @@ library | |||||||
|                   Hledger.Cli.Histogram |                   Hledger.Cli.Histogram | ||||||
|                   Hledger.Cli.Print |                   Hledger.Cli.Print | ||||||
|                   Hledger.Cli.Register |                   Hledger.Cli.Register | ||||||
|                   Hledger.Cli.Reports |  | ||||||
|                   Hledger.Cli.Stats |                   Hledger.Cli.Stats | ||||||
|   -- should be the same as below |   -- should be the same as below | ||||||
|   build-depends: |   build-depends: | ||||||
| @ -102,7 +101,6 @@ executable hledger | |||||||
|                   Hledger.Cli.Histogram |                   Hledger.Cli.Histogram | ||||||
|                   Hledger.Cli.Print |                   Hledger.Cli.Print | ||||||
|                   Hledger.Cli.Register |                   Hledger.Cli.Register | ||||||
|                   Hledger.Cli.Reports |  | ||||||
|                   Hledger.Cli.Stats |                   Hledger.Cli.Stats | ||||||
|   -- XXX should set patchlevel here as in Makefile |   -- XXX should set patchlevel here as in Makefile | ||||||
|   cpp-options:    -DPATCHLEVEL=0 |   cpp-options:    -DPATCHLEVEL=0 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user