Skip to content

Commit 01d3481

Browse files
committed
update runnable example
Signed-off-by: George Lemon <georgelemon@protonmail.com>
1 parent 6d9951e commit 01d3481

1 file changed

Lines changed: 26 additions & 13 deletions

File tree

src/kapsis.nim

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,35 @@ import ./kapsis/[framework, runtime]
88
export framework, tables
99

1010
when isMainModule:
11-
proc installCommand(v: Values) =
11+
proc helloCommand(v: Values) =
1212
echo v.get("pkgname").getStr
1313

14-
proc developCommand(v: Values) =
15-
echo "Hello, World!"
14+
proc greetCommand(v: Values) =
15+
if v.has("greeting"):
16+
echo v.get("greeting").getStr
17+
echo v.get("name").getStr
1618

17-
proc buildCommand(v: Values) =
18-
echo "Hello, World!"
19+
proc colorsRedCommand(v: Values) =
20+
echo "Red color command, name: ", v.get("name").getStr
21+
22+
proc colorsBlueCommand(v: Values) =
23+
echo "Blue color command, name: ", v.get("name").getStr
1924

2025
when isMainModule:
2126
initKapsis do:
22-
commands:
23-
-- "Package Manager"
24-
install string(pkgname), string("-x"):
25-
## Installs a list of packages
26-
develop string(pkgname), int(age), string("-x"):
27-
## Clones a list of packages for development. Adds them to a develop file if specified or
28-
build bool(pkgname):
29-
## Builds a list of packages for development. Adds them to a develop file if specified or
27+
commands do:
28+
-- "Crazy stuff"
29+
hello name.string, int(age), ?bool(verbose):
30+
## This is a comment
31+
32+
-- "Another command"
33+
greet name.string, ?string(greeting):
34+
## Another comment
35+
36+
-- "Subcommand example"
37+
colors:
38+
## Colors command with subcommands
39+
red string(name):
40+
## Red color command
41+
blue string(name):
42+
## Blue color command

0 commit comments

Comments
 (0)