github.com/wawandco/oxplugins@v0.7.11/tools/cli/version/version.go (about)

     1  package version
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  
     7  	"github.com/wawandco/oxplugins/plugins"
     8  )
     9  
    10  var (
    11  	// The version of the CLI
    12  	version = "0.0.1"
    13  )
    14  
    15  var (
    16  	// Version is a Command
    17  	_ plugins.Command = (*Version)(nil)
    18  )
    19  
    20  // Version command will print X version.
    21  type Version struct{}
    22  
    23  func (b Version) Name() string {
    24  	return "version"
    25  }
    26  
    27  func (b Version) ParentName() string {
    28  	return ""
    29  }
    30  
    31  func (b Version) HelpText() string {
    32  	return "returns the current version of Oxpecker CLI"
    33  }
    34  
    35  // Run prints the version of the Oxpecker cli
    36  func (b *Version) Run(ctx context.Context, root string, args []string) error {
    37  	fmt.Printf("Oxpecker version %v\n", version)
    38  
    39  	return nil
    40  }