diff options
Diffstat (limited to 'OpenSim/Framework/Console/CommandConsole.cs')
-rw-r--r-- | OpenSim/Framework/Console/CommandConsole.cs | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index bd23d1c..d703d78 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' 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 |
@@ -114,6 +115,12 @@ namespace OpenSim.Framework.Console | |||
114 | { | 115 | { |
115 | help.Add(""); // Will become a newline. | 116 | help.Add(""); // Will become a newline. |
116 | help.Add(GeneralHelpText); | 117 | help.Add(GeneralHelpText); |
118 | help.AddRange(CollectAllCommandsHelp()); | ||
119 | } | ||
120 | else if (helpParts.Count == 1 && helpParts[0] == "categories") | ||
121 | { | ||
122 | help.Add(""); // Will become a newline. | ||
123 | help.Add(GeneralHelpText); | ||
117 | help.Add(ItemHelpText); | 124 | help.Add(ItemHelpText); |
118 | help.AddRange(CollectModulesHelp(tree)); | 125 | help.AddRange(CollectModulesHelp(tree)); |
119 | } | 126 | } |
@@ -124,6 +131,31 @@ namespace OpenSim.Framework.Console | |||
124 | 131 | ||
125 | return help; | 132 | return help; |
126 | } | 133 | } |
134 | |||
135 | /// <summary> | ||
136 | /// Collects the help from all commands and return in alphabetical order. | ||
137 | /// </summary> | ||
138 | /// <returns></returns> | ||
139 | private List<string> CollectAllCommandsHelp() | ||
140 | { | ||
141 | List<string> help = new List<string>(); | ||
142 | |||
143 | lock (m_modulesCommands) | ||
144 | { | ||
145 | foreach (List<CommandInfo> commands in m_modulesCommands.Values) | ||
146 | { | ||
147 | foreach (CommandInfo c in commands) | ||
148 | { | ||
149 | if (c.long_help != String.Empty) | ||
150 | help.Add(string.Format("{0} - {1}", c.help_text, c.long_help)); | ||
151 | } | ||
152 | } | ||
153 | } | ||
154 | |||
155 | help.Sort(); | ||
156 | |||
157 | return help; | ||
158 | } | ||
127 | 159 | ||
128 | /// <summary> | 160 | /// <summary> |
129 | /// See if we can find the requested command in order to display longer help | 161 | /// See if we can find the requested command in order to display longer help |
@@ -711,7 +743,7 @@ namespace OpenSim.Framework.Console | |||
711 | /// </summary> | 743 | /// </summary> |
712 | public void Prompt() | 744 | public void Prompt() |
713 | { | 745 | { |
714 | string line = ReadLine(m_defaultPrompt + "# ", true, true); | 746 | string line = ReadLine(DefaultPrompt + "# ", true, true); |
715 | 747 | ||
716 | if (line != String.Empty) | 748 | if (line != String.Empty) |
717 | Output("Invalid command"); | 749 | Output("Invalid command"); |