From: Ján Kupec Date: Wed, 11 Mar 2009 13:44:47 +0000 (+0100) Subject: Get rid of CommandOptions - it has no future :O) X-Git-Tag: 1.2.6~124 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=36de38896e8c8745d2835981afa3c579bce02e33;p=platform%2Fupstream%2Fzypper.git Get rid of CommandOptions - it has no future :O) --- diff --git a/src/Zypper.cc b/src/Zypper.cc index 67703c4..8d802e5 100644 --- a/src/Zypper.cc +++ b/src/Zypper.cc @@ -735,10 +735,7 @@ void Zypper::shellCleanup() _arguments.clear(); // clear command options if (!_copts.empty()) - { _copts.clear(); - _cmdopts = CommandOptions(); - } // clear the command _command = ZypperCommand::NONE; // clear command help text @@ -2970,10 +2967,6 @@ void Zypper::doCommand() return; } - if (copts.count("auto-agree-with-licenses") - || copts.count("agree-to-third-party-licenses")) - _cmdopts.license_auto_agree = true; - // check root user if (geteuid() != 0 && !globalOpts().changedRoot) { @@ -3587,10 +3580,6 @@ void Zypper::doCommand() if (copts.count("no-confirm")) _gopts.non_interactive = true; - if (copts.count("auto-agree-with-licenses") - || copts.count("agree-to-third-party-licenses")) - _cmdopts.license_auto_agree = true; - ResKindSet kinds; if (copts.count("type")) { @@ -3670,9 +3659,6 @@ void Zypper::doCommand() return; } - if (copts.count("auto-agree-with-licenses")) - _cmdopts.license_auto_agree = true; - initRepoManager(); init_target(*this); init_repos(*this); diff --git a/src/Zypper.h b/src/Zypper.h index 47d64f0..a1fd7b2 100644 --- a/src/Zypper.h +++ b/src/Zypper.h @@ -84,17 +84,6 @@ struct GlobalOptions bool changedRoot; }; - -struct CommandOptions -{ - CommandOptions() - : - license_auto_agree(false) - {} - - bool license_auto_agree; -}; - struct RuntimeData { RuntimeData() @@ -171,7 +160,6 @@ public: // setters & getters Out & out(); const GlobalOptions & globalOpts() const { return _gopts; } - const CommandOptions & cmdOpts() const { return _cmdopts; } const parsed_opts & cOpts() const { return _copts; } const ZypperCommand & command() const { return _command; } const std::string & commandHelp() const { return _command_help; } @@ -217,7 +205,6 @@ private: Out * _out_ptr; GlobalOptions _gopts; - CommandOptions _cmdopts; parsed_opts _copts; ZypperCommand _command; ArgList _arguments; diff --git a/src/misc.cc b/src/misc.cc index 926cd26..b04fa73 100644 --- a/src/misc.cc +++ b/src/misc.cc @@ -123,13 +123,16 @@ ostream& operator << (ostream & stm, ios::iostate state) bool confirm_licenses(Zypper & zypper) { bool confirmed = true; + bool license_auto_agree = + zypper.cOpts().count("auto-agree-with-licenses") + || zypper.cOpts().count("agree-to-third-party-licenses"); for (ResPool::const_iterator it = God->pool().begin(); it != God->pool().end(); ++it) { if (it->status().isToBeInstalled() && !it->resolvable()->licenseToConfirm().empty()) { - if (zypper.cmdOpts().license_auto_agree) + if (license_auto_agree) { zypper.out().info(boost::str( // TranslatorExplanation The first %s is name of the resolvable, the second is its kind (e.g. 'zypper package') @@ -173,7 +176,7 @@ bool confirm_licenses(Zypper & zypper) // lincense prompt string question = _("Do you agree with the terms of the license?"); //! \todo add 'v' option to view the license again, add prompt help - if (!read_bool_answer(PROMPT_YN_LICENSE_AGREE, question, zypper.cmdOpts().license_auto_agree)) + if (!read_bool_answer(PROMPT_YN_LICENSE_AGREE, question, license_auto_agree)) { confirmed = false;