- --name added to modifyrepo
authorJan Kupec <jkupec@suse.cz>
Wed, 7 May 2008 10:51:02 +0000 (10:51 +0000)
committerJan Kupec <jkupec@suse.cz>
Wed, 7 May 2008 10:51:02 +0000 (10:51 +0000)
- -R is now used for --no-refresh
- -a is now used for --all
- deprecated warning added for --enable-autorefresh and
  --disable-autorefresh options
- help text adapted

src/zypper-repos.cc
src/zypper.cc

index 8be6afb..bbf283a 100644 (file)
@@ -1652,8 +1652,16 @@ void modify_repo(Zypper & zypper, const string & alias)
       }
     }
 
+    string name;
+    if ((tmp1 = zypper.cOpts().find("name")) != zypper.cOpts().end())
+    {
+      name = *tmp1->second.begin();
+      if (!name.empty())
+        repo.setName(name);
+    }
+
     if (chnaged_enabled || changed_autoref || changed_prio
-        || changed_keeppackages)
+        || changed_keeppackages || !name.empty())
     {
       manager.modifyRepository(alias, repo);
 
@@ -1692,6 +1700,12 @@ void modify_repo(Zypper & zypper, const string & alias)
         zypper.out().info(boost::str(format(
           _("Repository '%s' priority has been set to %d.")) % alias % prio));
       }
+      
+      if (!name.empty())
+      {
+        zypper.out().info(boost::str(format(
+          _("Name of repository '%s' has been set to '%s'.")) % alias % name));
+      }
     }
     else
     {
index 4de6262..aede437 100644 (file)
@@ -1065,31 +1065,44 @@ void Zypper::processCommandOptions()
       {"disable", no_argument, 0, 'd'},
       {"enable", no_argument, 0, 'e'},
       {"refresh", no_argument, 0, 'r'},
-      {"enable-autorefresh", no_argument, 0, 'a'}, // backward compatibility
-      {"no-refresh", no_argument, 0, 'n'},
+      {"enable-autorefresh", no_argument, 0, }, // backward compatibility
+      {"no-refresh", no_argument, 0, 'R'},
       {"disable-autorefresh", no_argument, 0, 0 }, // backward compatibility
+      {"name", required_argument, 0, 'n'},
       {"priority", required_argument, 0, 'p'},
       {"keep-packages", no_argument, 0, 'k'},
-      {"no-keep-packages", no_argument, 0, 'K'}, //TODO not documented
-      {"all", no_argument, 0, 'A' }, //TODO not documented
-      {"local", no_argument, 0, 'l' }, //TODO not documented
-      {"remote", no_argument, 0, 't' }, //TODO not documented
-      {"medium-type", required_argument, 0, 'm' }, //TODO not documented
+      {"no-keep-packages", no_argument, 0, 'K'},
+      {"all", no_argument, 0, 'a' },
+      {"local", no_argument, 0, 'l' },
+      {"remote", no_argument, 0, 't' },
+      {"medium-type", required_argument, 0, 'm' },
       {0, 0, 0, 0}
     };
     specific_options = service_modify_options;
-    _command_help = _(
+    _command_help = str::form(_(
+      // translators: %s is "--all|--remote|--local|--medium-type"
+      // and "--all, --remote, --local, --medium-type" 
       "modifyrepo (mr) <options> <alias|#|URI>\n"
+      "modifyrepo (mr) <options> <%s>\n"
       "\n"
-      "Modify properties of the repository specified by alias, number or URI.\n"
+      "Modify properties of repositories specified by alias, number or URI or by"
+      " the '%s' aggregate options.\n"
       "\n"
       "  Command options:\n"
       "-d, --disable             Disable the repository (but don't remove it).\n"
       "-e, --enable              Enable a disabled repository.\n"
       "-r, --refresh             Enable auto-refresh of the repository.\n"
-      "-n, --no-refresh          Disable auto-refresh of the repository.\n"
-      "-p, --priority <1-99>     Set priority of the repository. See the manual page for details.\n"
-    );
+      "-R, --no-refresh          Disable auto-refresh of the repository.\n"
+      "-n, --name                Set a descriptive name for the repository.\n"
+      "-p, --priority <1-99>     Set priority of the repository.\n"
+      "-k, --keep-packages       Enable RPM files caching.\n"
+      "-K, --no-keep-packages    Disable RPM files caching.\n"
+      "-a, --all                 Apply changes to all repositories.\n"
+      "-l, --local               Apply changes to all local repositories.\n"
+      "-t, --remote              Apply changes to all remote repositories.\n"
+      "-m, --medium-type <type>  Apply changes to repositories of specified type.\n"
+    ), "--all|--remote|--local|--medium-type"
+     , "--all, --remote, --local, --medium-type");
     break;
   }
 
@@ -2159,13 +2172,20 @@ void Zypper::doCommand()
       return;
     }
 
+    //! \todo drop before 11.1
+    if (_copts.count("enable-autorefresh"))
+      out().warning(str::form(_("'%s' option is deprecated and will be dropped soon."), "enable-autorefresh"));
+    if (_copts.count("disable-autorefresh"))
+      out().warning(str::form(_("'%s' option is deprecated and will be dropped soon."), "disable-autorefresh"));
+
     bool non_alias = copts.count("all") || copts.count("local") || 
         copts.count("remote") || copts.count("medium-type");
 
     if (_arguments.size() < 1 && !non_alias)
     {
-      //TODO add all option to help text
-      out().error(_("Alias is a required argument."));
+      // translators: aggregate option is e.g. "--all". This message will be
+      // followed by mr command help text which will explain it
+      out().error(_("Alias or an aggregate option is required."));
       ERR << "No alias argument given." << endl;
       out().info(_command_help);
       setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS);