add an id command
This commit is contained in:
parent
13e217987b
commit
57df9fdd9e
@ -59,12 +59,13 @@ func reqContext(cctx *cli.Context) context.Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var Commands = []*cli.Command{
|
var Commands = []*cli.Command{
|
||||||
clientCmd,
|
|
||||||
chainCmd,
|
chainCmd,
|
||||||
|
clientCmd,
|
||||||
|
idCmd,
|
||||||
|
minerCmd,
|
||||||
|
mpoolCmd,
|
||||||
netCmd,
|
netCmd,
|
||||||
versionCmd,
|
versionCmd,
|
||||||
mpoolCmd,
|
|
||||||
minerCmd,
|
|
||||||
walletCmd,
|
walletCmd,
|
||||||
createMinerCmd,
|
createMinerCmd,
|
||||||
}
|
}
|
||||||
|
28
cli/id.go
Normal file
28
cli/id.go
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
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
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user