Introduce argparse library (which was inspired by the thread [1]), compared with getopt, it makes it easy to write user-friendly command-like program.
Note: the [1/6] commit contains usage examples. [1] https://patchwork.dpdk.org/project/dpdk/patch/20231105054539.22303-2-fengcheng...@huawei.com/ Chengwen Feng (6): argparse: add argparse library argparse: support verify argument config test/argparse: add verify argument config test argparse: support parse parameters test/argparse: add parse parameters test examples/dma: replace getopt with argparse --- v2: refine the definition, add implement code, add examples which address Stephen's comments. app/test/meson.build | 1 + app/test/test_argparse.c | 764 +++++++++++++++++++++++++ doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf.in | 1 + doc/guides/prog_guide/argparse_lib.rst | 142 +++++ doc/guides/prog_guide/index.rst | 1 + examples/dma/dmafwd.c | 288 +++++----- examples/dma/meson.build | 2 +- lib/argparse/meson.build | 7 + lib/argparse/rte_argparse.c | 611 ++++++++++++++++++++ lib/argparse/rte_argparse.h | 179 ++++++ lib/argparse/version.map | 7 + lib/meson.build | 1 + 13 files changed, 1846 insertions(+), 159 deletions(-) create mode 100644 app/test/test_argparse.c create mode 100644 doc/guides/prog_guide/argparse_lib.rst create mode 100644 lib/argparse/meson.build create mode 100644 lib/argparse/rte_argparse.c create mode 100644 lib/argparse/rte_argparse.h create mode 100644 lib/argparse/version.map -- 2.17.1