I’ve been writing a few apps in https://github.com/ros2/demos - and found myself duplicating a lot of code for argument parsing to make the applications easy to use and understand. I am wondering if there’s a generic need for a “recommended/provided” argument parser for C++ applications in the ROS2 stack. Something with the same ease of use as Python’s https://docs.python.org/3/library/argparse.html
Two options I’ve been considering:
- Starting to write up utility classes for this in https://github.com/ros2/rcpputils - e.g. roll our own like the simple utility in https://github.com/ros2/rcutils/blob/master/include/rcutils/cmdline_parser.h
- Import something else as a dependency for at least the demo packages - like https://github.com/jarro2783/cxxopts
I personally prefer the second option, since it already exists, but I’m not sure how one might go about adding such a dependency.
Any thoughts or opinions on this?