Moved fancy ascii art to subcommand

This commit is contained in:
kolaente 2018-12-08 00:43:26 +01:00
parent 4403059569
commit 289df7e96a
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 61 additions and 25 deletions

View File

@ -19,7 +19,7 @@ GOFMT ?= gofmt -s
GOFLAGS := -v -mod=vendor
EXTRA_GOFLAGS ?=
LDFLAGS := -X "main.Version=$(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')" -X "main.Tags=$(TAGS)"
LDFLAGS := -X "cmd.Version=$(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')" -X "main.Tags=$(TAGS)"
PACKAGES ?= $(filter-out git.kolaente.de/sofaraum/client/integrations,$(shell go list ./... | grep -v /vendor/))
SOURCES ?= $(shell find . -name "*.go" -type f)

60
cmd/version.go Normal file
View File

@ -0,0 +1,60 @@
// Sofaraum client is the client software which collects statistics about
// wifi devices nearby and then sends them to the Sofaraum Server.
// Copyright (c) 2018.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
// Version sets the version. Will be overwritten by drone or when building with the makefile
var Version = "0.1"
var TheSofa = `
___.--------'´´´´´´:´´´´´´'--------.___
( | : | )
\ ,;,,, : | /
|\%%%%\___________:__________/~~~~~/|
/ ,\%%%%\ | / @*@ /, \
/_ / ´´´´´ | ~~~~~~ \ _\
(@l) | (@l)
||__________________|__________________||
||_____________________________________||
/_|_____________________________________|_\
=================================================
Sofaraum Client Version ` + Version + `
Copyright (C) 2018 K. Langenberg
This program comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome
to redistribute it under certain conditions
=================================================`
// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Shows version information",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(TheSofa)
},
}
func init() {
rootCmd.AddCommand(versionCmd)
}

24
main.go
View File

@ -21,30 +21,6 @@ import (
"git.kolaente.de/sofaraum/client/cmd"
)
// Version sets the version. Will be overwritten by drone or when building with the makefile
const Version = `0.1`
const TheSofa = `
___.--------'´´´´´´:´´´´´´'--------.___
( | : | )
\ ,;,,, : | /
|\%%%%\___________:__________/~~~~~/|
/ ,\%%%%\ | / @*@ /, \
/_ / ´´´´´ | ~~~~~~ \ _\
(@l) | (@l)
||__________________|__________________||
||_____________________________________||
/_|_____________________________________|_\
=================================================
Sofaraum Client Version ` + Version + `
Copyright (C) 2018 K. Langenberg
This program comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome
to redistribute it under certain conditions
=================================================`
func main() {
cmd.Execute()
}