summaryrefslogtreecommitdiff
path: root/src/report.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/report.h')
-rw-r--r--src/report.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/report.h b/src/report.h
index 294af19a..4d028e33 100644
--- a/src/report.h
+++ b/src/report.h
@@ -237,6 +237,8 @@ public:
HANDLER(exact).report(out);
HANDLER(exchange_).report(out);
HANDLER(flat).report(out);
+ HANDLER(force_color).report(out);
+ HANDLER(force_pager).report(out);
HANDLER(forecast_while_).report(out);
HANDLER(format_).report(out);
HANDLER(gain).report(out);
@@ -539,6 +541,8 @@ public:
});
OPTION(report_t, flat);
+ OPTION(report_t, force_color);
+ OPTION(report_t, force_pager);
OPTION(report_t, forecast_while_);
OPTION(report_t, format_); // -F
@@ -630,10 +634,11 @@ public:
OPTION(report_t, output_); // -o
+#ifdef HAVE_ISATTY
OPTION__
(report_t, pager_,
CTOR(report_t, pager_) {
- if (! std::getenv("PAGER")) {
+ if (! std::getenv("PAGER") && isatty(STDOUT_FILENO)) {
bool have_less = false;
if (exists(path("/opt/local/bin/less")) ||
exists(path("/usr/local/bin/less")) ||
@@ -654,6 +659,20 @@ public:
else
option_t<report_t>::on_with(whence, text);
});
+#else // HAVE_ISATTY
+ OPTION__
+ (report_t, pager_,
+ CTOR(report_t, pager_) {
+ }
+ virtual void on_with(const optional<string>& whence, const value_t& text) {
+ string cmd(text.to_string());
+ if (cmd == "" || cmd == "false" || cmd == "off" ||
+ cmd == "none" || cmd == "no" || cmd == "disable")
+ option_t<report_t>::off();
+ else
+ option_t<report_t>::on_with(whence, text);
+ });
+#endif // HAVE_ISATTY
OPTION(report_t, payee_as_account);