Author: lslezak
Date: Wed Jul 27 14:19:28 2011
New Revision: 65031
URL: http://svn.opensuse.org/viewcvs/yast?rev=65031&view=rev
Log:
- command line - properly display multiline help texts (bnc#708553)
- 2.17.103
Modified:
branches/SuSE-Code-11-SP2-Branch/yast2/VERSION
branches/SuSE-Code-11-SP2-Branch/yast2/library/commandline/src/CommandLine.ycp
branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes
Modified: branches/SuSE-Code-11-SP2-Branch/yast2/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2/VERSION?rev=65031&r1=65030&r2=65031&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/yast2/VERSION (original)
+++ branches/SuSE-Code-11-SP2-Branch/yast2/VERSION Wed Jul 27 14:19:28 2011
@@ -1 +1 @@
-2.17.102
+2.17.103
Modified: branches/SuSE-Code-11-SP2-Branch/yast2/library/commandline/src/CommandLine.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2/library/commandline/src/CommandLine.ycp?rev=65031&r1=65030&r2=65031&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/yast2/library/commandline/src/CommandLine.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/yast2/library/commandline/src/CommandLine.ycp Wed Jul 27 14:19:28 2011
@@ -507,6 +507,11 @@
{
helptext = ((map)opthelp)[action]:"";
}
+ if (is(opthelp, list<string>))
+ {
+ string delim = sformat("\n %1 %2 ", String::Pad("",longestopt), String::Pad("", longestarg));
+ helptext = mergestring((list<string>)opthelp, delim);
+ }
else
{
y2error("Invalid data type of help text, only 'string' or 'map' types are allowed.");
@@ -603,8 +608,35 @@
});
maplist(string cmd, map desc, modulecommands["actions"]:$[], ``{
- // translators: error message: module does not provide any help messages
- Print(sformat(" %1 %2", String::Pad(cmd, longest), desc["help"]:_("No help available.")));
+ if (!haskey(desc, "help"))
+ {
+ // translators: error message: module does not provide any help messages
+ Print(sformat(" %1 %2", String::Pad(cmd, longest), _("No help available.")));
+ }
+ if (is(desc["help"]:nil, string))
+ {
+ Print(sformat(" %1 %2", String::Pad(cmd, longest), desc["help"]:""));
+ }
+ // multiline help text
+ else if (is(desc["help"]:nil, list<string>))
+ {
+ list<string> help = (list<string>)desc["help"]:[];
+
+ if (size(help) > 0)
+ {
+ Print(sformat(" %1 %2", String::Pad(cmd, longest), help[0]:""));
+ help = remove(help, 0);
+ }
+
+ foreach(string h, help, {
+ Print(sformat(" %1 %2", String::Pad("", longest), h));
+ });
+ }
+ else
+ {
+ // fallback message - invalid help has been provided by the yast module
+ Print(sformat(" %1 %2", String::Pad(cmd, longest), _("")));
+ }
});
Print("");
if( ! interactive ) {
Modified: branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes?rev=65031&r1=65030&r2=65031&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes (original)
+++ branches/SuSE-Code-11-SP2-Branch/yast2/package/yast2.changes Wed Jul 27 14:19:28 2011
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Wed Jul 27 09:29:36 UTC 2011 - lslezak@suse.cz
+
+- command line - properly display multiline help texts (bnc#708553)
+- 2.17.103
+
+-------------------------------------------------------------------
Tue Jul 26 15:47:38 CEST 2011 - jsuchome@suse.cz
- give full paths to public key files to isCompliant (bnc#706646)
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org