private static void AddFormat(MDocCommand self, Dictionary <string, List <string> > d, string format, string file) { if (format == null) { self.Error("No format specified."); } List <string> l; if (!d.TryGetValue(format, out l)) { l = new List <string> (); d.Add(format, l); } l.Add(file); }
public static Option[] CreateFormatOptions (MDocCommand self, Dictionary<string, List<string>> formats) { string cur_format = "ecma"; var options = new OptionSet () { { "f|format=", "The documentation {FORMAT} used in DIRECTORIES. " + "Valid formats include:\n " + string.Join ("\n ", ValidFormats) + "\n" + "If not specified, the default format is `ecma'.", v => { if (Array.IndexOf (ValidFormats, v) < 0) self.Error ("Invalid documentation format: {0}.", v); cur_format = v; } }, { "<>", v => AddFormat (self, formats, cur_format, v) }, }; return new Option[]{options[0], options[1]}; }
public static Option[] CreateFormatOptions(MDocCommand self, Dictionary <string, List <string> > formats) { string cur_format = "ecma"; var options = new OptionSet() { { "f|format=", "The documentation {FORMAT} used in DIRECTORIES. " + "Valid formats include:\n " + string.Join("\n ", ValidFormats) + "\n" + "If not specified, the default format is `ecma'.", v => { if (Array.IndexOf(ValidFormats, v) < 0) { self.Error("Invalid documentation format: {0}.", v); } cur_format = v; } }, { "<>", v => AddFormat(self, formats, cur_format, v) }, }; return(new Option[] { options[0], options[1] }); }
private static void AddFormat (MDocCommand self, Dictionary<string, List<string>> d, string format, string file) { if (format == null) self.Error ("No format specified."); List<string> l; if (!d.TryGetValue (format, out l)) { l = new List<string> (); d.Add (format, l); } l.Add (file); }