7 : internal_commands(commands) {}
11 const std::string command_name_)
12 : internal_commands(commands), command_name(command_name_) {}
21 if (!command_name.empty()) {
22 title_str += command_name;
25 title_str +=
" - Available commands:";
26 std::cout <<
wrapped(title_str, 0);
29 for (
const auto& [name, _] : internal_commands) {
30 if (name.empty())
continue;
31 std::cout <<
" " << name[0] <<
"\n";
35 std::string use_str =
"Use '";
38 if (!command_name.empty()) {
39 use_str += command_name;
42 use_str +=
"<command> --help' for more information on a command.";
43 std::cout <<
wrapped(use_str, 0);
static Config & config()
Gets the singleton configuration instance.
std::string program_name
Name of the program.
bool validate(const ParsedOptions &options) override
Validate the arguments already analyzed.
bool run(const ParsedOptions &options) override
Displays help information about available commands.
Help(const std::vector< std::pair< std::vector< std::string >, CommandsRegistry::CommandFactory > > &commands)
std::function< std::unique_ptr< ICommand >()> CommandFactory
Wrapped wrapped(const std::string &text, size_t spaces=1, bool use_first_line=true)