Management servers, as well as local files.
.TP
-.B addrepo (ar) [options] <URI> [<alias>]
+.B addrepo (ar) [options] <URI> <alias>
+.B addrepo (ar) [options] <FILE.repo>
+
Add a new repository specified by URI and assign specified alias to it or specify URI to repo file.
Newly added repositories have auto-refresh disabled by default (except for repositories
//comparator for RepoInfo set
-class RepoInfoAliasComparator{
- public: bool operator()(const zypp::RepoInfo &a, const zypp::RepoInfo& b){
+class RepoInfoAliasComparator
+{
+ public: bool operator()(const zypp::RepoInfo &a, const zypp::RepoInfo& b)
+ {
return a.alias()<b.alias();
}
};
+/**
+ * checks name for .repo string
+ */
+inline bool isRepoFile(const std::string& name)
+{
+ return name.find(".repo") != name.npos ;
+}
+
#endif /*ZYPPER_UTILS_H*/
setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS);
return;
case 1:
+ if( !isRepoFile(_arguments[0] ))
+ {
+ out().error(
+ _("If only one argument is used, it must be a URI pointing to a .repo file."));
+ ERR << "Not repo file." << endl;
+ out().info(_command_help);
+ setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS);
+ return;
+ }
add_repo_from_file(*this,_arguments[0], enabled);
break;
case 2: