Get rid of CommandOptions - it has no future :O)
authorJán Kupec <jkupec@suse.cz>
Wed, 11 Mar 2009 13:44:47 +0000 (14:44 +0100)
committerJán Kupec <jkupec@suse.cz>
Wed, 11 Mar 2009 13:44:47 +0000 (14:44 +0100)
src/Zypper.cc
src/Zypper.h
src/misc.cc

index 67703c4..8d802e5 100644 (file)
@@ -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);
index 47d64f0..a1fd7b2 100644 (file)
@@ -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;
index 926cd26..b04fa73 100644 (file)
@@ -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;