The run function is nothing like the delegate. See how I use the bind function below to hard-code the pointer parameter and the instance pointer 'this'.
| 2699 | // The run function is nothing like the delegate. See how I use the bind function |
| 2700 | // below to hard-code the pointer parameter and the instance pointer 'this'. |
| 2701 | void RunHelp(CmdRegistry *registry) |
| 2702 | { |
| 2703 | if (arg.empty()) |
| 2704 | { |
| 2705 | // Show all commands |
| 2706 | cout << "Here's the list of all commands." << endl; |
| 2707 | vector<string> list; |
| 2708 | registry->GetCommandList(list); |
| 2709 | for (auto cmd : list) |
| 2710 | { |
| 2711 | cout << " " << cmd << endl; |
| 2712 | } |
| 2713 | cout << "Enter HELP [cmd1] [cmd2] ... for details on specific commands." << endl; |
| 2714 | } |
| 2715 | else |
| 2716 | { |
| 2717 | auto help = registry->GetHelp(arg); |
| 2718 | if (!help.empty()) |
| 2719 | { |
| 2720 | cout << arg << " :" << endl << |
| 2721 | " " << help << endl; |
| 2722 | } |
| 2723 | else |
| 2724 | { |
| 2725 | cout << arg << " is not a recognized command" << endl; |
| 2726 | } |
| 2727 | } |
| 2728 | } |
| 2729 | public: |
| 2730 | HelpCmd(CmdRegistry ®) |
| 2731 | : JSMMacro("HELP") |
nothing calls this directly
no test coverage detected