Skip to content

Commit

Permalink
cmd/lncli: make getnodeinfo accept positional arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Roasbeef committed Apr 13, 2017
1 parent 17d6835 commit 2cb6878
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cmd/lncli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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"),
Expand Down

0 comments on commit 2cb6878

Please sign in to comment.