Re: [dpdk-dev] [PATCH 00/11] improve options help
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2021-03-10 00:45:16
On Wed, 10 Mar 2021 00:31:04 +0100 Thomas Monjalon [off-list ref] wrote:
The main intent of this series is to provide a nice help for the --log-level option. More patches are added to improve options help in general. Thomas Monjalon (11): eal: explain argv behaviour during init eal: improve options usage text eal: use macros for help option eal: move private log functions eal: introduce maximum log level macro eal: catch invalid log level number eal: add log level help app: fix exit messages app: hook in EAL usage help app/regex: fix usage text app/testpmd: fix usage text app/pdump/main.c | 2 + app/proc-info/main.c | 2 + app/test-acl/main.c | 2 + app/test-bbdev/main.c | 3 +- app/test-compress-perf/comp_perf_options.h | 2 + .../comp_perf_options_parse.c | 10 +-- app/test-compress-perf/main.c | 3 +- app/test-crypto-perf/cperf_options.h | 2 + app/test-crypto-perf/cperf_options_parsing.c | 10 +-- app/test-crypto-perf/main.c | 3 +- app/test-fib/main.c | 8 +++ app/test-flow-perf/main.c | 63 +++++++++--------- app/test-pmd/parameters.c | 34 ++-------- app/test-pmd/testpmd.c | 2 + app/test-pmd/testpmd.h | 1 + app/test-regex/main.c | 10 +-- app/test-sad/main.c | 7 ++ lib/librte_eal/common/eal_common_log.c | 50 +++++++++----- lib/librte_eal/common/eal_common_options.c | 66 ++++++++++++------- lib/librte_eal/common/eal_log.h | 32 +++++++++ lib/librte_eal/common/eal_private.h | 29 -------- lib/librte_eal/freebsd/eal.c | 10 +-- lib/librte_eal/include/rte_eal.h | 2 + lib/librte_eal/include/rte_log.h | 12 ++++ lib/librte_eal/linux/eal.c | 17 ++--- lib/librte_eal/linux/eal_log.c | 4 +- lib/librte_eal/version.map | 3 + lib/librte_eal/windows/eal.c | 15 ++--- lib/librte_eal/windows/eal_log.c | 6 +- 29 files changed, 237 insertions(+), 173 deletions(-) create mode 100644 lib/librte_eal/common/eal_log.h
It probably isn't worth the effort, but python argparse style is much easier (and self documenting) compared to the C getopt stuff. There are several C versions of similar libraries. https://github.com/cofyc/argparse https://www.argtable.org/