summaryrefslogtreecommitdiff
path: root/reports.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2003-10-13 06:55:15 +0000
committerJohn Wiegley <johnw@newartisans.com>2003-10-13 06:55:15 +0000
commit0d29133f8abee4cd24ca2eecce7f82be7534d5a9 (patch)
tree64c0889f634e2e733a4021ca803d5aafd8951cfe /reports.cc
parentfb4fed00ba3dede4c649e21ce64cf29a8244c8bd (diff)
downloadfork-ledger-0d29133f8abee4cd24ca2eecce7f82be7534d5a9.tar.gz
fork-ledger-0d29133f8abee4cd24ca2eecce7f82be7534d5a9.tar.bz2
fork-ledger-0d29133f8abee4cd24ca2eecce7f82be7534d5a9.zip
*** empty log message ***
Diffstat (limited to 'reports.cc')
-rw-r--r--reports.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/reports.cc b/reports.cc
index abce67df..5d5aea18 100644
--- a/reports.cc
+++ b/reports.cc
@@ -366,6 +366,8 @@ void add_new_entry(int index, int argc, char **argv)
entry added(main_ledger);
entry * matching = NULL;
+ assert(index < argc);
+
if (! parse_date(argv[index++], &added.date)) {
std::cerr << "Error: Bad add date: " << argv[index - 1]
<< std::endl;
@@ -405,7 +407,7 @@ void add_new_entry(int index, int argc, char **argv)
std::exit(1);
}
- transaction * m_xact, * xact, * first;
+ transaction * m_xact, * xact, * first;
m_xact = matching->xacts.front();
@@ -645,7 +647,7 @@ int main(int argc, char * argv[])
const std::string command = argv[index++];
int name_index = index;
- if (command == "register") {
+ if (command == "register" || command == "reg") {
if (optind == argc) {
std::cerr << ("Error: Must specify an account name "
"after the 'register' command.") << std::endl;
@@ -657,7 +659,7 @@ int main(int argc, char * argv[])
// Compile the list of specified regular expressions, which can be
// specified after the command, or using the '-i FILE' option
- if (command != "add")
+ if (command != "entry")
for (; index < argc; index++)
regexps.push_back(mask(argv[index]));
@@ -697,10 +699,10 @@ int main(int argc, char * argv[])
// Process the command
- if (command == "balance") {
+ if (command == "balance" || command == "bal") {
report_balances(std::cout, regexps);
}
- else if (command == "register") {
+ else if (command == "register" || command == "reg") {
if (show_sorted)
main_ledger->sort(cmp_entry_date());
print_register(argv[name_index], std::cout, regexps);
@@ -713,7 +715,7 @@ int main(int argc, char * argv[])
else if (command == "equity") {
equity_ledger(std::cout, regexps);
}
- else if (command == "add") {
+ else if (command == "entry") {
add_new_entry(index, argc, argv);
}