diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-01-31 23:36:04 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-02-01 11:42:02 +0200 |
commit | c8c546fe99a343c13c7c0b8f2e5e180c19831b43 (patch) | |
tree | 631d116f09aa60d39fe4205507c9ac5ab667ef20 /src/cam/main.cpp | |
parent | 6f3503981a4f20ef3e939a9b91c29ef12d95efd2 (diff) |
cam: options: Add option type handling to options parser
Extend the options parser with support for option types. All options
must now specify the type of their argument, and the parser
automatically parses the argument and handles errors internally.
Available types are none, integer or string.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/cam/main.cpp')
-rw-r--r-- | src/cam/main.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cam/main.cpp b/src/cam/main.cpp index bde47a8f..7934d0bf 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -37,10 +37,12 @@ static int parseOptions(int argc, char *argv[]) { OptionsParser parser; - parser.addOption(OptCamera, "Specify which camera to operate on", - "camera", ArgumentRequired, "camera"); - parser.addOption(OptHelp, "Display this help message", "help"); - parser.addOption(OptList, "List all cameras", "list"); + parser.addOption(OptCamera, OptionString, + "Specify which camera to operate on", "camera", + ArgumentRequired, "camera"); + parser.addOption(OptHelp, OptionNone, "Display this help message", + "help"); + parser.addOption(OptList, OptionNone, "List all cameras", "list"); options = parser.parse(argc, argv); if (!options.valid()) |