[sword-svn] r3489 - trunk/utilities

scribe at crosswire.org scribe at crosswire.org
Sat Sep 2 02:30:14 MST 2017


Author: scribe
Date: 2017-09-02 02:30:13 -0700 (Sat, 02 Sep 2017)
New Revision: 3489

Modified:
   trunk/utilities/installmgr.cpp
Log:
added describe function to installmgr

Modified: trunk/utilities/installmgr.cpp
===================================================================
--- trunk/utilities/installmgr.cpp	2017-08-18 16:22:22 UTC (rev 3488)
+++ trunk/utilities/installmgr.cpp	2017-09-02 09:30:13 UTC (rev 3489)
@@ -305,6 +305,26 @@
 }
 
 
+void remoteDescribeModule(const char *sourceName, const char *modName) {
+	init();
+	InstallSourceMap::iterator source = installMgr->sources.find(sourceName);
+	if (source == installMgr->sources.end()) {
+		fprintf(stderr, "Couldn't find remote source [%s]\n", sourceName);
+		finish(-3);
+	}
+	SWMgr *mgr = source->second->getMgr();
+	SWModule *m = mgr->getModule(modName);
+	if (source == installMgr->sources.end()) {
+		fprintf(stderr, "Couldn't find module [%s] in source [%s]\n", modName, sourceName);
+		finish(-3);
+	}
+	cout << "Module Description\n\n";
+	for (ConfigEntMap::const_iterator it = m->getConfig().begin(); it != m->getConfig().end(); ++it) {
+		cout << "[" << it->first << "]:" << it->second << "\n";
+	}
+}
+
+
 void localDirListModules(const char *dir) {
 	cout << "Available Modules:\n\n";
 	SWMgr mgr(dir);
@@ -375,6 +395,7 @@
 		"\t-r  <remoteSrcName>\t\trefresh remote source\n"
 		"\t-rl <remoteSrcName>\t\tlist available modules from remote source\n"
 		"\t-rd <remoteSrcName>\t\tlist new/updated modules from remote source\n"
+		"\t-rdesc <remoteSrcName> <modName>\tdescribe module from remote source\n"
 		"\t-ri <remoteSrcName> <modName>\tinstall module from remote source\n"
 		"\t-l\t\t\t\tlist installed modules\n"
 		"\t-u <modName>\t\t\tuninstall module\n"
@@ -444,6 +465,14 @@
 			if (i+1 < argc) remoteListModules(argv[++i], true);
 			else usage(*argv, "-rd requires <remoteSrcName>");
 		}
+		else if (!strcmp(argv[i], "-rdesc")) {	// describe remove module
+			if (i+2 < argc) {
+				const char *source = argv[++i];
+				const char *modName = argv[++i];
+				remoteDescribeModule(source, modName);
+			}
+			else usage(*argv, "-rdesc requires <remoteSrcName> <modName>");
+		}
 		else if (!strcmp(argv[i], "-ri")) {	// install from remote directory
 			if (i+2 < argc) {
 				const char *source = argv[++i];




More information about the sword-cvs mailing list