Commit Graph

407 Commits

Author SHA1 Message Date
Simon Michael
855d4e1131 balance: with --tree and --flat, use the last (fix #219) 2014-12-05 12:56:33 -08:00
Julien Moutinho
cf28985cf2 lib: move from Text.ParserCombinators.Parsec to Text.Parsec
NOTE: required to use liftIO in includedirective
SEE: http://www.vex.net/~trebla/haskell/parsec-generally.xhtml#IO
2014-11-20 10:08:30 +01:00
Simon Michael
9fa22e0398 account aliases (and regexReplace) now support backreferences 2014-10-29 07:46:49 -07:00
Simon Michael
21ed3dc73d balance: support CSV for multi-column balance reports 2014-10-23 05:11:48 -07:00
Simon Michael
9d1ef010ac finish previous commit 2014-10-21 17:49:41 -07:00
Simon Michael
9416d12d8a --output -> --output-file/-o & --output-format/-O, refactor
Use two options and less surprising behaviour. Notes:
* a recognised suffix on the output file name can set the format
* but --output-format always wins
* -o - means stdout
* currently these are command-specific options on balance, print, register
* later, --output-file should become a global option
* and --output-format should be available at least on all commands which
  support multiple formats. Each command may support a different set of
  output formats, which should be listed in its command line help.
2014-10-21 17:14:37 -07:00
Simon Michael
b6774f47a3 balance, print: add -o and CSV output here too
Not very elegant yet, but works.
2014-10-21 12:02:23 -07:00
Simon Michael
2dc44cb131 register command cleanups 2014-10-21 12:01:47 -07:00
Simon Michael
d234663b6d register: add -o/--output option, merge CSV functionality (cf #206) 2014-10-20 13:04:36 -07:00
Simon Michael
301f506486 the --format option shall be known as "line format" 2014-10-20 13:03:44 -07:00
Simon Michael
6d67bcb026 cli: --version shows "dev build" when VERSION is undefined
Probably only noticeable in GHCI.
2014-10-18 12:36:27 -07:00
Simon Michael
e8a58d9388 cli: add a hidden --version+ flag showing number representation (#118) 2014-10-18 12:35:58 -07:00
gwern
d1618aaca8 strip trailing whitespace from all Haskell files 2014-10-14 18:48:24 -07:00
Simon Michael
776a973d2c cli: clarify --debug help 2014-08-08 19:12:20 -07:00
Simon Michael
aa85e786b9 register: describe datespans briefly, like balance
Eg instead of 2014/01/01 - 2014/01/31, show 2014/01, as in a multicolumn
balance report. The data model is not very elegant, but works for now.
2014-08-08 07:34:11 -07:00
Simon Michael
f631e8e063 register: --average implies --empty
The -A flag now enables -E, so that with a report interval the averages
are always per-period and not per-report-line. (Without a report
interval, -E is already the default).
2014-08-07 14:03:56 -07:00
Julien Moutinho
ec243a1bea data: fix unit test by ignoring sourcepos 2014-08-07 17:48:04 +02:00
Julien Moutinho
a6190420b2 data: add source location to transactions 2014-08-07 16:38:44 +02:00
Simon Michael
40ab1e17f6 amounts cleanups, and support zeros with commodity 2014-07-28 18:45:13 -07:00
Simon Michael
7fb154f820 balance: include report span in title 2014-07-26 17:29:20 -07:00
Simon Michael
ca43eab47a balance: simplify multicolumn report titles slightly 2014-07-26 17:09:29 -07:00
Simon Michael
b499ea85eb register: optimise postingsReportItemAsText a bit
Avoid concatTopPadded when rendering register output, making that
command faster when there's a lot of output.
2014-07-07 08:37:27 -07:00
Simon Michael
3a16e6cfc7 mostly replace slow regexpr with regex-tdfa (fixes #189) 2014-07-06 14:03:28 -07:00
Simon Michael
16f8b78305 balance: show multi-commodity amts on one line (fixes #186)
To avoid totally breaking the layout of multicolumn balance reports when
there are multi-commodity balances, these are now rendered on a single
line, comma separated. Simple balance reports still use the old vertical
format for now.
2014-07-03 07:45:55 -07:00
Simon Michael
3669422bbf make --width and --debug require an argument (fixes #149)
This is a workaround for a cmdargs limitation. Having "--debug 2"
or "--width 100" produce no output (because the number is parsed
as a separate argument) is too annoying.
2014-07-03 07:31:52 -07:00
Simon Michael
330dfe6891 commodity & amount style parser cleanups, part 2 2014-07-02 17:41:33 -07:00
Simon Michael
0c3148ac7b add an --ignore-assertions flag
Can be helpful when reading Ledger files, where assertions may have
different semantics; or for getting some answers from your journal
to help you fix your assertions.

Could be called --no-assertions, but this might create surprise when it
has an effect contrary to --no-new-accounts.

I had to add another flag throughout the parsers & journal read
functions, ok for now.
2014-07-01 18:26:37 -07:00
Simon Michael
6b059aeb5e Merge branch 'rdesfo-0.23'
Conflicts:
	.version
	hledger-lib/Hledger/Read/CsvReader.hs
	hledger-lib/hledger-lib.cabal
	hledger-web/hledger-web.cabal
	hledger/hledger.cabal
2014-05-22 16:15:35 -07:00
Ryan Desfosses
38f977fa48 Histogram: fixes previous change
change made in Histogram:cabal test and hlint warning
2014-05-14 12:18:50 -04:00
Ryan Desfosses
47853d6df6 Cli: cabal test and hlint warnings 2014-05-11 20:19:36 -04:00
Ryan Desfosses
342bae8c35 Histogram: cabal test and hlint warnings 2014-05-11 19:27:39 -04:00
Ryan Desfosses
39479638e3 Option: cabal test and hlint warnings 2014-05-07 22:34:41 -04:00
Simon Michael
120b3b8377 add: don't apply a default commodity to amounts on entry (fixes #138) 2014-05-07 16:37:22 -07:00
Simon Michael
09ebd3e049 cli: options before the add-on are also passed to it (fixes #182) 2014-05-07 16:37:22 -07:00
Simon Michael
cceff52403 add: don't apply a default commodity to amounts on entry (fixes #138) 2014-05-03 15:48:20 -07:00
Simon Michael
f7406f77cf cli: options before the add-on are also passed to it (fixes #182) 2014-05-03 15:26:51 -07:00
Simon Michael
e6a1339370 cli: options help polish 2014-05-01 07:22:44 -07:00
Simon Michael
66422a7711 cli: more flag cleanups, help layout improvements 2014-04-30 17:40:14 -07:00
Simon Michael
2a1e0f6aff cli: drop --display from command-line help 2014-04-30 17:39:38 -07:00
Simon Michael
a28d4fd400 register: drop --display, use --historical instead
We provided a very limited implementation of --display only for one use
case: to see an accurate running balance. Now that is achieved more easily
with -H/--historical, similar to the balance command, and --display
can be dropped.
2014-04-30 17:24:41 -07:00
Simon Michael
98cc1d0e77 addons: more description strings for test addons 2014-04-30 07:32:10 -07:00
Simon Michael
aee7b3512d cli: omit the -- from debug output as well 2014-04-27 23:44:24 -07:00
Simon Michael
9418967343 cli: a fix for add-on options after -- (don't pass the -- through) 2014-04-27 23:34:27 -07:00
Simon Michael
d0932cb47a cli: small cleanup 2014-04-27 23:34:09 -07:00
Simon Michael
f3c90a1351 addons: simplify and firm up add-on command parsing
Drop the special case where we hide an add-on's source version if a
compiled version is also present. Better to be simple and explicit.

Improve robustness of command parsing, eg "hledger addon.hs"
will now work even though the command is listed as "addon".

And ignore any add-ons which would shadow a built-in command
(or any of the official command aliases displayed in the command list,
like "bal" and "reg"). Built-ins may not be replaced by an add-on.
2014-04-27 18:48:35 -07:00
Simon Michael
791f6fdd15 expose the accounts command in Hledger.Cli 2014-04-27 18:47:27 -07:00
Simon Michael
7d73ab5264 cli: drop single-letter aliases, keep the familiar three-letter ones where useful 2014-04-27 18:46:34 -07:00
Simon Michael
4b47c1340f addons: note more issues 2014-04-26 10:49:37 -07:00
Simon Michael
9ce2d6a75a tools: update test addons 2014-04-26 10:44:31 -07:00
Simon Michael
9a255051e8 addons: try to be smarter about showing file extensions
We now hide add-ons' file extensions in the commands list except when
they are needed for disambiguation. There are three cases:

- when an add-on exists with only one file extension, the extension is
  not displayed.

- when an add-on has exactly two variants, one with the .[l]hs extension
  and the other with none or .exe - presumably the source and compiled
  versions - we omit the source version from the list.

- otherwise when an add-on has multiple variants differing by file
  extension, they are listed with their extensions displayed.
2014-04-26 10:25:32 -07:00
Simon Michael
eeb48c86d1 default report dates come from secondary dates with --date2 2014-04-24 14:44:30 -07:00
Simon Michael
32f182158e fix a warning 2014-04-22 17:50:09 -07:00
Simon Michael
e40b587357 addons: another fix for addon detection on windows 2014-04-22 17:49:03 -07:00
Simon Michael
ca499d7f7b addons: detect more executable file extensions, such as .exe
In addition to hledger-X and hledger-X.hs, other common executable file
extensions will be recognised. In particular, on windows hledger now
lists hledger-web.exe as an add-on. The current list is:
bat, com, exe, hs, lhs, pl, py, rb, rkt, sh.
2014-04-22 17:40:06 -07:00
Simon Michael
1fca3e7472 orDatesFrom -> spanDefaultsFrom 2014-04-19 08:38:03 -07:00
Simon Michael
9d10cfa180 fix single-quote-containing addon arguments harder 2014-04-15 13:07:43 -07:00
Simon Michael
2af04ec2fc balance: merge/improve multicol report implementations
Periodic, cumulative and historical multicolumn balance reports are now
generated by one code path, which helps with consistency and reducing
the bug/test surface. --tree now also works with --cumulative or
--historical.
2014-04-13 12:49:05 -07:00
Simon Michael
cad37b7dce balance: fix excessive indent in multicolumn tree mode 2014-04-13 12:49:05 -07:00
Simon Michael
19eb45cb68 account: add more description in the command-specific help 2014-04-08 15:57:40 -07:00
Simon Michael
7b4b99fae0 accounts: more query support, --flat/--drop/--depth support 2014-04-07 12:13:36 -07:00
Simon Michael
efad3a767d balance: support --drop in flat multicolumn reports 2014-04-07 08:32:23 -07:00
Simon Michael
f9c1d94b5f accounts: make accounts a built-in command, listing posted account names 2014-04-07 08:27:50 -07:00
Simon Michael
7d99ae5033 balance: --tree makes multicolumn reports show hierarchy
Multicolumn balance reports can now be switched to a hierarchical view
with --tree. This is similar to the single column balance report with
--no-elide, ie we do not elide boring parents into the following line.

The --flat and --tree flags are opposites; the last one to appear on
the command line is decisive (in future, if not already).
2014-04-06 21:56:47 -07:00
Simon Michael
6b5ed3d790 print: drop unnecessary showTransactions
refactor the tests later
2014-04-05 19:39:18 -07:00
Simon Michael
5cd3f6ed51 balancesheet, cashflow, incomestatement: less space before Total 2014-04-05 13:35:18 -07:00
Simon Michael
a8122405bf I see, polymorphic let bindings need a proper type sig 2014-04-03 18:49:57 -07:00
Simon Michael
a1531bcd09 show args processing debug output only at level 2+ 2014-04-03 18:49:56 -07:00
Simon Michael
ce888a62d5 restore some options utilities, fix hledger-balance-csv script 2014-03-28 16:33:48 -07:00
Simon Michael
b69e6c6946 unused extensions 2014-03-28 16:23:40 -07:00
Simon Michael
882a9dbf1c cli, report & raw options cleanups 2014-03-25 19:03:56 -07:00
Simon Michael
3fa4824218 some type signatures 2014-03-25 19:03:55 -07:00
Simon Michael
d815cca069 incomestatement, cashflow: support --flat and --drop as well 2014-03-21 17:41:22 -07:00
Simon Michael
5a8b5ed082 balancesheet: support --flat and --drop, like balance 2014-03-21 17:34:58 -07:00
Simon Michael
2d1e0d7cd4 move command-specific options to the respective command modules 2014-03-21 10:45:13 -07:00
Simon Michael
7d36789b74 web: fix build failures caught by the bot 2014-03-19 08:45:52 -07:00
Simon Michael
4d8d0d9aa6 balance: make BalanceReport more like MultiBalanceReport, doc cleanups 2014-03-18 18:01:24 -07:00
Simon Michael
5df28069fb restore the test command, hidden 2014-03-18 14:08:28 -07:00
Simon Michael
92dc86ebae restore reg & bal aliases, even if not advertised 2014-03-18 13:47:13 -07:00
Simon Michael
3bc3e533c8 remove unused import 2014-03-18 13:46:47 -07:00
Simon Michael
814008d648 add: also let enter end transactions if no more default postings
To end a transaction, period is required because there might be another
default posting being suggested, and enter usually means "accept the
default". But having to switch back and forth from enter to period
during data entry is a bit unergonomic, requiring too much thought.

Now, in the (common) case where you have entered a balanced transaction
and there are no more default postings to suggest, enter is also allowed
to end the transaction. Experimental; this might be too inconsistent.
2014-03-16 09:29:09 -07:00
Simon Michael
88d52a9da8 cli: don't list both source and exe of an addon 2014-03-16 09:27:07 -07:00
Simon Michael
d1b9273b19 cli: tighten up commands list, better help for known addons 2014-03-15 13:20:24 -07:00
Simon Michael
7cbbd0fbab add: fix over-zealous cleanup caught by hydra, continued 2014-03-06 17:50:46 -08:00
Simon Michael
8e6922c57c add: fix over-zealous cleanup caught by hydra 2014-03-06 17:49:52 -08:00
Simon Michael
63eca19a7f add: refactor completion functions 2014-03-06 16:58:48 -08:00
Simon Michael
856f62b465 add: fix runtime printf error from 2nd txn on (fixes #164) 2014-03-05 12:48:13 -08:00
Simon Michael
27cf33f887 debug message wording 2014-03-04 11:04:31 -08:00
Simon Michael
ebf42046d8 add: keep using historical txn accounts as defaults even after a custom amount is entered 2014-03-03 12:18:10 -08:00
Simon Michael
dd2f293094 rename FormatString to OutputFormat
It was going to be Format, but that clashes with file format. Press on.
2014-03-02 13:33:56 -08:00
Simon Michael
d89367d75e add: make input prompts green, where supported
Because we can! Should have no effect where not supported.
2014-03-01 11:16:19 -08:00
Simon Michael
5d0da63261 add: don't print an extra newline on exit
even it made things tidier in an emacs shell..
2014-03-01 11:15:29 -08:00
Simon Michael
1051f10826 add: also accept . at date prompt to quit 2014-03-01 11:15:19 -08:00
Simon Michael
e50c2a4259 add: avoid quotes preserved in quoted cli args 2014-03-01 11:08:31 -08:00
Simon Michael
dcdb032d96 add: rewrite using wizards and make it more robust
The code is now much more manageable, faciliating further
improvements. Completion now works at all prompts, and
will insert the default value if the input area is empty.
Account and amount defaults are more robust and useful
in various situations. There might be a slight regression
with default commodity handling.
2014-02-27 18:15:49 -08:00
Simon Michael
204af487a5 note an issue with CliOpts query_ 2014-02-27 17:39:38 -08:00
Simon Michael
bab6ec041b cli: be more robust at finding hledger-* add-ons
Previously executables with eg digits in their name were ignored.
It now finds all files beginning with hledger-, optionally ending with
.hs or .lhs, and with no other dots in the name.
As before, we don't check for executable permission (performance ?).
2014-02-27 11:40:41 -08:00
Simon Michael
8d3161f6d6 add: cleanup, cleanup 2014-02-23 15:04:28 -08:00
Simon Michael
6bf08cdd7c add: hack apart getPostingsLoop into smaller pieces 2014-02-23 07:52:26 -08:00
Simon Michael
56abdb2c8c add: code cleanups 2014-02-21 09:07:52 -08:00
Simon Michael
e35614c88d add: clarify "accept" 2014-02-21 07:23:10 -08:00