[cmd] elaborated root cmd usage

pull/3278/head
Jacky Wang 4 years ago
parent 8aa9351ddf
commit 4289737e29
No known key found for this signature in database
GPG Key ID: 1085CE5F4FF5842C
  1. 5
      cmd/harmony/config.go
  2. 23
      cmd/harmony/main.go

@ -1,6 +1,7 @@
package main package main
import ( import (
"errors"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
@ -153,6 +154,10 @@ func validateHarmonyConfig(config harmonyConfig) error {
return err return err
} }
if config.General.NodeType == nodeTypeExplorer && config.General.ShardID < 0 {
return errors.New("flag --run.shard must be specified for explorer node")
}
return nil return nil
} }

@ -47,10 +47,27 @@ var (
) )
var rootCmd = &cobra.Command{ var rootCmd = &cobra.Command{
// TODO: elaborate the usage
Use: "harmony", Use: "harmony",
Short: "run harmony node", Short: "harmony is the Harmony node binary file",
Long: "run harmony node", Long: `harmony is the Harmony node binary file
Examples usage:
# start a validator node with default bls folder (default bls key files in ./.hmy/blskeys)
./harmony
# start a validator node with customized bls key folder
./harmony --bls.dir [bls_folder]
# start a validator node with open RPC endpoints and customized ports
./harmony --http.ip 0.0.0.0 --http.port [http_port] --ws.ip 0.0.0.0 --ws.port [ws_port]
# start an explorer node
./harmony --run explorer --run.archive --run.shard [shard_id]
# start a harmony internal node on testnet
./harmony --run.legacy --network
`,
Run: runHarmonyNode, Run: runHarmonyNode,
} }

Loading…
Cancel
Save