|
From: <bni...@us...> - 2006-11-30 18:07:12
|
Revision: 411
http://svn.sourceforge.net/omc/?rev=411&view=rev
Author: bnicholes
Date: 2006-11-30 10:07:12 -0800 (Thu, 30 Nov 2006)
Log Message:
-----------
allow the show command to recognize the default display option value in the clp setting data instance
Modified Paths:
--------------
clp/trunk/src/omcclpcmdshow.cpp
clp/trunk/src/omcclpcommand.cpp
clp/trunk/src/omcclpprint.cpp
Modified: clp/trunk/src/omcclpcmdshow.cpp
===================================================================
--- clp/trunk/src/omcclpcmdshow.cpp 2006-11-30 16:23:14 UTC (rev 410)
+++ clp/trunk/src/omcclpcmdshow.cpp 2006-11-30 18:07:12 UTC (rev 411)
@@ -368,12 +368,21 @@
}
}
+ String defaultDisplayType;
+
+ /* Only get the default display type if one was not specified
+ on the command line. */
+ if (!hasOption(E_OPT_DISPLAY))
+ {
+ defaultDisplayType = getOptionValueString(E_OPT_DISPLAY);
+ defaultDisplayType.toLowerCase();
+ }
+
Int32 targetLevel = getOptionValueInt(E_OPT_LEVEL);
/* Get the targets display option if it was specified on the command line.*/
- displaySubOption = hasOption(E_OPT_DISPLAY, E_SUBOPT_TARGETS);
-
- if (displaySubOption || (targetLevel != 1))
+ displaySubOption = (hasOption(E_OPT_DISPLAY, E_SUBOPT_TARGETS) || hasOption(E_OPT_DISPLAY, E_SUBOPT_ALL));
+ if ((displaySubOption || defaultDisplayType.startsWith("t")) || (targetLevel != 1))
{
setTargetsForTargets(m_cimObjectPathInfoArray, targetLevel);
}
@@ -387,9 +396,8 @@
/* Get the verbs display option if it was specified on the command line. If
we are to display valid verbs, then look up the verbs in the address
data file */
- displaySubOption = hasOption(E_OPT_DISPLAY, E_SUBOPT_VERBS);
-
- if (displaySubOption)
+ displaySubOption = (hasOption(E_OPT_DISPLAY, E_SUBOPT_VERBS) || hasOption(E_OPT_DISPLAY, E_SUBOPT_ALL));
+ if (displaySubOption || defaultDisplayType.startsWith("v"))
{
setValidCmdsForTargets(m_cimObjectPathInfoArray, targetLevel);
}
@@ -397,9 +405,8 @@
/* Get the associations display option if it was specified on the command line. If
we are to display the associations, then look up the verbs in the address
data file */
- displaySubOption = hasOption(E_OPT_DISPLAY, E_SUBOPT_ASSOCIATIONS);
-
- if (displaySubOption)
+ displaySubOption = (hasOption(E_OPT_DISPLAY, E_SUBOPT_ASSOCIATIONS) || hasOption(E_OPT_DISPLAY, E_SUBOPT_ALL));
+ if (displaySubOption || defaultDisplayType.startsWith("as"))
{
setAssociationsForTargets(m_cimObjectPathInfoArray, targetLevel);
}
Modified: clp/trunk/src/omcclpcommand.cpp
===================================================================
--- clp/trunk/src/omcclpcommand.cpp 2006-11-30 16:23:14 UTC (rev 410)
+++ clp/trunk/src/omcclpcommand.cpp 2006-11-30 18:07:12 UTC (rev 411)
@@ -304,7 +304,8 @@
one that machines the specified criteria */
for (int i=0; i<m_options.size(); i++)
{
- if (m_options[i]->getOptionType() == o && m_options[i]->getOptionSubtype() == so)
+ if ((m_options[i]->getOptionType() == o) &&
+ ((m_options[i]->getOptionSubtype() == so) || (so == E_SUBOPT_NONE)))
{
opt = m_options[i];
break;
Modified: clp/trunk/src/omcclpprint.cpp
===================================================================
--- clp/trunk/src/omcclpprint.cpp 2006-11-30 16:23:14 UTC (rev 410)
+++ clp/trunk/src/omcclpprint.cpp 2006-11-30 18:07:12 UTC (rev 411)
@@ -197,18 +197,68 @@
CIMClient *cc = clpSession->getCIMClient();
std::ostream& clpout(clpSession->clpout());
StringArray displayProp;
- bool displayTargets, displayAssociations, displayProperties, displayVerbs;
+ bool displayTargets(false), displayAssociations(false);
+ bool displayProperties(false), displayVerbs(false);
const StringArray verbs = copi->getCmdVerbs();
const CIMObjectPath cop = copi->getCimObjectPath();
String indent;
if (copi->getIsDisplayible())
{
- displayTargets = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_TARGETS);
- displayAssociations = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_ASSOCIATIONS);
- displayProperties = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_PROPERTIES);
- displayVerbs = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_VERBS);
+ /* If a display option was specified, the use it. Otherwise use
+ the default option from the CLP session object.*/
+ if (m_showCmd->hasOption(E_OPT_DISPLAY))
+ {
+ if (m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_ALL))
+ {
+ displayAssociations = true;
+ displayProperties = true;
+ displayTargets = true;
+ displayVerbs = true;
+ }
+ else
+ {
+ displayTargets = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_TARGETS);
+ displayAssociations = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_ASSOCIATIONS);
+ displayProperties = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_PROPERTIES);
+ displayVerbs = m_showCmd->hasOption(E_OPT_DISPLAY, E_SUBOPT_VERBS);
+ }
+ }
+ else
+ {
+ String displayType = m_showCmd->getOptionValueString(E_OPT_DISPLAY);
+ if (displayType.length())
+ {
+ displayType.toLowerCase();
+ char token = displayType.charAt(0);
+ switch (token) {
+ case 'p':
+ displayProperties = true;
+ break;
+ case 't':
+ displayTargets = true;
+ break;
+ case 'v':
+ displayVerbs = true;
+ break;
+ case 'a':
+ if (displayType.startsWith("al"))
+ {
+ displayAssociations = true;
+ displayProperties = true;
+ displayTargets = true;
+ displayVerbs = true;
+ }
+ else if (displayType.startsWith("as"))
+ {
+ displayAssociations = true;
+ }
+ break;
+ }
+ }
+ }
+
// When getting the instance, get just the properties that were specified in the command
// If no properties were specified, then get all properties.
displayProp = m_showCmd->getOptionValueArray(E_OPT_DISPLAY, E_SUBOPT_PROPERTIES);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|