mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-11 22:57:59 +01:00
cmd/lncli: add key word argument support for new disconnect cmd
This commit is contained in:
@@ -254,6 +254,13 @@ var disconnectCommand = cli.Command{
|
|||||||
Name: "disconnect",
|
Name: "disconnect",
|
||||||
Usage: "disconnect a remote lnd peer identified by public key",
|
Usage: "disconnect a remote lnd peer identified by public key",
|
||||||
ArgsUsage: "<pubkey>",
|
ArgsUsage: "<pubkey>",
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "node_key",
|
||||||
|
Usage: "The hex-encoded compressed public key of the peer " +
|
||||||
|
"to disconnect from",
|
||||||
|
},
|
||||||
|
},
|
||||||
Action: disconnectPeer,
|
Action: disconnectPeer,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,9 +269,14 @@ func disconnectPeer(ctx *cli.Context) error {
|
|||||||
client, cleanUp := getClient(ctx)
|
client, cleanUp := getClient(ctx)
|
||||||
defer cleanUp()
|
defer cleanUp()
|
||||||
|
|
||||||
pubKey := ctx.Args().First()
|
var pubKey string
|
||||||
if pubKey == "" {
|
switch {
|
||||||
return fmt.Errorf("target address expected in format: <pubkey>")
|
case ctx.IsSet("node_key"):
|
||||||
|
pubKey = ctx.String("node_key")
|
||||||
|
case ctx.Args().Present():
|
||||||
|
pubKey = ctx.Args().First()
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("must specify target public key")
|
||||||
}
|
}
|
||||||
|
|
||||||
req := &lnrpc.DisconnectPeerRequest{
|
req := &lnrpc.DisconnectPeerRequest{
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ func main() {
|
|||||||
sendManyCommand,
|
sendManyCommand,
|
||||||
sendCoinsCommand,
|
sendCoinsCommand,
|
||||||
connectCommand,
|
connectCommand,
|
||||||
|
disconnectCommand,
|
||||||
openChannelCommand,
|
openChannelCommand,
|
||||||
closeChannelCommand,
|
closeChannelCommand,
|
||||||
listPeersCommand,
|
listPeersCommand,
|
||||||
@@ -78,7 +79,6 @@ func main() {
|
|||||||
debugLevelCommand,
|
debugLevelCommand,
|
||||||
decodePayReqComamnd,
|
decodePayReqComamnd,
|
||||||
listChainTxnsCommand,
|
listChainTxnsCommand,
|
||||||
disconnectCommand,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user