Closed pkbehera closed 1 month ago
This library is designed for interactive shell use, not parsing command-line arguments. That's why it does not support "flags" in that style.
With the example you provide, you can use the following commands:
demo> reboot 5 true
demo> reboot 5 false
demo> reboot 5 1
demo> reboot 5 0
Of course, you can achieve the functionality you described by using the following code snippet:
root_menu_p->Insert("reboot", [&](std::ostream& out, uint32_t delay_s, std::string force) {
if (force == "--force")
// blah
else if (force.empty())
// blah
else
out << "Wrong parameter\n";
}, "Reboots after given delay(seconds)", {"delay(seconds)", "force"});
Is there support for flags on the command line?
With the above handler in the place, I was expecting the following command to work! :)
Is it possible to get this working somehow?