cout_v << flush;
}
+// ----------------------------------------------------------------------------
+
void display_tick (const string& s) {
static AliveCursor cursor;
cout_v << flush;
}
+// ----------------------------------------------------------------------------
+
void display_done (const string& s) {
static AliveCursor cursor;
cout_v << flush;
}
+// ----------------------------------------------------------------------------
+
void display_done () {
cout_v << endl;
}
+// ----------------------------------------------------------------------------
+
//template<typename Action>
//Action ...
int read_action_ari (int default_action) {
return default_action;
}
+// ----------------------------------------------------------------------------
+
+// return the default value on input failure
+// TODO make this locale dependent?
+bool read_bool_with_default (bool defval) {
+ istream & stm = cin;
+
+ string c = "";
+ while (stm.good () && c != "y" && c != "Y" && c != "N" && c != "n")
+ c = zypp::str::getline (stm, zypp::str::TRIM);
+
+ if (c == "y" || c == "Y")
+ return true;
+ else if (c == "n" || c == "N")
+ return false;
+ else
+ return defval;
+}
+
+// ----------------------------------------------------------------------------
+
+// Read an answer (ynYN)
+// Defaults to 'false'
+bool readBoolAnswer()
+{
+ return read_bool_with_default (false);
+}
+
+// ----------------------------------------------------------------------------
+
string to_string (zypp::Resolvable::constPtr resolvable) {
ostringstream ss;
ss << *resolvable;
* is ignored.
*/
int read_action_ari (int default_action = -1);
+
+/**
+ * Prompt for Yes/No answer from stdin.
+ *
+ * \todo work with default
+ * \todo non-interactive mode
+ * \todo make this localized
+ */
+bool readBoolAnswer();
+
std::string to_string (zypp::Resolvable::constPtr resolvable);
#endif
#include <zypp/Digest.h>
#include "AliveCursor.h"
-#include "zypper-misc.h"
+#include "zypper-callbacks.h"
///////////////////////////////////////////////////////////////////
namespace zypp {
return readBoolAnswer();
}
-#ifndef LIBZYPP_1xx
virtual bool askUserToImportKey( const PublicKey &key )
{
if ( geteuid() != 0 )
cout << CLEARLN << _("Import key ") << key.id() << _(" to trusted keyring?") << " [y/n]: " << flush;
return readBoolAnswer();
}
-#endif
-#ifdef LIBZYPP_1xx
- virtual bool askUserToAcceptUnknownKey( const std::string &file, const std::string &id, const std::string &/*keyname*/, const std::string &/*fingerprint*/ )
-#else
virtual bool askUserToAcceptUnknownKey( const std::string &file, const std::string &id )
-#endif
{
cout << CLEARLN << file << _(" is signed with an unknown key id: ") << id << ", " << _("continue?") << " [y/n]: " << flush;
return readBoolAnswer();
}
-#ifdef LIBZYPP_1xx
- virtual bool askUserToTrustKey( const std::string &keyid, const std::string &keyname, const std::string &fingerprint) {
-#else
- virtual bool askUserToTrustKey( const PublicKey &key ) {
+ virtual bool askUserToTrustKey( const PublicKey &key )
+ {
const std::string& keyid = key.id(), keyname = key.name(),
fingerprint = key.fingerprint();
-#endif
cout << CLEARLN << _("Do you want to trust key id ") << keyid << " " << keyname << _(" fingerprint:") << fingerprint << " ? [y/n]: " << flush;
return readBoolAnswer();
}
-#ifdef LIBZYPP_1xx
- virtual bool askUserToAcceptVerificationFailed( const std::string &file, const std::string &keyid, const std::string &keyname, const std::string &fingerprint ) {
-#else
- virtual bool askUserToAcceptVerificationFailed( const std::string &file,const PublicKey &key ) {
+ virtual bool askUserToAcceptVerificationFailed( const std::string &file,const PublicKey &key )
+ {
const std::string& keyid = key.id(), keyname = key.name(),
fingerprint = key.fingerprint();
-#endif
cout << file << _("Signature verification for ") << file
<< _(" with public key id ") << keyid << " " << keyname << _(" fingerprint:") << fingerprint << _(" failed, THIS IS RISKY!") << ". " << _("continue?") << " [y/n]: " << endl;
return readBoolAnswer(); // TODO do this with format()
#include <fstream>
#include <sstream>
#include <boost/format.hpp>
-#include "zypper.h"
-#include "zypper-misc.h"
#include <zypp/Patch.h>
#include <zypp/base/Algorithm.h>
#include <zypp/RepoInfo.h>
#include <zypp/repo/RepoException.h>
+#include "zypper.h"
+#include "zypper-misc.h"
+#include "zypper-callbacks.h"
+
using namespace zypp::detail;
using namespace std;
}
}
-// return the default value on input failure
-// TODO make this locale dependent?
-bool read_bool_with_default (bool defval) {
- istream & stm = cin;
-
- string c = "";
- while (stm.good () && c != "y" && c != "Y" && c != "N" && c != "n")
- c = zypp::str::getline (stm, zypp::str::TRIM);
-
- if (c == "y" || c == "Y")
- return true;
- else if (c == "n" || c == "N")
- return false;
- else
- return defval;
-}
-
-// Read an answer (ynYN)
-// Defaults to 'false'
-bool readBoolAnswer()
-{
- return read_bool_with_default (false);
-}
-
// converts a user-supplied kind to a zypp kind object
// returns an empty one if not recognized
ResObject::Kind string_to_kind (const string &skind)
*/
void cond_init_target();
-bool readBoolAnswer();
zypp::ResObject::Kind string_to_kind (const std::string &skind);
void mark_for_install( const zypp::ResObject::Kind &kind,
const std::string &name );