github.com/palisadeinc/bor@v0.0.0-20230615125219-ab7196213d15/internal/cli/chain.go (about)

     1  package cli
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/mitchellh/cli"
     7  )
     8  
     9  // ChainCommand is the command to group the peers commands
    10  type ChainCommand struct {
    11  	UI cli.Ui
    12  }
    13  
    14  // MarkDown implements cli.MarkDown interface
    15  func (c *ChainCommand) MarkDown() string {
    16  	items := []string{
    17  		"# Chain",
    18  		"The ```chain``` command groups actions to interact with the blockchain in the client:",
    19  		"- [```chain sethead```](./chain_sethead.md): Set the current chain to a certain block.",
    20  		"- [```chain watch```](./chain_watch.md): Watch the chainHead, reorg and fork events in real-time.",
    21  	}
    22  
    23  	return strings.Join(items, "\n\n")
    24  }
    25  
    26  // Help implements the cli.Command interface
    27  func (c *ChainCommand) Help() string {
    28  	return `Usage: bor chain <subcommand>
    29  
    30    This command groups actions to interact with the chain.
    31  	
    32    Set the new head of the chain:
    33    
    34      $ bor chain sethead <number>`
    35  }
    36  
    37  // Synopsis implements the cli.Command interface
    38  func (c *ChainCommand) Synopsis() string {
    39  	return "Interact with the chain"
    40  }
    41  
    42  // Run implements the cli.Command interface
    43  func (c *ChainCommand) Run(args []string) int {
    44  	return cli.RunResultHelp
    45  }