Files
pushbits-cli/internal/commands/version.go
2025-02-22 19:29:09 +01:00

24 lines
563 B
Go

// Package commands contains functions that are exposed as dedicated commands of the tool.
package commands
import (
"fmt"
"runtime/debug"
"github.com/pushbits/cli/internal/options"
)
// VersionCommand represents the options specific to the version command.
type VersionCommand struct{}
// Run is the function for the version command.
func (*VersionCommand) Run(_ *options.Options) error {
buildInfo, ok := debug.ReadBuildInfo()
if !ok {
return fmt.Errorf("build info not available")
}
fmt.Printf("pbcli %s\n", buildInfo.Main.Version)
return nil
}