else {
Console.Error.WriteLine ("mdoc: {0}", e.Message);
}
- Console.Error.WriteLine ("See `mdoc help' for more information.");
+ Console.Error.WriteLine ("See `mdoc help' for more information or use --debug to diagnose.");
Environment.ExitCode = 1;
}
}
{ "update", new MDocUpdater () },
{ "update-ecma-xml", new MDocUpdateEcmaXml () },
{ "validate", new MDocValidator () },
+ { "index", new MDocIndex () },
+ { "preserve", new MDocPreserve () }
};
bool showVersion = false;
bool showHelp = false;
- var extra = new List<string> ();
var p = new OptionSet () {
{ "version", v => showVersion = v != null },
{ "v:", (int? v) => verbosity = v.HasValue ? v.Value : verbosity+1 },
{ "debug", v => debug = v != null },
{ "h|?|help", v => showHelp = v != null },
- { "<>", v => {
- if (v.Length > 0 && v [0] == '@')
- extra.AddRange (ReadResponseFile (v.Substring (1)));
- else
- extra.Add (v);
- } },
+ new ResponseFileSource (),
};
- p.Parse (args);
+ var extra = p.Parse (args);
if (showVersion) {
Console.WriteLine ("mdoc {0}", Consts.MonoVersion);
}
}
- // Cribbed from mcs/driver.cs:LoadArgs(string)
- static IEnumerable<string> ReadResponseFile (string file)
- {
- StreamReader response;
- try {
- response = File.OpenText (file);
- } catch {
- yield break;
- }
-
- using (response) {
- StringBuilder arg = new StringBuilder ();
-
- string line;
- while ((line = response.ReadLine ()) != null) {
- int t = line.Length;
-
- for (int i = 0; i < t; i++) {
- char c = line [i];
-
- if (c == '"' || c == '\'') {
- char end = c;
-
- for (i++; i < t; i++){
- c = line [i];
-
- if (c == end)
- break;
- arg.Append (c);
- }
- } else if (c == ' ') {
- if (arg.Length > 0) {
- yield return arg.ToString ();
- arg.Length = 0;
- }
- } else
- arg.Append (c);
- }
- if (arg.Length > 0) {
- yield return arg.ToString ();
- arg.Length = 0;
- }
- }
- }
- }
-
internal MDocCommand GetCommand (string command)
{
MDocCommand h;