move id command under net
This commit is contained in:
parent
57df9fdd9e
commit
4a34e20ffc
@ -61,7 +61,6 @@ func reqContext(cctx *cli.Context) context.Context {
|
|||||||
var Commands = []*cli.Command{
|
var Commands = []*cli.Command{
|
||||||
chainCmd,
|
chainCmd,
|
||||||
clientCmd,
|
clientCmd,
|
||||||
idCmd,
|
|
||||||
minerCmd,
|
minerCmd,
|
||||||
mpoolCmd,
|
mpoolCmd,
|
||||||
netCmd,
|
netCmd,
|
||||||
|
28
cli/id.go
28
cli/id.go
@ -1,28 +0,0 @@
|
|||||||
package cli
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"gopkg.in/urfave/cli.v2"
|
|
||||||
)
|
|
||||||
|
|
||||||
var idCmd = &cli.Command{
|
|
||||||
Name: "id",
|
|
||||||
Usage: "Get node identity",
|
|
||||||
Action: func(cctx *cli.Context) error {
|
|
||||||
api, err := getAPI(cctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx := reqContext(cctx)
|
|
||||||
|
|
||||||
pid, err := api.ID(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println(pid)
|
|
||||||
return nil
|
|
||||||
},
|
|
||||||
}
|
|
22
cli/net.go
22
cli/net.go
@ -19,6 +19,7 @@ var netCmd = &cli.Command{
|
|||||||
netPeers,
|
netPeers,
|
||||||
netConnect,
|
netConnect,
|
||||||
netListen,
|
netListen,
|
||||||
|
netId,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +96,27 @@ var netConnect = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var netId = &cli.Command{
|
||||||
|
Name: "id",
|
||||||
|
Usage: "Get node identity",
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
api, err := getAPI(cctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := reqContext(cctx)
|
||||||
|
|
||||||
|
pid, err := api.ID(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(pid)
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
// parseAddresses is a function that takes in a slice of string peer addresses
|
// parseAddresses is a function that takes in a slice of string peer addresses
|
||||||
// (multiaddr + peerid) and returns a slice of properly constructed peers
|
// (multiaddr + peerid) and returns a slice of properly constructed peers
|
||||||
func parseAddresses(ctx context.Context, addrs []string) ([]peer.AddrInfo, error) {
|
func parseAddresses(ctx context.Context, addrs []string) ([]peer.AddrInfo, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user