aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Console
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Console')
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs31
-rwxr-xr-xOpenSim/Framework/Console/ConsoleBase.cs10
-rw-r--r--OpenSim/Framework/Console/MockConsole.cs7
3 files changed, 36 insertions, 12 deletions
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index bd23d1c..de30414 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -83,7 +83,8 @@ namespace OpenSim.Framework.Console
83 = "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n"; 83 = "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n";
84 84
85 public const string ItemHelpText 85 public const string ItemHelpText
86 = "For more information, type 'help <item>' where <item> is one of the following:"; 86= @"For more information, type 'help all' to get a list of all commands,
87 or type help <item>' where <item> is one of the following:";
87 88
88 /// <value> 89 /// <value>
89 /// Commands organized by keyword in a tree 90 /// Commands organized by keyword in a tree
@@ -117,6 +118,10 @@ namespace OpenSim.Framework.Console
117 help.Add(ItemHelpText); 118 help.Add(ItemHelpText);
118 help.AddRange(CollectModulesHelp(tree)); 119 help.AddRange(CollectModulesHelp(tree));
119 } 120 }
121 else if (helpParts.Count == 1 && helpParts[0] == "all")
122 {
123 help.AddRange(CollectAllCommandsHelp());
124 }
120 else 125 else
121 { 126 {
122 help.AddRange(CollectHelp(helpParts)); 127 help.AddRange(CollectHelp(helpParts));
@@ -124,6 +129,28 @@ namespace OpenSim.Framework.Console
124 129
125 return help; 130 return help;
126 } 131 }
132
133 /// <summary>
134 /// Collects the help from all commands and return in alphabetical order.
135 /// </summary>
136 /// <returns></returns>
137 private List<string> CollectAllCommandsHelp()
138 {
139 List<string> help = new List<string>();
140
141 lock (m_modulesCommands)
142 {
143 foreach (List<CommandInfo> commands in m_modulesCommands.Values)
144 {
145 var ourHelpText = commands.ConvertAll(c => string.Format("{0} - {1}", c.help_text, c.long_help));
146 help.AddRange(ourHelpText);
147 }
148 }
149
150 help.Sort();
151
152 return help;
153 }
127 154
128 /// <summary> 155 /// <summary>
129 /// See if we can find the requested command in order to display longer help 156 /// See if we can find the requested command in order to display longer help
@@ -711,7 +738,7 @@ namespace OpenSim.Framework.Console
711 /// </summary> 738 /// </summary>
712 public void Prompt() 739 public void Prompt()
713 { 740 {
714 string line = ReadLine(m_defaultPrompt + "# ", true, true); 741 string line = ReadLine(DefaultPrompt + "# ", true, true);
715 742
716 if (line != String.Empty) 743 if (line != String.Empty)
717 Output("Invalid command"); 744 Output("Invalid command");
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs
index 4b375d9..2d8e723 100755
--- a/OpenSim/Framework/Console/ConsoleBase.cs
+++ b/OpenSim/Framework/Console/ConsoleBase.cs
@@ -43,15 +43,7 @@ namespace OpenSim.Framework.Console
43 43
44 public object ConsoleScene { get; set; } 44 public object ConsoleScene { get; set; }
45 45
46 /// <summary> 46 public string DefaultPrompt { get; set; }
47 /// The default prompt text.
48 /// </summary>
49 public string DefaultPrompt
50 {
51 set { m_defaultPrompt = value; }
52 get { return m_defaultPrompt; }
53 }
54 protected string m_defaultPrompt;
55 47
56 public ConsoleBase(string defaultPrompt) 48 public ConsoleBase(string defaultPrompt)
57 { 49 {
diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs
index b489f93..8ba58e4 100644
--- a/OpenSim/Framework/Console/MockConsole.cs
+++ b/OpenSim/Framework/Console/MockConsole.cs
@@ -46,13 +46,18 @@ namespace OpenSim.Framework.Console
46 46
47 public ICommands Commands { get { return m_commands; } } 47 public ICommands Commands { get { return m_commands; } }
48 48
49 public string DefaultPrompt { get; set; }
50
49 public void Prompt() {} 51 public void Prompt() {}
50 52
51 public void RunCommand(string cmd) {} 53 public void RunCommand(string cmd) {}
52 54
53 public string ReadLine(string p, bool isCommand, bool e) { return ""; } 55 public string ReadLine(string p, bool isCommand, bool e) { return ""; }
54 56
55 public object ConsoleScene { get { return null; } } 57 public object ConsoleScene {
58 get { return null; }
59 set {}
60 }
56 61
57 public void Output(string text, string level) {} 62 public void Output(string text, string level) {}
58 public void Output(string text) {} 63 public void Output(string text) {}