github.com/ari-anchor/sei-tendermint@v0.0.0-20230519144642-dc826b7b56bb/cmd/tendermint/commands/show_node_id.go (about)

     1  package commands
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/spf13/cobra"
     7  
     8  	"github.com/ari-anchor/sei-tendermint/config"
     9  )
    10  
    11  // MakeShowNodeIDCommand constructs a command to dump the node ID to stdout.
    12  func MakeShowNodeIDCommand(conf *config.Config) *cobra.Command {
    13  	return &cobra.Command{
    14  		Use:   "show-node-id",
    15  		Short: "Show this node's ID",
    16  		RunE: func(cmd *cobra.Command, args []string) error {
    17  			nodeKeyID, err := conf.LoadNodeKeyID()
    18  			if err != nil {
    19  				return err
    20  			}
    21  
    22  			fmt.Println(nodeKeyID)
    23  			return nil
    24  		},
    25  	}
    26  }