github.com/number571/tendermint@v0.34.11-gost/cmd/tendermint/commands/show_node_id.go (about)

     1  package commands
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/spf13/cobra"
     7  )
     8  
     9  // ShowNodeIDCmd dumps node's ID to the standard output.
    10  var ShowNodeIDCmd = &cobra.Command{
    11  	Use:     "show-node-id",
    12  	Aliases: []string{"show_node_id"},
    13  	Short:   "Show this node's ID",
    14  	RunE:    showNodeID,
    15  	PreRun:  deprecateSnakeCase,
    16  }
    17  
    18  func showNodeID(cmd *cobra.Command, args []string) error {
    19  	nodeKeyID, err := config.LoadNodeKeyID()
    20  	if err != nil {
    21  		return err
    22  	}
    23  
    24  	fmt.Println(nodeKeyID)
    25  	return nil
    26  }