2323#include < libbenbot/search/Result.hpp>
2424#include < libchess/notation/FEN.hpp>
2525#include < libchess/notation/MoveFormats.hpp>
26+ #include < libchess/uci/EngineBase.hpp>
2627#include < libchess/uci/Printing.hpp>
2728#include < libutil/Strings.hpp>
2829#include < libutil/TextTable.hpp>
@@ -46,6 +47,26 @@ auto Engine::get_name() const -> std::string
4647 return std::format (" BenBot {}" , resources::get_version_string ());
4748}
4849
50+ namespace {
51+ void print_command_table (const uci::EngineBase::CommandList commands)
52+ {
53+ TextTable table;
54+
55+ table.append_column (" Command" )
56+ .append_column (" Notes" );
57+
58+ for (const auto & command : commands) {
59+ table.new_row ()
60+ .append_column (std::format (" {} {}" , command.name , command.argsHelp ))
61+ .append_column (command.description );
62+ }
63+
64+ print_colored_table (table);
65+
66+ std::cout.flush ();
67+ }
68+ } // namespace
69+
4970void Engine::print_help (const string_view args) const
5071{
5172 const bool noLogo = [args] {
@@ -61,25 +82,16 @@ void Engine::print_help(const string_view args) const
6182 println (" " );
6283 }
6384
64- println (
65- " All standard UCI commands are supported, as well as the following non-standard commands:" );
66-
85+ println (" The following standard UCI commands are supported:" );
6786 println (" " );
6887
69- TextTable table;
70-
71- table.append_column (" Command" )
72- .append_column (" Notes" );
73-
74- for (const auto & command : customCommands) {
75- table.new_row ()
76- .append_column (std::format (" {} {}" , command.name , command.argsHelp ))
77- .append_column (command.description );
78- }
88+ print_command_table (get_standard_uci_commands ());
89+ println (" " );
7990
80- print_colored_table (table);
91+ println (" The following non-standard UCI commands are supported:" );
92+ println (" " );
8193
82- std::cout. flush ( );
94+ print_command_table (customCommands );
8395}
8496
8597void Engine::print_options () const
0 commit comments