From ce12892d60261cc623902eaeddd7ba5b33158635 Mon Sep 17 00:00:00 2001 From: AJ Date: Wed, 7 Feb 2024 12:07:54 -0800 Subject: [PATCH] Add docs --- docs/options.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/options.md b/docs/options.md index 67e5c454..faf9426b 100644 --- a/docs/options.md +++ b/docs/options.md @@ -445,10 +445,13 @@ line: You might want a flag option that counts the number of times it occurs on the command line. You can use [`counted`][counted] for this. +You can specify a `limit` for the number of times the [`counted`][counted] option can be given, +and either `clamp` the value or show an error if the limit is exceeded. + === "Example" ```kotlin class Log : CliktCommand() { - val verbosity by option("-v").counted() + val verbosity by option("-v").counted(limit=3, clamp=true) override fun run() { echo("Verbosity level: $verbosity") } @@ -461,6 +464,7 @@ use [`counted`][counted] for this. Verbosity level: 3 ``` + ## Feature Switch Flags Another way to use flags is to assign a value to each option name. You can do this with