output = SubstVar(output, "${color:highlight}", _config->Find("APT::Color::Highlight", ""));
output = SubstVar(output, "${color:neutral}", _config->Find("APT::Color::Neutral", ""));
output = SubstVar(output, "${Description}", GetShortDescription(CacheFile, records, P));
- output = SubstVar(output, "${LongDescription}", GetLongDescription(CacheFile, records, P));
+ if (output.find("${LongDescription}") != string::npos)
+ output = SubstVar(output, "${LongDescription}", GetLongDescription(CacheFile, records, P));
output = SubstVar(output, "${ }${ }", "${ }");
output = SubstVar(output, "${ }\n", "\n");
output = SubstVar(output, "${ }", " ");
// YnPrompt - Yes No Prompt. /*{{{*/
// ---------------------------------------------------------------------
/* Returns true on a Yes.*/
-bool YnPrompt(bool Default)
+bool YnPrompt(char const * const Question, bool Default)
{
+ auto const AssumeYes = _config->FindB("APT::Get::Assume-Yes",false);
+ auto const AssumeNo = _config->FindB("APT::Get::Assume-No",false);
+ // if we ask interactively, show warnings/notices before the question
+ if (AssumeYes == false && AssumeNo == false)
+ {
+ if (_config->FindI("quiet",0) > 0)
+ _error->DumpErrors(c2out);
+ else
+ _error->DumpErrors(c2out, GlobalError::DEBUG);
+ }
+
+ c2out << Question << std::flush;
+
/* nl_langinfo does not support LANGUAGE setting, so we unset it here
to have the help-message (hopefully) match the expected characters */
char * language = getenv("LANGUAGE");
free(language);
}
- if (_config->FindB("APT::Get::Assume-Yes",false) == true)
+ if (AssumeYes)
{
// TRANSLATOR: "Yes" answer printed for a yes/no question if --assume-yes is set
c1out << _("Y") << std::endl;
return true;
}
- else if (_config->FindB("APT::Get::Assume-No",false) == true)
+ else if (AssumeNo)
{
// TRANSLATOR: "No" answer printed for a yes/no question if --assume-no is set
c1out << _("N") << std::endl;
// AnalPrompt - Annoying Yes No Prompt. /*{{{*/
// ---------------------------------------------------------------------
/* Returns true on a Yes.*/
-bool AnalPrompt(const char *Text)
+bool AnalPrompt(std::string const &Question, const char *Text)
{
+ if (_config->FindI("quiet",0) > 0)
+ _error->DumpErrors(c2out);
+ else
+ _error->DumpErrors(c2out, GlobalError::DEBUG);
+ c2out << Question << std::flush;
+
char Buf[1024];
std::cin.getline(Buf,sizeof(Buf));
if (strcmp(Buf,Text) == 0)