phosphor-gpio-presence: Add expected method for CLI11
The Phosph-gpio-presence@.service template has a --drivers and
--extra-ifaces which can be empty in some configurations[1].
systemd will end up launching the process with an extra empty
argument. CLI11 will fail unless we give an explicit
"--drivers=<value> or --extra-ifaces=<value>".
Add the expected method to --drivers and --extra-ifaces to limit the
number of incoming parameters for parameters.
Observed in hardware testing:
```
--drivers: 1 required TEXT missing
Run with --help for more information.
```
[1] https://github.com/openbmc/openbmc/blob/master/meta-facebook/meta-bletchley/recipes-phosphor/gpio/phosphor-gpio-monitor/obmc/gpio/presence-sled1.conf
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Iab8da95d88843652e657933656d9121b43311655
diff --git a/presence/main.cpp b/presence/main.cpp
index aa1eb24..3e94b85 100644
--- a/presence/main.cpp
+++ b/presence/main.cpp
@@ -80,15 +80,17 @@
"Object path under inventory that will be created")
->required();
app.add_option(
- "-d,--drivers", drivers,
- "List of drivers to bind when card is added and unbind when card is removed\n"
- "Format is a space separated list of path,device pairs.\n"
- "For example: /sys/bus/i2c/drivers/some-driver,3-0068");
+ "-d,--drivers", drivers,
+ "List of drivers to bind when card is added and unbind when card is removed\n"
+ "Format is a space separated list of path,device pairs.\n"
+ "For example: /sys/bus/i2c/drivers/some-driver,3-0068")
+ ->expected(0, 1);
app.add_option(
- "-e,--extra-ifaces", ifaces,
- "List of interfaces to associate to inventory item\n"
- "Format is a comma separated list of interfaces.\n"
- "For example: /xyz/openbmc_project/.../1,/xyz/openbmc_project/.../2");
+ "-e,--extra-ifaces", ifaces,
+ "List of interfaces to associate to inventory item\n"
+ "Format is a comma separated list of interfaces.\n"
+ "For example: /xyz/openbmc_project/.../1,/xyz/openbmc_project/.../2")
+ ->expected(0, 1);
/* Parse input parameter */
try