summaryrefslogtreecommitdiff
path: root/tests/lib/cli/test_cli.in
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2021-08-26 11:43:08 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2021-08-26 21:03:44 +0200
commit90c8406c209a698ecc28c80ad7ebced13a84e3e8 (patch)
tree74bedac5f4d8c3bc5b1bdfb42e6eefaa001d714c /tests/lib/cli/test_cli.in
parent3e324ff41921c719de3aabc4136546828416532f (diff)
lib: add `![...]` syntax for easy "no" forms
This allows defining a CLI command like this: `[no] some setting ![VALUE]` with VALUE being optional for the "no" form, but required for the positive form. It's just a `[...]` where the empty branch can only be taken for commands starting with `no`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'tests/lib/cli/test_cli.in')
-rw-r--r--tests/lib/cli/test_cli.in17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/lib/cli/test_cli.in b/tests/lib/cli/test_cli.in
index 5c146ef984..bd685a6231 100644
--- a/tests/lib/cli/test_cli.in
+++ b/tests/lib/cli/test_cli.in
@@ -74,6 +74,23 @@ pat f
pat f foo
pat f key
+no pat g
+no pat g test
+no pat g test more
+
+pat h foo ?1.2.3.4 final
+no pat h foo ?1.2.3.4 final
+pat h foo final
+no pat h foo final
+pat h bar final
+no pat h bar final
+pat h bar 1::2 final
+no pat h bar 1::2 final
+pat h bar 1::2 foo final
+no pat h bar 1::2 foo final
+pat h bar 1::2 foo 1.2.3.4 final
+no pat h bar 1::2 foo 1.2.3.4 final
+
alt a a?b
alt a 1 .2?.3.4
alt a 1 :2? ::?3