github.com/palisadeinc/bor@v0.0.0-20230615125219-ab7196213d15/internal/cli/version.go (about) 1 package cli 2 3 import ( 4 "strings" 5 6 "github.com/ethereum/go-ethereum/params" 7 8 "github.com/mitchellh/cli" 9 ) 10 11 // VersionCommand is the command to show the version of the agent 12 type VersionCommand struct { 13 UI cli.Ui 14 } 15 16 // MarkDown implements cli.MarkDown interface 17 func (d *VersionCommand) MarkDown() string { 18 examples := []string{ 19 "## Usage", 20 CodeBlock([]string{ 21 "$ bor version", 22 "0.2.9-stable", 23 }), 24 } 25 26 items := []string{ 27 "# Version", 28 "The ```bor version``` command outputs the version of the binary.", 29 } 30 items = append(items, examples...) 31 32 return strings.Join(items, "\n\n") 33 } 34 35 // Help implements the cli.Command interface 36 func (c *VersionCommand) Help() string { 37 return `Usage: bor version 38 39 Display the Bor version` 40 } 41 42 // Synopsis implements the cli.Command interface 43 func (c *VersionCommand) Synopsis() string { 44 return "Display the Bor version" 45 } 46 47 // Run implements the cli.Command interface 48 func (c *VersionCommand) Run(args []string) int { 49 c.UI.Output(params.VersionWithMetaCommitDetails) 50 51 return 0 52 }