From 0fac4a3c1447baccfcf837f134b886cdc0ab5149 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sat, 27 Feb 2021 22:42:09 -0600 Subject: [PATCH] Add version command --- cmd/main.go | 3 +++ cmd/version.go | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/cmd/main.go b/cmd/main.go index e4928d3..4c46407 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -26,8 +26,11 @@ func init() { RegisterCommand(NewCmdSetWhite()) RegisterCommand(NewCmdShow()) RegisterCommand(NewCmdToggle()) + RegisterCommand(NewCmdVersion()) } +const Version = "0.1.0-pre" + const lumercFile string = ".lumerc" func Main(args []string) (int, error) { diff --git a/cmd/version.go b/cmd/version.go index cb00b1d..0dd90d3 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -1,3 +1,20 @@ package lumecmd -const Version = "0.1.0-pre" +import ( + "fmt" +) + +func NewCmdVersion() Command { + return Command{ + Name: "version", + Func: VersionCmd, + Flags: nil, + Use: "", + Short: "Show version", + } +} + +func VersionCmd(args CmdArgs) (int, error) { + fmt.Println(Version) + return ExitSuccess, nil +}