Author: mhabersack
Date: 2007-11-21 14:28:19 -0500 (Wed, 21 Nov 2007)
New Revision: 90104
Modified:
trunk/mcs/tools/mconfig/ChangeLog
trunk/mcs/tools/mconfig/Mono.MonoConfig/FeatureNodeHandler.cs
trunk/mcs/tools/mconfig/mconfig.cs
Log:
2007-11-21 Marek Habersack <[EMAIL PROTECTED]>
* mconfig.cs: drop the -F and -C parameters, default config files,
features and commands are now listed when mconfig is ran without
any parameters or when no commands are given.
* Mono.MonoConfig/FeatureNodeHandler.cs: do not append leading and
trailing newlines to feature description.
Modified: trunk/mcs/tools/mconfig/ChangeLog
===================================================================
--- trunk/mcs/tools/mconfig/ChangeLog 2007-11-21 19:15:15 UTC (rev 90103)
+++ trunk/mcs/tools/mconfig/ChangeLog 2007-11-21 19:28:19 UTC (rev 90104)
@@ -1,3 +1,12 @@
+2007-11-21 Marek Habersack <[EMAIL PROTECTED]>
+
+ * mconfig.cs: drop the -F and -C parameters, default config files,
+ features and commands are now listed when mconfig is ran without
+ any parameters or when no commands are given.
+
+ * Mono.MonoConfig/FeatureNodeHandler.cs: do not append leading and
+ trailing newlines to feature description.
+
2007-11-13 Marek Habersack <[EMAIL PROTECTED]>
* data/config.xml: replaced the possibly conflicting default block
Modified: trunk/mcs/tools/mconfig/Mono.MonoConfig/FeatureNodeHandler.cs
===================================================================
--- trunk/mcs/tools/mconfig/Mono.MonoConfig/FeatureNodeHandler.cs
2007-11-21 19:15:15 UTC (rev 90103)
+++ trunk/mcs/tools/mconfig/Mono.MonoConfig/FeatureNodeHandler.cs
2007-11-21 19:28:19 UTC (rev 90104)
@@ -167,10 +167,10 @@
string desc = fn.Description;
if (String.IsNullOrEmpty (desc))
return ret.ToString ();
-
- string indent = " ";
+
+ string indent = " ";
int maxLineWidth = Console.WindowWidth - indent.Length;
- string[] dlines = desc.Split ('\n');
+ string[] dlines = desc.Trim ().Split ('\n');
string line;
foreach (string l in dlines) {
@@ -186,6 +186,7 @@
ret.AppendFormat ("{0}{1}\n", indent,
line);
}
+ ret.Append ("\n");
return ret.ToString ();
}
Modified: trunk/mcs/tools/mconfig/mconfig.cs
===================================================================
--- trunk/mcs/tools/mconfig/mconfig.cs 2007-11-21 19:15:15 UTC (rev 90103)
+++ trunk/mcs/tools/mconfig/mconfig.cs 2007-11-21 19:28:19 UTC (rev 90104)
@@ -57,29 +57,27 @@
" the standard ones.
Settings in this file override ones",
" in the other
files.",
" -t,--target={any,web,application} Use this target
when executing 'command'",
- " -C,--list-configs List all the
default config file names defined in the",
- " configuration
files.",
- " -F,--list-features List all the
features defined in the configuration files.",
"",
- "Commands:",
- " {addfeature,af} <feature_name> [config_file_path]",
- " {defconfig,dc} [config_name] [target_directory]"
+ "To see the list of commands, features and default
config file templates, run mconfig",
+ "without any parameters"
};
-
- public delegate void ListDefaultConfigsHandler ();
- public delegate void ListFeaturesHandler ();
- public event ListDefaultConfigsHandler OnListDefaultConfigs;
- public event ListFeaturesHandler OnListFeatures;
+ string[] usageCommands = {
+ "Available commands (see 'man mconfig' for details):",
+ " {addfeature,af} <feature_name> [config_file_path]",
+ " Add the named feature to the specified config
file",
+ "",
+ " {defconfig,dc} [template_name] [target_directory]",
+ " Write a config file based on the named template.",
+ ""
+ };
List <string> plain_arguments;
Dictionary <string, string> unknown_arguments;
public string ConfigFile;
public FeatureTarget Target = FeatureTarget.Any;
- public bool ListDefaultConfigs;
- public bool ListFeatures;
-
+
public Dictionary <string, string> UnknownArguments {
get {
if (unknown_arguments == null ||
unknown_arguments.Count == 0)
@@ -107,7 +105,7 @@
public void Parse (string[] args)
{
if (args == null || args.Length == 0)
- Usage ();
+ return;
int len = args.Length;
string arg;
@@ -198,16 +196,6 @@
}
break;
- case "C":
- case "list-configs":
- ListDefaultConfigs = true;
- break;
-
- case "F":
- case "list-features":
- ListFeatures = true;
- break;
-
default:
unknown_arguments.Add (argName,
argParam);
break;
@@ -230,13 +218,24 @@
Environment.Exit (1);
}
- public void Usage ()
+ void ShowUsage (string[] msg, bool exit)
{
- foreach (string line in usage)
+ foreach (string line in msg)
Console.WriteLine (line);
- Environment.Exit (1);
+ if (exit)
+ Environment.Exit (1);
}
+ public void Usage ()
+ {
+ ShowUsage (usage, true);
+ }
+
+ public void UsageCommands ()
+ {
+ ShowUsage (usageCommands, false);
+ }
+
void ShowVersion ()
{
Assembly asm = Assembly.GetExecutingAssembly () ??
Assembly.GetCallingAssembly ();
@@ -311,7 +310,7 @@
}
foreach (string item in list)
- Console.WriteLine (" {0}", item);
+ Console.WriteLine (" {0}", item);
}
static void PrintException (Exception ex, string format, params
object[] parms)
@@ -340,23 +339,12 @@
return 1;
}
- bool doQuit = false;
- if (options.ListDefaultConfigs) {
- DisplayList ("Default config files",
config.DefaultConfigFiles);
- doQuit = true;
- }
-
- if (options.ListFeatures) {
- DisplayList ("Available features",
config.Features);
- doQuit = true;
- }
-
- if (doQuit)
- return 0;
-
string[] commandArguments = options.PlainArguments;
if (commandArguments == null || commandArguments.Length
== 0) {
- options.Usage ();
+ options.UsageCommands ();
+ DisplayList ("Default config files:",
config.DefaultConfigFiles);
+ Console.WriteLine ();
+ DisplayList ("Available features:",
config.Features);
return 1;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches