go-ethereum/internal/cli/version.go
Jerry a131e427f6 Automatically generate markdown pages from bor CLI
Adding a script that can automatically generate markdown pages from bor
CLI, so we can avoid copy-pasting helper strings whenever a flag is created,
deleted, or modified.

CLI docs could be generated with command `make docs`.
2022-05-09 17:10:36 +02:00

50 lines
1,018 B
Go

package cli
import (
"strings"
"github.com/ethereum/go-ethereum/params"
"github.com/mitchellh/cli"
)
// VersionCommand is the command to show the version of the agent
type VersionCommand struct {
UI cli.Ui
}
// MarkDown implements cli.MarkDown interface
func (d *VersionCommand) MarkDown() string {
examples := []string{
"## Usage",
CodeBlock([]string{
"$ bor version",
"0.2.9-stable",
}),
}
items := []string{
"# Version",
"The ```bor version``` command outputs the version of the binary.",
}
items = append(items, examples...)
return strings.Join(items, "\n\n")
}
// Help implements the cli.Command interface
func (c *VersionCommand) Help() string {
return `Usage: bor version
Display the Bor version`
}
// Synopsis implements the cli.Command interface
func (c *VersionCommand) Synopsis() string {
return "Display the Bor version"
}
// Run implements the cli.Command interface
func (c *VersionCommand) Run(args []string) int {
c.UI.Output(params.VersionWithMeta)
return 0
}