Revision: 41644
http://brlcad.svn.sourceforge.net/brlcad/?rev=41644&view=rev
Author: davidloman
Date: 2010-12-16 15:46:17 +0000 (Thu, 16 Dec 2010)
Log Message:
-----------
Implement HelpCmd.
Modified Paths:
--------------
rt^3/trunk/src/GS/cmds/HelpCmd.cxx
Modified: rt^3/trunk/src/GS/cmds/HelpCmd.cxx
===================================================================
--- rt^3/trunk/src/GS/cmds/HelpCmd.cxx 2010-12-16 15:40:09 UTC (rev 41643)
+++ rt^3/trunk/src/GS/cmds/HelpCmd.cxx 2010-12-16 15:46:17 UTC (rev 41644)
@@ -56,15 +56,59 @@
/* display list of cmds */
QList<QString>* cmds = ccReg->getListOfCmds();
+ this->log->logINFO("HelpCmd", "Available commands:");
+ QString out("");
+ for (int i = 0; i < cmds->length(); ++i) {
+ out.append("\t");
+
+ /* Append the new cmd name */
+ out.append(cmds->at(i));
+
+ /* as long as we are not the last command, append a
comma */
+ if (i+1 < cmds->length())
+ out.append(", ");
+
+ /* every 5th command, start a new line. */
+ if ((i+1) % 5 == 0) {
+ this->log->logINFO("HelpCmd", out);
+ out = ""; /* reset for next loop pass */
+ }
+ }
+
+ /* flush if anything is left. */
+ if (out.length() != 0)
+ this->log->logINFO("HelpCmd", out);
+
+
delete cmds;
return true;
- }
+ } else {
+ /* display specifics of a single cmd */
+ QString cmd = args.at(0);
+ if(cmd.length() == 0) {
+ this->log->logERROR("HelpCmd", "Zero Length Cmd
provided to help.");
+ return false;
+ }
+ AbstractClientCmd* acc = ccReg->getCmd(cmd);
+ if(acc == NULL) {
+ this->log->logERROR("HelpCmd", "NULL AbstractClientCmd
returned from ClientCmdRegistry for '" + cmd + "'.");
+ return false;
+ }
+ QString usage = acc->getUsage();
+ QString help = acc->getHelp();
+
+ this->log->logINFO("HelpCmd", usage);
+ this->log->logINFO("HelpCmd", help);
+
+ return true;
+ }
+
}
/*
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits