cmd/lncli: make getnodeinfo accept positional arguments

This commit is contained in:
Olaoluwa Osuntokun 2017-04-13 11:55:17 -07:00
parent 17d6835861
commit 2cb6878568
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
1 changed files with 11 additions and 4 deletions

View File

@ -1306,12 +1306,20 @@ func getNodeInfo(ctx *cli.Context) error {
client, cleanUp := getClient(ctx)
defer cleanUp()
if !ctx.IsSet("pub_key") {
args := ctx.Args()
var pubKey string
switch {
case ctx.IsSet("pub_key"):
pubKey = ctx.String("pub_key")
case args.Present():
pubKey = args.First()
default:
return fmt.Errorf("pub_key argument missing")
}
req := &lnrpc.NodeInfoRequest{
PubKey: ctx.String("pub_key"),
PubKey: pubKey,
}
nodeInfo, err := client.GetNodeInfo(ctxb, req)
@ -1426,7 +1434,7 @@ var debugLevelCommand = cli.Command{
},
cli.StringFlag{
Name: "level",
Usage: "the level specification to target either a coarse logging level, or granular set of specific sub-systems with loggin levels for each",
Usage: "the level specification to target either a coarse logging level, or granular set of specific sub-systems with logging levels for each",
},
},
Action: debugLevel,
@ -1436,7 +1444,6 @@ func debugLevel(ctx *cli.Context) error {
ctxb := context.Background()
client, cleanUp := getClient(ctx)
defer cleanUp()
req := &lnrpc.DebugLevelRequest{
Show: ctx.Bool("show"),
LevelSpec: ctx.String("level"),