Add version to CLI and write commit sha to release build

This commit is contained in:
Ettore Di Giacinto 2019-11-17 16:12:12 +01:00
parent 8ed2badefc
commit a806937941
No known key found for this signature in database
GPG Key ID: 1ADA699B145A2D1C
2 changed files with 8 additions and 5 deletions

View File

@ -1,8 +1,8 @@
NAME ?= luet
PACKAGE_NAME ?= $(NAME)
PACKAGE_CONFLICT ?= $(PACKAGE_NAME)-beta
REVISION := $(shell git rev-parse --short HEAD || echo unknown)
VERSION := $(shell git describe --tags || echo dev)
REVISION := $(shell git rev-parse --short HEAD || echo dev)
VERSION := $(shell git describe --tags || echo $(REVISION))
VERSION := $(shell echo $(VERSION) | sed -e 's/^v//g')
ITTERATION := $(shell date +%s)
BUILD_PLATFORMS ?= -osarch="linux/amd64" -osarch="linux/386" -osarch="linux/arm"

View File

@ -29,11 +29,14 @@ import (
var cfgFile string
var Verbose bool
const LuetCLIVersion = "0.1-dev"
// RootCmd represents the base command when called without any subcommands
var RootCmd = &cobra.Command{
Use: "luet",
Short: "Package manager for the XXth century!",
Long: `Package manager which supports Gentoo and Entropy packages`,
Use: "luet",
Short: "Package manager for the XXth century!",
Long: `Package manager which supports Gentoo and Entropy packages`,
Version: LuetCLIVersion,
}
// Execute adds all child commands to the root command sets flags appropriately.