summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-16 17:25:19 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-16 17:25:19 -0400
commitb7f2a95c1f630d1246afa4b7f847435d62c9341e (patch)
tree58fdbf7aeb495270398de5c17f0364951aba6497
parent275da22752f690f202269e2a0dc5cd405e0490e2 (diff)
downloadfork-ledger-b7f2a95c1f630d1246afa4b7f847435d62c9341e.tar.gz
fork-ledger-b7f2a95c1f630d1246afa4b7f847435d62c9341e.tar.bz2
fork-ledger-b7f2a95c1f630d1246afa4b7f847435d62c9341e.zip
Accept --first/--last as synonyms for --head/--tail
-rw-r--r--src/option.h4
-rw-r--r--src/report.cc2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/option.h b/src/option.h
index a791e250..7deb5f58 100644
--- a/src/option.h
+++ b/src/option.h
@@ -202,6 +202,10 @@ inline bool is_eq(const char * p, const char * n) {
if (is_eq(p, #name)) \
return ((name ## _handler).parent = this, &(name ## _handler))
+#define OPT_ALT(name, alt) \
+ if (is_eq(p, #name) || is_eq(p, #alt)) \
+ return ((name ## _handler).parent = this, &(name ## _handler))
+
#define OPT_(name) \
if (! *(p + 1) || \
((name ## _handler).wants_arg && \
diff --git a/src/report.cc b/src/report.cc
index 6cfd9cd3..917c98f6 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -405,6 +405,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
case 'f':
OPT(forecast_);
else OPT(format_);
+ else OPT_ALT(head_, first_);
break;
case 'g':
OPT_CH(performance);
@@ -425,6 +426,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
else OPT(lot_prices);
else OPT(lot_tags);
else OPT(lots);
+ else OPT_ALT(tail_, last_);
break;
case 'm':
OPT(market);