argument parser: use CLI11 and add unit tests
CLI11 is one of the most commonly use argument parser in OpenBMC. It can
save ~150 lines of codes in this project.
We are hitting argument related bugs that not covered in unit tests.
This test adds a test for argument parsing.
Tested: QEMU IPMI/Redfish worked.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ib409c7e6a82ad31049f2da3e32727ebdf185f0fc
diff --git a/meson.build b/meson.build
index 0720247..e2a337f 100644
--- a/meson.build
+++ b/meson.build
@@ -17,6 +17,18 @@
phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
phosphor_logging_dep = dependency('phosphor-logging')
+cli11_dep = dependency('cli11', required: false)
+has_cli11 = meson.get_compiler('cpp').has_header_symbol(
+ 'CLI/CLI.hpp',
+ 'CLI::App',
+ dependencies: cli11_dep,
+ required: false)
+if not has_cli11
+ cli11_proj = subproject('cli11', required: false)
+ assert(cli11_proj.found(), 'CLI11 is required')
+ cli11_dep = cli11_proj.get_variable('CLI11_dep')
+endif
+
systemd_dep = dependency('systemd')
openssl_dep = dependency('openssl')
@@ -42,6 +54,7 @@
phosphor_logging_dep,
sdbusplus_dep,
sdeventplus_dep,
+ cli11_dep,
]
cert_manager_lib = static_library(