aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/vlib/cli/version.v
blob: 0f3f583b88cc2cc932d02f0659087b72f89c60cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module cli

fn version_flag(with_abbrev bool) Flag {
	sabbrev := if with_abbrev { 'v' } else { '' }
	return Flag{
		flag: .bool
		name: 'version'
		abbrev: sabbrev
		description: 'Prints version information.'
	}
}

fn version_cmd() Command {
	return Command{
		name: 'version'
		description: 'Prints version information.'
		execute: version_func
	}
}

fn version_func(version_cmd Command) ? {
	cmd := version_cmd.parent
	version := '$cmd.name version $cmd.version'
	println(version)
}