mirror of
https://github.com/pushbits/cli.git
synced 2025-07-24 04:00:35 +02:00
24 lines
563 B
Go
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
|
|
}
|