Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

Commit 97042b0

Browse files
committed
docs(readme): update the main example
1 parent 6b02794 commit 97042b0

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,24 @@ Example usage of the library:
2222
```jule
2323
use "cliq"
2424
25-
static ArgMap: map[int][2]str = {
26-
// the indexes start from 1 because 0 is reserved for `help`
27-
1: ["version", "Display version information"],
28-
}
29-
3025
fn main() {
31-
mut cliq := cliq::Init()
32-
cliq.Parse(/* allow_multiple: */ false)
33-
34-
if cliq.Res["version"] {
35-
println("version goes here...")
26+
mut cliq := cliq::Builder{
27+
Args: {
28+
// flag: default value (type)
29+
"ping": false,
30+
"message": "",
31+
},
32+
}.Help().Build()
33+
34+
cliq.GetCLI()
35+
cliq.Parse()
36+
37+
ping := cliq.Get("ping") // bool due to the default value
38+
message := cliq.Get("message") // str due to the default value
39+
40+
if ping == true {
41+
print("pong! ")
42+
println(message)
3643
}
3744
}
3845
```

0 commit comments

Comments
 (0)