* Make existing module commanders register as help topics
* Typing help will now give a list of these topics at the top (as well as the rest of the current help stuff) * Typing help <topic> will give information about commands specific to that topic0.6.3-post-fixes
parent
9a666bda02
commit
732cd838b1
|
@ -105,6 +105,16 @@ namespace OpenSim.Framework.Servers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void ShutdownSpecific() {}
|
public virtual void ShutdownSpecific() {}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a list of help topics that are available. Overriding classes should append their topics to the
|
||||||
|
/// information returned when the base method is called.
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <returns>
|
||||||
|
/// A list of strings that represent different help topics on which more information is available
|
||||||
|
/// </returns>
|
||||||
|
protected virtual List<string> GetHelpTopics() { return new List<string>(); }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Print statistics to the logfile, if they are active
|
/// Print statistics to the logfile, if they are active
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -310,11 +320,20 @@ namespace OpenSim.Framework.Servers
|
||||||
/// <param name="helpArgs"></param>
|
/// <param name="helpArgs"></param>
|
||||||
protected virtual void ShowHelp(string[] helpArgs)
|
protected virtual void ShowHelp(string[] helpArgs)
|
||||||
{
|
{
|
||||||
|
Notice("");
|
||||||
|
|
||||||
if (helpArgs.Length == 0)
|
if (helpArgs.Length == 0)
|
||||||
{
|
{
|
||||||
|
List<string> helpTopics = GetHelpTopics();
|
||||||
|
|
||||||
|
if (helpTopics.Count > 0)
|
||||||
|
{
|
||||||
|
Notice(
|
||||||
|
"As well as the help information below, you can also type help <topic> to get more information on the following areas:");
|
||||||
|
Notice(string.Format(" {0}", string.Join(", ", helpTopics.ToArray())));
|
||||||
Notice("");
|
Notice("");
|
||||||
// TODO: not yet implemented
|
}
|
||||||
//Notice("help [command] - display general help or specific command help. Try help help for more info.");
|
|
||||||
Notice("quit - equivalent to shutdown.");
|
Notice("quit - equivalent to shutdown.");
|
||||||
|
|
||||||
Notice("set log level [level] - change the console logging level only. For example, off or debug.");
|
Notice("set log level [level] - change the console logging level only. For example, off or debug.");
|
||||||
|
@ -326,7 +345,8 @@ namespace OpenSim.Framework.Servers
|
||||||
Notice("show threads - list tracked threads");
|
Notice("show threads - list tracked threads");
|
||||||
Notice("show uptime - show server startup time and uptime.");
|
Notice("show uptime - show server startup time and uptime.");
|
||||||
Notice("show version - show server version.");
|
Notice("show version - show server version.");
|
||||||
Notice("shutdown - shutdown the server.\n");
|
Notice("shutdown - shutdown the server.");
|
||||||
|
Notice("");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -496,6 +496,7 @@ namespace OpenSim
|
||||||
case "reset":
|
case "reset":
|
||||||
Reset(cmdparams);
|
Reset(cmdparams);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "predecode-j2k":
|
case "predecode-j2k":
|
||||||
if (cmdparams.Length > 0)
|
if (cmdparams.Length > 0)
|
||||||
{
|
{
|
||||||
|
@ -661,6 +662,8 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
base.ShowHelp(helpArgs);
|
base.ShowHelp(helpArgs);
|
||||||
|
|
||||||
|
if (helpArgs.Length == 0)
|
||||||
|
{
|
||||||
m_console.Notice("alert - send alert to a designated user or all users.");
|
m_console.Notice("alert - send alert to a designated user or all users.");
|
||||||
m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive.");
|
m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive.");
|
||||||
m_console.Notice(" alert general [Message] - send an alert to all users.");
|
m_console.Notice(" alert general [Message] - send an alert to all users.");
|
||||||
|
@ -694,12 +697,10 @@ namespace OpenSim
|
||||||
m_console.Notice("config set section field value - set a config value");
|
m_console.Notice("config set section field value - set a config value");
|
||||||
m_console.Notice("config get section field - get a config value");
|
m_console.Notice("config get section field - get a config value");
|
||||||
m_console.Notice("config save - save OpenSim.ini");
|
m_console.Notice("config save - save OpenSim.ini");
|
||||||
m_console.Notice("terrain help - show help for terrain commands.");
|
|
||||||
m_console.Notice("login-enable - Allows login at sim level");
|
m_console.Notice("login-enable - Allows login at sim level");
|
||||||
m_console.Notice("login-disable - Disable login at sim level");
|
m_console.Notice("login-disable - Disable login at sim level");
|
||||||
m_console.Notice("login-status - Show the actual login status");
|
m_console.Notice("login-status - Show the actual login status");
|
||||||
m_console.Notice("predecode-j2k - Precache assets,decode j2k layerdata, First parameter is threads to use");
|
m_console.Notice("predecode-j2k - Precache assets,decode j2k layerdata, First parameter is threads to use");
|
||||||
|
|
||||||
ShowPluginCommandsHelp(CombineParams(helpArgs, 0), m_console);
|
ShowPluginCommandsHelp(CombineParams(helpArgs, 0), m_console);
|
||||||
|
|
||||||
if (ConfigurationSettings.Standalone)
|
if (ConfigurationSettings.Standalone)
|
||||||
|
@ -709,6 +710,15 @@ namespace OpenSim
|
||||||
m_console.Notice("reset user password - reset a user's password.");
|
m_console.Notice("reset user password - reset a user's password.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ICommander moduleCommander = SceneManager.CurrentOrFirstScene.GetCommander(helpArgs[0]);
|
||||||
|
if (moduleCommander != null)
|
||||||
|
{
|
||||||
|
m_console.Notice(moduleCommander.Help);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// see BaseOpenSimServer
|
// see BaseOpenSimServer
|
||||||
public override void Show(string[] showParams)
|
public override void Show(string[] showParams)
|
||||||
|
|
|
@ -159,6 +159,14 @@ namespace OpenSim
|
||||||
m_plugins = loader.Plugins;
|
m_plugins = loader.Plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override List<string> GetHelpTopics()
|
||||||
|
{
|
||||||
|
List<string> topics = base.GetHelpTopics();
|
||||||
|
topics.AddRange(SceneManager.CurrentOrFirstScene.GetCommanders().Keys);
|
||||||
|
|
||||||
|
return topics;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs startup specific to this region server, including initialization of the scene
|
/// Performs startup specific to this region server, including initialization of the scene
|
||||||
/// such as loading configuration from disk.
|
/// such as loading configuration from disk.
|
||||||
|
|
|
@ -29,11 +29,16 @@ namespace OpenSim.Region.Environment.Interfaces
|
||||||
{
|
{
|
||||||
public interface ICommander
|
public interface ICommander
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <value>
|
||||||
/// The name of this commander
|
/// The name of this commander
|
||||||
/// </summary>
|
/// </value>
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// Provide general help information about this commander.
|
||||||
|
/// </value>
|
||||||
|
string Help { get; }
|
||||||
|
|
||||||
void ProcessConsoleCommand(string function, string[] args);
|
void ProcessConsoleCommand(string function, string[] args);
|
||||||
void RegisterCommand(string commandName, ICommand command);
|
void RegisterCommand(string commandName, ICommand command);
|
||||||
void Run(string function, object[] args);
|
void Run(string function, object[] args);
|
||||||
|
|
|
@ -53,6 +53,23 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
|
||||||
}
|
}
|
||||||
private string m_name;
|
private string m_name;
|
||||||
|
|
||||||
|
public string Help
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
sb.AppendLine("===" + m_name + "===");
|
||||||
|
|
||||||
|
foreach (ICommand com in m_commands.Values)
|
||||||
|
{
|
||||||
|
sb.AppendLine("* " + com.Name + " - " + com.Help);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -60,7 +77,10 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
|
||||||
public Commander(string name)
|
public Commander(string name)
|
||||||
{
|
{
|
||||||
m_name = name;
|
m_name = name;
|
||||||
m_generatedApiClassName = m_name;
|
m_generatedApiClassName = m_name[0].ToString().ToUpper();
|
||||||
|
|
||||||
|
if (m_name.Length > 1)
|
||||||
|
m_generatedApiClassName += m_name.Substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
|
@ -145,22 +165,14 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
|
||||||
{
|
{
|
||||||
if (function != "help")
|
if (function != "help")
|
||||||
Console.WriteLine("ERROR: Invalid command - No such command exists");
|
Console.WriteLine("ERROR: Invalid command - No such command exists");
|
||||||
ShowConsoleHelp();
|
|
||||||
|
Console.Write(Help);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void ShowConsoleHelp()
|
|
||||||
{
|
|
||||||
Console.WriteLine("===" + m_name + "===");
|
|
||||||
foreach (ICommand com in m_commands.Values)
|
|
||||||
{
|
|
||||||
Console.WriteLine("* " + com.Name + " - " + com.Help);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string EscapeRuntimeAPICommand(string command)
|
private string EscapeRuntimeAPICommand(string command)
|
||||||
{
|
{
|
||||||
command = command.Replace('-', '_');
|
command = command.Replace('-', '_');
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
|
||||||
{
|
{
|
||||||
public class CommanderTestModule : IRegionModule, ICommandableModule
|
public class CommanderTestModule : IRegionModule, ICommandableModule
|
||||||
{
|
{
|
||||||
private readonly Commander m_commander = new Commander("CommanderTest");
|
private readonly Commander m_commander = new Commander("commandertest");
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
|
||||||
#region ICommandableModule Members
|
#region ICommandableModule Members
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected Scene m_scene;
|
protected Scene m_scene;
|
||||||
private readonly Commander m_commander = new Commander("Permissions");
|
private readonly Commander m_commander = new Commander("permissions");
|
||||||
|
|
||||||
#region Constants
|
#region Constants
|
||||||
// These are here for testing. They will be taken out
|
// These are here for testing. They will be taken out
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
|
||||||
{
|
{
|
||||||
public class SerialiserModule : IRegionModule, IRegionSerialiserModule
|
public class SerialiserModule : IRegionModule, IRegionSerialiserModule
|
||||||
{
|
{
|
||||||
private Commander m_commander = new Commander("Export");
|
private Commander m_commander = new Commander("export");
|
||||||
private List<Scene> m_regions = new List<Scene>();
|
private List<Scene> m_regions = new List<Scene>();
|
||||||
private string m_savedir = "exports" + "/";
|
private string m_savedir = "exports" + "/";
|
||||||
private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
|
private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
|
||||||
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private readonly Commander m_commander = new Commander("Terrain");
|
private readonly Commander m_commander = new Commander("terrain");
|
||||||
|
|
||||||
private readonly Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects =
|
private readonly Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects =
|
||||||
new Dictionary<StandardTerrainEffects, ITerrainFloodEffect>();
|
new Dictionary<StandardTerrainEffects, ITerrainFloodEffect>();
|
||||||
|
|
|
@ -286,12 +286,20 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a module commander
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <returns>The module commander, null if no module commander with that name was found</returns>
|
||||||
public ICommander GetCommander(string name)
|
public ICommander GetCommander(string name)
|
||||||
{
|
{
|
||||||
lock (m_moduleCommanders)
|
lock (m_moduleCommanders)
|
||||||
{
|
{
|
||||||
|
if (m_moduleCommanders.ContainsKey(name))
|
||||||
return m_moduleCommanders[name];
|
return m_moduleCommanders[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<string, ICommander> GetCommanders()
|
public Dictionary<string, ICommander> GetCommanders()
|
||||||
|
|
Loading…
Reference in New Issue