mirror of
https://gitlab.com/psuapp/psu.git
synced 2024-08-30 18:12:34 +00:00
Mover version-related code to the version package
This commit is contained in:
parent
50d246ecf7
commit
0cdaf49425
@ -8,7 +8,7 @@ builds:
|
||||
- main: main.go
|
||||
binary: psu
|
||||
ldflags:
|
||||
- -X github.com/greenled/portainer-stack-utils/common.version={{ .Version }} -X github.com/greenled/portainer-stack-utils/common.commitHash={{ .ShortCommit }} -X github.com/greenled/portainer-stack-utils/common.buildDate={{ .Date }}
|
||||
- -X github.com/greenled/portainer-stack-utils/version.version={{ .Version }} -X github.com/greenled/portainer-stack-utils/version.commitHash={{ .ShortCommit }} -X github.com/greenled/portainer-stack-utils/version.buildDate={{ .Date }}
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
|
@ -5,9 +5,10 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/greenled/portainer-stack-utils/version"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/greenled/portainer-stack-utils/common"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
@ -35,7 +36,7 @@ func init() {
|
||||
cobra.OnInitialize(initConfig, initLogger)
|
||||
|
||||
rootCmd.SetVersionTemplate("{{ version }}\n")
|
||||
cobra.AddTemplateFunc("version", common.BuildVersionString)
|
||||
cobra.AddTemplateFunc("version", version.BuildVersionString)
|
||||
|
||||
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "Config file. (default \"$HOME/.psu.yaml)\"")
|
||||
rootCmd.PersistentFlags().StringP("log-level", "v", "info", "Log level. One of trace, debug, info, warning, error, fatal or panic.")
|
||||
|
@ -8,6 +8,8 @@ import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/greenled/portainer-stack-utils/version"
|
||||
|
||||
"github.com/greenled/portainer-stack-utils/client"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
@ -92,7 +94,7 @@ func GetDefaultClientConfig() (config client.Config, err error) {
|
||||
User: viper.GetString("user"),
|
||||
Password: viper.GetString("password"),
|
||||
Token: viper.GetString("auth-token"),
|
||||
UserAgent: BuildUseAgentString(),
|
||||
UserAgent: version.BuildUseAgentString(),
|
||||
DoNotUseToken: false,
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package common
|
||||
package version
|
||||
|
||||
import (
|
||||
"fmt"
|
Loading…
Reference in New Issue
Block a user