cmd/portr/cmd/version.go
// `portr version` — print build info.
//
// See mercemay.top/src/portr/ for context.
package cmd
import (
"fmt"
"runtime"
"github.com/spf13/cobra"
)
// Version is overwritten at link time via -ldflags.
var (
Version = "dev"
Commit = "none"
Date = "unknown"
)
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print version information",
Run: func(_ *cobra.Command, _ []string) {
fmt.Printf("portr %s (%s, %s) %s/%s\n",
Version, Commit, Date,
runtime.GOOS, runtime.GOARCH,
)
},
}