From 5c48d7a378ff066f59b9cee02f2803ebe1616481 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 22 Nov 2012 04:05:09 +0000
Subject: factor out common HandleShow code for "show uptime"
---
OpenSim/Framework/Console/CommandConsole.cs | 2 +-
OpenSim/Framework/Console/ConsoleBase.cs | 10 +---------
OpenSim/Framework/Console/MockConsole.cs | 7 ++++++-
3 files changed, 8 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Framework/Console')
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index bd23d1c..d1e29b4 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -711,7 +711,7 @@ namespace OpenSim.Framework.Console
///
public void Prompt()
{
- string line = ReadLine(m_defaultPrompt + "# ", true, true);
+ string line = ReadLine(DefaultPrompt + "# ", true, true);
if (line != String.Empty)
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
public object ConsoleScene { get; set; }
- ///
- /// The default prompt text.
- ///
- public string DefaultPrompt
- {
- set { m_defaultPrompt = value; }
- get { return m_defaultPrompt; }
- }
- protected string m_defaultPrompt;
+ public string DefaultPrompt { get; set; }
public ConsoleBase(string defaultPrompt)
{
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
public ICommands Commands { get { return m_commands; } }
+ public string DefaultPrompt { get; set; }
+
public void Prompt() {}
public void RunCommand(string cmd) {}
public string ReadLine(string p, bool isCommand, bool e) { return ""; }
- public object ConsoleScene { get { return null; } }
+ public object ConsoleScene {
+ get { return null; }
+ set {}
+ }
public void Output(string text, string level) {}
public void Output(string text) {}
--
cgit v1.1
From eb1921ff930459fa1b6f138f00d0a744feaa157d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 23 Nov 2012 01:52:48 +0000
Subject: Add "help all" console command which will list all commands
alphabetically in a single list
---
OpenSim/Framework/Console/CommandConsole.cs | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Framework/Console')
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index d1e29b4..de30414 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -83,7 +83,8 @@ namespace OpenSim.Framework.Console
= "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n";
public const string ItemHelpText
- = "For more information, type 'help - ' where
- is one of the following:";
+= @"For more information, type 'help all' to get a list of all commands,
+ or type help
- ' where
- is one of the following:";
///
/// Commands organized by keyword in a tree
@@ -117,6 +118,10 @@ namespace OpenSim.Framework.Console
help.Add(ItemHelpText);
help.AddRange(CollectModulesHelp(tree));
}
+ else if (helpParts.Count == 1 && helpParts[0] == "all")
+ {
+ help.AddRange(CollectAllCommandsHelp());
+ }
else
{
help.AddRange(CollectHelp(helpParts));
@@ -124,6 +129,28 @@ namespace OpenSim.Framework.Console
return help;
}
+
+ ///
+ /// Collects the help from all commands and return in alphabetical order.
+ ///
+ ///
+ private List CollectAllCommandsHelp()
+ {
+ List help = new List();
+
+ lock (m_modulesCommands)
+ {
+ foreach (List commands in m_modulesCommands.Values)
+ {
+ var ourHelpText = commands.ConvertAll(c => string.Format("{0} - {1}", c.help_text, c.long_help));
+ help.AddRange(ourHelpText);
+ }
+ }
+
+ help.Sort();
+
+ return help;
+ }
///
/// See if we can find the requested command in order to display longer help
--
cgit v1.1