2 using System.Collections.Generic;
7 namespace Mono.Documentation {
9 class MDocTreeDumper : MDocCommand {
11 public override void Run (IEnumerable<string> args)
13 var validFormats = RootTree.GetSupportedFormats ();
14 string cur_format = "";
15 var formats = new Dictionary<string, List<string>> ();
16 var options = new OptionSet () {
18 "The documentation {FORMAT} used in FILES. " +
19 "Valid formats include:\n " +
20 string.Join ("\n ", validFormats) + "\n" +
21 "If not specified, no HelpSource is used. This may " +
22 "impact the PublicUrls displayed for nodes.",
24 if (Array.IndexOf (validFormats, v) < 0)
25 Error ("Invalid documentation format: {0}.", v);
28 { "<>", v => AddFormat (formats, cur_format, v) },
30 List<string> files = Parse (options, args, "dump-tree",
32 "Print out the nodes within the assembled .tree FILES,\n" +
33 "as produced by 'mdoc assemble'.");
37 foreach (string format in formats.Keys) {
38 foreach (string file in formats [format]) {
39 HelpSource hs = format == ""
41 : RootTree.GetHelpSource (format, file.Replace (".tree", ""));
42 Tree t = new Tree (hs, file);
43 TreeDumper.PrintTree (t.RootNode);
48 private void AddFormat (Dictionary<string, List<string>> d, string format, string file)
53 if (!d.TryGetValue (format, out l)) {
54 l = new List<string> ();