v1
Test / test (push) Successful in 3m36s
Release / release (push) Successful in 7m31s

This commit is contained in:
Sebastian Unterschütz committed 2026-11-17 19:00:44 +01:00
commit 8d4915543e
132 files changed
+20628

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
package main
import (
"fmt"
"runtime/debug"
"github.com/spf13/cobra"
)
// version is set at build time: -ldflags "-X main.version=v1.2.3".
var version = ""
// buildVersion falls back to the module version for `go install` builds.
func buildVersion() string {
if version != "" {
return version
}
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "" && info.Main.Version != "(devel)" {
return info.Main.Version
}
return "dev"
}
func versionCmd() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Print the netssh version",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
fmt.Fprintf(cmd.OutOrStdout(), "netssh %s\n", buildVersion())
},
}
}