From 6c5568c9b4a4424c2a684d6fb137737b09032ee7 Mon Sep 17 00:00:00 2001 From: T3d Date: Tue, 14 Jun 2022 21:29:49 +0200 Subject: [PATCH 1/3] #3 Proposal to print rai version --- rai/main.go | 2 +- rai/version_current.go | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 rai/version_current.go diff --git a/rai/main.go b/rai/main.go index 368fb0b..7d9fa17 100644 --- a/rai/main.go +++ b/rai/main.go @@ -293,7 +293,7 @@ func addCommands(root *cobra.Command) { } func main() { - var root = &cobra.Command{Use: "rai"} + var root = &cobra.Command{Use: "rai", Version: version} // todo: additional root options // --request-timeout // --token : Bearer token for authenticating API request diff --git a/rai/version_current.go b/rai/version_current.go new file mode 100644 index 0000000..82f6cb4 --- /dev/null +++ b/rai/version_current.go @@ -0,0 +1,18 @@ +// Copyright 2022 RelationalAI, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +// Represents the current rai's CLI version +var version = "0.1.1-alpha" From 929e81c088183c1c1819e58afb75339919913cca Mon Sep 17 00:00:00 2001 From: T3d Date: Wed, 5 Oct 2022 19:31:25 +0200 Subject: [PATCH 2/3] Rename version_current.go to version.go --- rai/{version_current.go => version.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename rai/{version_current.go => version.go} (100%) diff --git a/rai/version_current.go b/rai/version.go similarity index 100% rename from rai/version_current.go rename to rai/version.go From 9c888675f1bf82c961940995b616e8946de31516 Mon Sep 17 00:00:00 2001 From: T3d Date: Wed, 5 Oct 2022 19:56:47 +0200 Subject: [PATCH 3/3] Note about how version's value may be overwritten --- rai/version.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rai/version.go b/rai/version.go index 82f6cb4..022e5f0 100644 --- a/rai/version.go +++ b/rai/version.go @@ -15,4 +15,6 @@ package main // Represents the current rai's CLI version +// May be overwritten at link time using ldflags (linker flags): +// -ldflags="-X 'main.version=0.1.2-alpha'" var version = "0.1.1-alpha"