mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-21 11:25:08 +03:00
cam: options: Slit OptionsParser::usage() in two functions
To prepare for code reuse, split the printing of options out of OptionsParser::usage() to a separate function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
7c205c79d9
commit
a8f3a68ec9
2 changed files with 11 additions and 3 deletions
|
@ -902,8 +902,6 @@ OptionsParser::Options OptionsParser::parse(int argc, char **argv)
|
||||||
*/
|
*/
|
||||||
void OptionsParser::usage()
|
void OptionsParser::usage()
|
||||||
{
|
{
|
||||||
std::cerr << "Options:" << std::endl;
|
|
||||||
|
|
||||||
unsigned int indent = 0;
|
unsigned int indent = 0;
|
||||||
|
|
||||||
for (const Option &option : options_) {
|
for (const Option &option : options_) {
|
||||||
|
@ -923,7 +921,15 @@ void OptionsParser::usage()
|
||||||
|
|
||||||
indent = (indent + 7) / 8 * 8;
|
indent = (indent + 7) / 8 * 8;
|
||||||
|
|
||||||
for (const Option &option : options_) {
|
std::cerr << "Options:" << std::endl;
|
||||||
|
|
||||||
|
usageOptions(options_, indent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionsParser::usageOptions(const std::list<Option> &options,
|
||||||
|
unsigned int indent)
|
||||||
|
{
|
||||||
|
for (const Option &option : options) {
|
||||||
std::string argument;
|
std::string argument;
|
||||||
if (option.hasShortOption())
|
if (option.hasShortOption())
|
||||||
argument = std::string(" -")
|
argument = std::string(" -")
|
||||||
|
|
|
@ -95,6 +95,8 @@ public:
|
||||||
void usage();
|
void usage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void usageOptions(const std::list<Option> &options, unsigned int indent);
|
||||||
|
|
||||||
std::list<Option> options_;
|
std::list<Option> options_;
|
||||||
std::map<unsigned int, Option *> optionsMap_;
|
std::map<unsigned int, Option *> optionsMap_;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue