From 2cb6878568f1d3c61be07347317be648aac8b811 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 13 Apr 2017 11:55:17 -0700 Subject: [PATCH] cmd/lncli: make getnodeinfo accept positional arguments --- cmd/lncli/commands.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index 0277d1e0..a246599f 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -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"),