#include "utils/colors.h"
#include "utils/misc.h"
#include "Table.h"
+#include "Zypper.h"
#include "Summary.h"
// --------------------------------------------------------------------------
Summary::Summary(const zypp::ResPool & pool, const ViewOptions options)
- : _viewop(options), _wrap_width(80)
+ : _viewop(options), _wrap_width(80), _force_no_color(false)
{
readPool(pool);
}
void Summary::dumpTo(ostream & out)
{
+ struct SetColor
+ {
+ SetColor(bool force) : docolors(Zypper::instance()->config().do_colors)
+ { if (force) Zypper::instance()->config().do_colors = false; }
+ ~SetColor()
+ { Zypper::instance()->config().do_colors = docolors; }
+ bool docolors;
+ };
+ SetColor setcolor(_force_no_color);
+
_wrap_width = get_screen_width();
writeNewlyInstalled(out);
{ _viewop = (ViewOptions) (_viewop & ~option); }
void toggleViewOption(const ViewOptions option)
{ _viewop & option ? unsetViewOption(option) : setViewOption(option); }
+ void setForceNoColor(bool value = true)
+ { _force_no_color = value; }
void writeNewlyInstalled(std::ostream & out);
void writeRemoved(std::ostream & out);
private:
ViewOptions _viewop;
mutable unsigned _wrap_width;
+ bool _force_no_color;
bool _need_reboot;
bool _need_restart;
// setters & getters
Out & out();
- const Config & config() const { return _config; }
+ Config & config() { return _config; }
const GlobalOptions & globalOpts() const { return _gopts; }
const parsed_opts & cOpts() const { return _copts; }
const ZypperCommand & command() const { return _command; }
case 8: // g - view in pager
{
ostringstream s;
+ summary.setForceNoColor(true);
summary.dumpTo(s);
+ summary.setForceNoColor(false);
show_text_in_pager(s.str());
break;
}