v/vlib/cli/version.v

26 lines
429 B
V
Raw Normal View History

2019-11-21 13:03:12 +01:00
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,
2020-01-02 18:09:24 +01:00
parent: 0
2019-11-21 13:03:12 +01:00
}
}
2020-04-02 16:04:53 +02:00
fn version_func(version_cmd Command) {
2019-11-21 13:03:12 +01:00
cmd := version_cmd.parent
version := '${cmd.name} v${cmd.version}'
println(version)
}