v / vlib / cli
Raw file | 25 loc (22 sloc) | 489 bytes | Latest commit hash 017ace6ea
1module cli
2
3fn version_flag(with_abbrev bool) Flag {
4 sabbrev := if with_abbrev { 'v' } else { '' }
5 return Flag{
6 flag: .bool
7 name: 'version'
8 abbrev: sabbrev
9 description: 'Prints version information.'
10 }
11}
12
13fn version_cmd() Command {
14 return Command{
15 name: 'version'
16 description: 'Prints version information.'
17 execute: version_func
18 }
19}
20
21fn version_func(version_cmd Command) ! {
22 cmd := version_cmd.parent
23 version := '${cmd.name} version ${cmd.version}'
24 println(version)
25}