1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/cli/version.v
Alexander Medvednikov f087e819d7 cli: minor fixes
2020-04-02 16:04:57 +02:00

26 lines
429 B
V

module cli
fn version_flag() Flag {
return Flag{
flag: .bool,
name: 'version',
abbrev: 'v',
description: 'Prints version information',
}
}
fn version_cmd() Command {
return Command{
name: 'version'
description: 'Prints version information',
execute: version_func,
parent: 0
}
}
fn version_func(version_cmd Command) {
cmd := version_cmd.parent
version := '${cmd.name} v${cmd.version}'
println(version)
}