aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-03-08 01:51:37 +0000
committerJustin Clark-Casey (justincc)2012-03-08 01:51:37 +0000
commit749c3fef8ad2d3af97fcd9ab9c72740675e46715 (patch)
tree068e6adc89dc50386413d85064e80e3114e3fd49 /OpenSim/Region/Framework
parentminor: make NPC tests run in a given order, comment out log lines in mock reg... (diff)
downloadopensim-SC_OLD-749c3fef8ad2d3af97fcd9ab9c72740675e46715.zip
opensim-SC_OLD-749c3fef8ad2d3af97fcd9ab9c72740675e46715.tar.gz
opensim-SC_OLD-749c3fef8ad2d3af97fcd9ab9c72740675e46715.tar.bz2
opensim-SC_OLD-749c3fef8ad2d3af97fcd9ab9c72740675e46715.tar.xz
Change "help" to display categories/module list then "help <category/module>" to display commands in a category.
This is to deal with the hundred lines of command splurge when one previously typed "help" Modelled somewhat on the mysql console One can still type help <command> to get per command help at any point. Categories capitalized to avoid conflict with the all-lowercase commands (except for commander system, as of yet). Does not affect command parsing or any other aspects of the console apart from the help system. Backwards compatible with existing modules.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs71
2 files changed, 65 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 11e5ce3..ecadd24 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -596,7 +596,7 @@ namespace OpenSim.Region.Framework.Scenes
596 596
597 #endregion Region Settings 597 #endregion Region Settings
598 598
599 MainConsole.Instance.Commands.AddCommand("region", false, "reload estate", 599 MainConsole.Instance.Commands.AddCommand("estate", false, "reload estate",
600 "reload estate", 600 "reload estate",
601 "Reload the estate data", HandleReloadEstate); 601 "Reload the estate data", HandleReloadEstate);
602 602
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 712e094..495cede 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -472,6 +472,63 @@ namespace OpenSim.Region.Framework.Scenes
472 /// <summary> 472 /// <summary>
473 /// Call this from a region module to add a command to the OpenSim console. 473 /// Call this from a region module to add a command to the OpenSim console.
474 /// </summary> 474 /// </summary>
475 /// <param name="mod">
476 /// The use of IRegionModuleBase is a cheap trick to get a different method signature,
477 /// though all new modules should be using interfaces descended from IRegionModuleBase anyway.
478 /// </param>
479 /// <param name="category">
480 /// Category of the command. This is the section under which it will appear when the user asks for help
481 /// </param>
482 /// <param name="command"></param>
483 /// <param name="shorthelp"></param>
484 /// <param name="longhelp"></param>
485 /// <param name="callback"></param>
486 public void AddCommand(
487 string category, object mod, string command, string shorthelp, string longhelp, CommandDelegate callback)
488 {
489 AddCommand(category, mod, command, shorthelp, longhelp, string.Empty, callback);
490 }
491
492 /// <summary>
493 /// Call this from a region module to add a command to the OpenSim console.
494 /// </summary>
495 /// <param name="mod"></param>
496 /// <param name="command"></param>
497 /// <param name="shorthelp"></param>
498 /// <param name="longhelp"></param>
499 /// <param name="descriptivehelp"></param>
500 /// <param name="callback"></param>
501 public void AddCommand(object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
502 {
503 string moduleName = "";
504
505 if (mod != null)
506 {
507 if (mod is IRegionModule)
508 {
509 IRegionModule module = (IRegionModule)mod;
510 moduleName = module.Name;
511 }
512 else if (mod is IRegionModuleBase)
513 {
514 IRegionModuleBase module = (IRegionModuleBase)mod;
515 moduleName = module.Name;
516 }
517 else
518 {
519 throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
520 }
521 }
522
523 AddCommand(moduleName, mod, command, shorthelp, longhelp, descriptivehelp, callback);
524 }
525
526 /// <summary>
527 /// Call this from a region module to add a command to the OpenSim console.
528 /// </summary>
529 /// <param name="category">
530 /// Category of the command. This is the section under which it will appear when the user asks for help
531 /// </param>
475 /// <param name="mod"></param> 532 /// <param name="mod"></param>
476 /// <param name="command"></param> 533 /// <param name="command"></param>
477 /// <param name="shorthelp"></param> 534 /// <param name="shorthelp"></param>
@@ -479,12 +536,12 @@ namespace OpenSim.Region.Framework.Scenes
479 /// <param name="descriptivehelp"></param> 536 /// <param name="descriptivehelp"></param>
480 /// <param name="callback"></param> 537 /// <param name="callback"></param>
481 public void AddCommand( 538 public void AddCommand(
482 object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) 539 string category, object mod, string command,
540 string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
483 { 541 {
484 if (MainConsole.Instance == null) 542 if (MainConsole.Instance == null)
485 return; 543 return;
486 544
487 string modulename = String.Empty;
488 bool shared = false; 545 bool shared = false;
489 546
490 if (mod != null) 547 if (mod != null)
@@ -492,20 +549,20 @@ namespace OpenSim.Region.Framework.Scenes
492 if (mod is IRegionModule) 549 if (mod is IRegionModule)
493 { 550 {
494 IRegionModule module = (IRegionModule)mod; 551 IRegionModule module = (IRegionModule)mod;
495 modulename = module.Name;
496 shared = module.IsSharedModule; 552 shared = module.IsSharedModule;
497 } 553 }
498 else if (mod is IRegionModuleBase) 554 else if (mod is IRegionModuleBase)
499 { 555 {
500 IRegionModuleBase module = (IRegionModuleBase)mod;
501 modulename = module.Name;
502 shared = mod is ISharedRegionModule; 556 shared = mod is ISharedRegionModule;
503 } 557 }
504 else throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); 558 else
559 {
560 throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase");
561 }
505 } 562 }
506 563
507 MainConsole.Instance.Commands.AddCommand( 564 MainConsole.Instance.Commands.AddCommand(
508 modulename, shared, command, shorthelp, longhelp, descriptivehelp, callback); 565 category, shared, command, shorthelp, longhelp, descriptivehelp, callback);
509 } 566 }
510 567
511 public virtual ISceneObject DeserializeObject(string representation) 568 public virtual ISceneObject DeserializeObject(string representation)