From f4b40637d4b184b1b946815c6a20b7a991444249 Mon Sep 17 00:00:00 2001 From: blek Date: Fri, 3 Nov 2023 03:11:50 +1000 Subject: [PATCH] move the version to a .env file --- README.md | 3 ++- main.go | 4 +--- package.env | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 package.env diff --git a/README.md b/README.md index 3ec18c4..8912ca9 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ Also this app utilizes the bFile's [cURL API](https://git.blek.codes/blek/bfile/ ```sh $ git clone this://repo $ cd repo -$ go build . +$ . ./package.env +$ go build . -ldflags "-s -w -X main.version=$VERSION" $ ./bfile_cli ``` diff --git a/main.go b/main.go index 7131004..bd5bab6 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ import "net/textproto" import "github.com/alecthomas/kong" var ( - version string + version string // To be set by compiler ) var Args struct { @@ -104,8 +104,6 @@ func upload(args *kong.Context) { } func main() { - version = "1.0.0" - args := kong.Parse(&Args, kong.Description(fmt.Sprintf("The blek! File CLI %s", version))) switch args.Command() { diff --git a/package.env b/package.env new file mode 100644 index 0000000..624bade --- /dev/null +++ b/package.env @@ -0,0 +1 @@ +VERSION=1.0.0