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

     1  package cli
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/mitchellh/cli"
     7  )
     8  
     9  // PeersCommand is the command to group the peers commands
    10  type PeersCommand struct {
    11  	UI cli.Ui
    12  }
    13  
    14  // MarkDown implements cli.MarkDown interface
    15  func (a *PeersCommand) MarkDown() string {
    16  	items := []string{
    17  		"# Peers",
    18  		"The ```peers``` command groups actions to interact with peers:",
    19  		"- [```peers add```](./peers_add.md): Joins the local client to another remote peer.",
    20  		"- [```peers list```](./peers_list.md): Lists the connected peers to the Bor client.",
    21  		"- [```peers remove```](./peers_remove.md): Disconnects the local client from a connected peer if exists.",
    22  		"- [```peers status```](./peers_status.md): Display the status of a peer by its id.",
    23  	}
    24  
    25  	return strings.Join(items, "\n\n")
    26  }
    27  
    28  // Help implements the cli.Command interface
    29  func (c *PeersCommand) Help() string {
    30  	return `Usage: bor peers <subcommand>
    31  
    32    This command groups actions to interact with peers.
    33  	
    34    List the connected peers:
    35    
    36      $ bor peers list
    37  	
    38    Add a new peer by enode:
    39    
    40      $ bor peers add <enode>
    41  
    42    Remove a connected peer by enode:
    43  
    44      $ bor peers remove <enode>
    45  
    46    Display information about a peer:
    47  
    48      $ bor peers status <peer id>`
    49  }
    50  
    51  // Synopsis implements the cli.Command interface
    52  func (c *PeersCommand) Synopsis() string {
    53  	return "Interact with peers"
    54  }
    55  
    56  // Run implements the cli.Command interface
    57  func (c *PeersCommand) Run(args []string) int {
    58  	return cli.RunResultHelp
    59  }