From f5c4671bfbad96bf346bd7e9a21fc4317b4959df Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Sat, 3 Dec 2022 17:00:20 +0530 Subject: Adds most of the tools --- v_windows/v/old/vlib/cli/version.v | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 v_windows/v/old/vlib/cli/version.v (limited to 'v_windows/v/old/vlib/cli/version.v') diff --git a/v_windows/v/old/vlib/cli/version.v b/v_windows/v/old/vlib/cli/version.v new file mode 100644 index 0000000..0f3f583 --- /dev/null +++ b/v_windows/v/old/vlib/cli/version.v @@ -0,0 +1,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) +} -- cgit v1.2.3