mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-24 03:21:36 +01:00
added version command
Signed-off-by: Andreas Ulm <andreas.ulm@root360.de>
This commit is contained in:
parent
10a9b72cdb
commit
98b7f52e44
35
cmd/version.go
Normal file
35
cmd/version.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright © 2019 The Gitea Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Version holds the current Gitea version
|
||||||
|
var Version = "0.1.0-dev"
|
||||||
|
|
||||||
|
// Tags holds the build tags used
|
||||||
|
var Tags = ""
|
||||||
|
|
||||||
|
// versionCmd represents the version command
|
||||||
|
var versionCmd = &cobra.Command{
|
||||||
|
Use: "version",
|
||||||
|
Short: "Print version",
|
||||||
|
Long: ``,
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
if len(Tags) > 0 {
|
||||||
|
Version += " built with: " + strings.Replace(Tags, " ", ", ", -1)
|
||||||
|
}
|
||||||
|
fmt.Println("Version " + Version)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.AddCommand(versionCmd)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user