cmd/lncli: make getnodeinfo accept positional arguments
This commit is contained in:
parent
17d6835861
commit
2cb6878568
@ -1306,12 +1306,20 @@ func getNodeInfo(ctx *cli.Context) error {
|
|||||||
client, cleanUp := getClient(ctx)
|
client, cleanUp := getClient(ctx)
|
||||||
defer cleanUp()
|
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")
|
return fmt.Errorf("pub_key argument missing")
|
||||||
}
|
}
|
||||||
|
|
||||||
req := &lnrpc.NodeInfoRequest{
|
req := &lnrpc.NodeInfoRequest{
|
||||||
PubKey: ctx.String("pub_key"),
|
PubKey: pubKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeInfo, err := client.GetNodeInfo(ctxb, req)
|
nodeInfo, err := client.GetNodeInfo(ctxb, req)
|
||||||
@ -1426,7 +1434,7 @@ var debugLevelCommand = cli.Command{
|
|||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "level",
|
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,
|
Action: debugLevel,
|
||||||
@ -1436,7 +1444,6 @@ func debugLevel(ctx *cli.Context) error {
|
|||||||
ctxb := context.Background()
|
ctxb := context.Background()
|
||||||
client, cleanUp := getClient(ctx)
|
client, cleanUp := getClient(ctx)
|
||||||
defer cleanUp()
|
defer cleanUp()
|
||||||
|
|
||||||
req := &lnrpc.DebugLevelRequest{
|
req := &lnrpc.DebugLevelRequest{
|
||||||
Show: ctx.Bool("show"),
|
Show: ctx.Bool("show"),
|
||||||
LevelSpec: ctx.String("level"),
|
LevelSpec: ctx.String("level"),
|
||||||
|
Loading…
Reference in New Issue
Block a user