feat: new pmg banner (#68)

* feat: new pmg banner

* commit lenght check
This commit is contained in:
Kunal Singh
2025-08-21 23:01:30 +05:30
committed by GitHub
parent 2493fb4dc6
commit cd8fb52c47
6 changed files with 65 additions and 16 deletions
+6 -15
View File
@@ -3,30 +3,21 @@ package version
import (
"fmt"
"os"
runtimeDebug "runtime/debug"
"github.com/safedep/pmg/internal/ui"
"github.com/safedep/pmg/internal/version"
"github.com/spf13/cobra"
)
var (
version string
commit string
)
func init() {
if version == "" {
buildInfo, _ := runtimeDebug.ReadBuildInfo()
version = buildInfo.Main.Version
}
}
func NewVersionCommand() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Show version and build information",
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Fprintf(os.Stdout, "Version: %s\n", version)
fmt.Fprintf(os.Stdout, "CommitSHA: %s\n", commit)
fmt.Print(ui.GeneratePMGBanner(version.Version, version.Commit))
fmt.Fprintf(os.Stdout, "Version: %s\n", version.Version)
fmt.Fprintf(os.Stdout, "CommitSHA: %s\n", version.Commit)
return nil
},