aboutsummaryrefslogtreecommitdiffstats
path: root/libtests
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-01-07 21:29:27 +0100
committerJay Berkenbilt <ejb@ql.org>2022-01-30 19:11:03 +0100
commit53ba65eb59d0bced37e73d8bf96a0d7a7285f662 (patch)
tree29049c9c37ba25ea22313b83ac93e20a0a48b74b /libtests
parenta301cc5373f14fd03e51619b0bd5fad22b84e115 (diff)
downloadqpdf-53ba65eb59d0bced37e73d8bf96a0d7a7285f662.tar.zst
QPDFArgParser: handle optional choices including help
Handle optional choices in addition to required choices. Refactor the way help options are added to completion to make it work with optional help choices.
Diffstat (limited to 'libtests')
-rw-r--r--libtests/arg_parser.cc2
-rw-r--r--libtests/qtest/arg_parser/completion-top-arg-zsh.out3
2 files changed, 4 insertions, 1 deletions
diff --git a/libtests/arg_parser.cc b/libtests/arg_parser.cc
index a57b9c66..3da0206e 100644
--- a/libtests/arg_parser.cc
+++ b/libtests/arg_parser.cc
@@ -51,7 +51,7 @@ ArgParser::initOptions()
ap.addRequiredParameter("salad", p(&ArgParser::handleSalad), "tossed");
ap.addOptionalParameter("moo", p(&ArgParser::handleMoo));
char const* choices[] = {"pig", "boar", "sow", 0};
- ap.addRequiredChoices("oink", p(&ArgParser::handleOink), choices);
+ ap.addChoices("oink", p(&ArgParser::handleOink), true, choices);
ap.selectHelpOptionTable();
ap.addBare("version", [this](){ output("3.14159"); });
ap.selectMainOptionTable();
diff --git a/libtests/qtest/arg_parser/completion-top-arg-zsh.out b/libtests/qtest/arg_parser/completion-top-arg-zsh.out
index 11bcb3b6..5a500d38 100644
--- a/libtests/qtest/arg_parser/completion-top-arg-zsh.out
+++ b/libtests/qtest/arg_parser/completion-top-arg-zsh.out
@@ -1,5 +1,8 @@
--baaa
--completion-zsh
+--help
+--help=
+--help=all
--moo
--moo=
--oink=