33 :
Out( TYPE_NORMAL, verbosity_r )
34 , _use_colors( false )
115 cerr << hint << endl;
122 static const bool dbg = getenv(
"ZYPPER_PBD");
123 return (dbg ?
str << std::endl :
str << std::flush );
133 outstr.
lhs << s <<
' ';
136 if ( percent >= 0 && percent <= 100 )
152 cout <<
'.' << std::flush;
165 outstr.
lhs << s <<
' ';
177 cout <<
'.' << std::flush;
187 cout << label <<
" [";
210 void OutNormal::progressEnd(
const std::string &
id,
const std::string & label,
const std::string & donetag,
bool error )
228 outstr.
lhs << label <<
' ';
233 outstr.
rhs << donetag <<
']';
236 cout << outline << endl << std::flush;
253 outstr.
lhs <<
_(
"Retrieving:") <<
' ';
260 outstr.
rhs <<
'[' <<
_(
"starting") <<
']';
278 cout <<
'.' << std::flush;
287 outstr.
lhs <<
_(
"Retrieving:") <<
" ";
295 if ( value >= 0 && value <= 100 )
325 outstr.
lhs <<
_(
"Retrieving:") <<
" ";
332 if ( zypp::indeterminate(
error ) )
340 outstr.
rhs <<
_(
"done");
343 outstr.
rhs << ( zypp::indeterminate(
error ) ?
_(
"not found") : (
error ?
_(
"error") :
_(
"done") ) );
350 cout << outline << endl << std::flush;
361 if ( startdesc.empty() )
367 cout << startdesc << endl;
369 std::ostringstream pstr;
373 if ( ! poptions.
empty() )
386 for (
char ch : pstr.str() )
394 else if ( ch ==
'\033' )
404 static const size_t resets[] = { 0,3,6,1,4,7,2,5 };
405 for (
size_t i = resets[8-invis]; i; --i )
410 std::cout << pstr.str() << std::flush;
420 cout <<
_(
"No help available for this prompt.") << endl;
426 for (
unsigned idx = 0; idx < poptions.
options().size(); ++idx )
431 cout << ( fopt % ++pos % poptions.
options()[idx] );
434 const std::string & help { poptions.
optionHelp(idx) };
455 if ( !ioctl( 1, TIOCGWINSZ, &wns ) )
void progressStart(const std::string &id, const std::string &label, bool is_tick) override
Start of an operation with reported progress.
virtual std::string zyppExceptionReport(const zypp::Exception &e)
Return a Exception as a string suitable for output.
void prompt(PromptId id, const std::string &prompt, const PromptOptions &poptions, const std::string &startdesc) override
Prompt the user for a decision.
void dwnldProgress(const zypp::Url &uri, int value, long rate) override
Reports download progress.
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Colored string if do_colors.
void progress(const std::string &id, const std::string &label, int value) override
Progress report for an on-going operation.
Store and operate with byte count.
Base class for producing common (for now) zypper output.
bool do_colors()
If output is done in colors (depends on config)
CCString< ColorContext::NEGATIVE > NEGATIVEString
bool infoWarningFilter(Verbosity verbosity, Type mask)
void warning(const std::string &msg, Verbosity verbosity, Type mask) override
Show a warning.
String related utilities and Regular expression matching.
void error(const std::string &problem_desc, const std::string &hint) override
Show an error message and an optional hint.
Example: PromptOptions popts; popts.setOptions(_("y/n/p"), 0 / * default reply * /); popts...
Verbosity verbosity() const
Get current verbosity.
void displayProgress(const std::string &s, int percent)
const StrVector & options() const
CCString< ColorContext::CHANGE > CHANGEString
bool mine(Type type) override
Determine whether the output is intended for the particular type.
Default output verbosity level.
bool do_ttyout()
True unless output is a dumb tty or file.
bool isDisabled(unsigned opt) const
virtual unsigned termwidth() const
Width for formatted output [0==unlimited].
void dwnldProgressStart(const zypp::Url &uri) override
Reoprt start of a download.
const EscapeSequence cursorUP
Cursor up 1 line.
Colored stream output if do_colors.
zypp::DefaultIntegral< int,-1 > percentHint
std::string get() const
Return plain line made of lhs + rhs.
std::ostream & PROGRESS_FLUSH(std::ostream &str)
unsigned termwidth() const override
Width for formatted output [0==unlimited].
virtual bool progressFilter()
Determine whether to show progress.
Only important messages (no progress or status, only the result).
Verbosity
Verbosity levels.
void dwnldProgressEnd(const zypp::Url &uri, long rate, zypp::TriBool error) override
Reports end of a download.
ColorString optionString() const
Option string (may have embedded color codes)
Base class for Exception.
const std::string & optionHelp(unsigned opt) const
std::string getPathName(EEncoding eflag=zypp::url::E_DECODED) const
Returns the path name from the URL.
const char * optBlankAfter(const std::string &str_r)
void displayTick(const std::string &s)
void infoLine(const TermLine &msg, Verbosity verbosity, Type mask) override
info taking a TermLine
static const std::string & SGRReset()
ANSI SGR sesquence to reset all attributes.
TypeBit type() const
Return the type of the instance.
OutNormal(Verbosity verbosity=NORMAL)
const EscapeSequence clearLN
Clear entire line.
void progressEnd(const std::string &id, const std::string &label, const std::string &donetag, bool error) override
End of an operation with reported progress.
void promptHelp(const PromptOptions &poptions) override
Print help for prompt, if available.