Released v1

This commit is contained in:
Steve Cliff
2026-02-12 10:37:19 +00:00
commit b07572fed5
77 changed files with 19518 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
package cmd
import (
"fmt"
"os/exec"
"github.com/spf13/cobra"
)
var versionCmd = &cobra.Command{
Use: "version",
Short: "Show version information",
Long: "Display the current version of pcli",
Run: func(cmd *cobra.Command, args []string) {
version := getVersion()
fmt.Println(version)
},
}
func init() {
rootCmd.AddCommand(versionCmd)
}
func getVersion() string {
// Try to get version from git tag
version, err := exec.Command("git", "describe", "--tags", "--exact-match").Output()
if err == nil && len(version) > 0 {
return string(version)
}
// Fallback to timestamp-based version
dateCmd := exec.Command("date", "+%Y%m%d-%H%M%S")
date, err := dateCmd.Output()
if err != nil {
// Ultimate fallback
return "unknown"
}
return "v" + string(date)
}