| 368 | } |
| 369 | |
| 370 | std::optional<const ArgsManager::Command> ArgsManager::GetCommand() const |
| 371 | { |
| 372 | Command ret; |
| 373 | LOCK(cs_args); |
| 374 | auto it = m_command.begin(); |
| 375 | if (it == m_command.end()) { |
| 376 | // No command was passed |
| 377 | return std::nullopt; |
| 378 | } |
| 379 | if (!m_accept_any_command) { |
| 380 | // The registered command |
| 381 | ret.command = *(it++); |
| 382 | } |
| 383 | while (it != m_command.end()) { |
| 384 | // The unregistered command and args (if any) |
| 385 | ret.args.push_back(*(it++)); |
| 386 | } |
| 387 | return ret; |
| 388 | } |
| 389 | |
| 390 | bool ArgsManager::CheckCommandOptions(const std::string& command, std::vector<std::string>* errors) const |
| 391 | { |