From 410f6540daf1505461a90b9a6cb82977722811f1 Mon Sep 17 00:00:00 2001 From: Ron Evans Date: Tue, 13 Jul 2021 17:41:39 +0200 Subject: [PATCH] all: add version to pkg/cli for troubleshooting --- cmd/kd6ctl/main.go | 12 +++++++++++- version.go | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 version.go diff --git a/cmd/kd6ctl/main.go b/cmd/kd6ctl/main.go index 2ef8a37..2e021af 100644 --- a/cmd/kd6ctl/main.go +++ b/cmd/kd6ctl/main.go @@ -19,6 +19,16 @@ func main() { port = rootFlagSet.String("p", "/dev/corser/XtiumCLMX41_s0", "port of KD6RMX sensor to use") ) + version := &ffcli.Command{ + Name: "version", + ShortUsage: "kd6ctl version", + ShortHelp: "Show version of kd6ctl API.", + Exec: func(_ context.Context, args []string) error { + fmt.Println(kd6rmx.Version) + return nil + }, + } + load := &ffcli.Command{ Name: "load", ShortUsage: "kd6ctl load ", @@ -278,7 +288,7 @@ func main() { ShortUsage: "kd6ctl [flags] ", ShortHelp: "kd6ctl is a command line utility to change config on the KD6RMX contact image sensor.", FlagSet: rootFlagSet, - Subcommands: []*ffcli.Command{load, save, outputfreq, outputfmt, interp, dark, white, leds, duty}, + Subcommands: []*ffcli.Command{version, load, save, outputfreq, outputfmt, interp, dark, white, leds, duty}, Exec: func(context.Context, []string) error { return flag.ErrHelp }, diff --git a/version.go b/version.go new file mode 100644 index 0000000..bbc692d --- /dev/null +++ b/version.go @@ -0,0 +1,3 @@ +package kd6rmx + +const Version = "0.5.0-dev"