Repository: lightningnetwork/lnd (language: go)

Issue:
[bug]: lncli create is not honoring its documentation
### Background

`lncli create` is not honoring its documentation which says the following:

```
 embed/lnd/lncli --lnddir=lnd/ create --help
NAME:
   lncli create - Initialize a wallet when starting lnd for the first time.

USAGE:
   lncli create [command options] [arguments...]

CATEGORY:
   Startup

DESCRIPTION:

  The create command is used to initialize an lnd wallet from scratch for
  the very first time. This is interactive command with one required
  argument (the password), and one optional argument (the mnemonic
  passphrase).

  The first argument (the password) is required and MUST be greater than
  8 characters. This will be used to encrypt the wallet within lnd. This
  MUST be remembered as it will be required to fully start up the daemon.

  The second argument is an optional 24-word mnemonic derived from BIP
  39. If provided, then the internal wallet will use the seed derived
  from this mnemonic to generate all keys.

  This command returns a 24-word seed in the scenario that NO mnemonic
  was provided by the user. This should be written down as it can be used
  to potentially recover all on-chain funds, and most off-chain funds as
  well.

  If the --stateless_init flag is set, no macaroon files are created by
  the daemon. Instead, the binary serialized admin macaroon is returned
  in the answer. This answer MUST be stored somewhere, otherwise all
  access to the RPC server will be lost and the wallet must be recreated
  to re-gain access.
  If the --save_to parameter is set, the macaroon is saved to this file,
  otherwise it is printed to standard out.

  Finally, it's also possible to use this command and a set of static
  channel backups to trigger a recover attempt for the provided Static
  Channel Backups. Only one of the three parameters will be accepted. See
  the restorechanbackup command for further details w.r.t the format
  accepted.


OPTIONS:
   --single_backup value  a hex encoded single channel backup obtained from exportchanbackup
   --multi_backup value   a hex encoded multi-channel backup obtained from exportchanbackup
   --multi_file value     the path to a multi-channel back up file
   --stateless_init       do not create any macaroon files in the file system of the daemon
   --save_to value        save returned admin macaroon to this file
```

When I do the following command I obtain the following:

```
embed/lnd/lncli --lnddir=lnd/ create 34423423jjjjjkasdfsa
Input wallet password:
Confirm password:

Do you have an existing cipher seed mnemonic or extended master root key you want to use?
Enter 'y' to use an existing cipher seed mnemonic, 'x' to use an extended master root key
or 'n' to create a new seed (Enter y/x/n): n

Your cipher seed can optionally be encrypted.
Input your passphrase if you wish to encrypt it (or press enter to proceed without a cipher seed passphrase):

Generating fresh cipher seed...

[lncli] unable to generate seed: rpc error: code = Unavailable desc = connection error: desc = "transport: authentication handshake failed: tls: failed to verify certificate: x509: certificate signed by unknown authority (possibly because of \"x509: ECDSA verification failure\" while trying to verify candidate authority certificate \"mac-2.local\")"
```

Now, if you read carefully, it says that the fist argument is the password, and the second argument is optional.
But what I get is an interactive form asking for a password, that I already provided in the first argument, and it is also asking for a seed, which is optional according to the documentation.
And not only I am not obtaining the 24 words, but in fact I am returned an error.

This makes programatically configurations imposible. I have to attach a stdin and gess what `lncli`is going to ask, which is not optimal. I truly want the process to be fully automatic and be gifted with the 24 words, as the documentation promises.

### Your environment

* version of `lnd` 0.18.1b
* which operating system Darwin
* version of `btcd`, `bitcoind`, or other backend NEUTRINO
* any other relevant environment details




Discussion / hints:
Yeah, I see how the documentation is a bit weird here. So the `[arguments...]` part comes from the CLI library that generates the help text and is there for every command. But there are no command line arguments for the `create` command, only interactive queries.
So the text should say something like:

```
... This is interactive command with one required
  input prompt (the password), and one optional input (the mnemonic
  passphrase).
```

If you want to create a wallet programmatically, I suggest looking into [`lndinit`](https://github.com/lightninglabs/lndinit) which was created for that exact purpose.
I would like to work on this issue! Can I take it?

Fix patch:
diff --git a/cmd/commands/cmd_walletunlocker.go b/cmd/commands/cmd_walletunlocker.go
index 844b48f3d6..a0a286047b 100644
--- a/cmd/commands/cmd_walletunlocker.go
+++ b/cmd/commands/cmd_walletunlocker.go
@@ -34,17 +34,16 @@ var createCommand = cli.Command{
 	Usage:    "Initialize a wallet when starting lnd for the first time.",
 	Description: `
 	The create command is used to initialize an lnd wallet from scratch for
-	the very first time. This is interactive command with one required
-	argument (the password), and one optional argument (the mnemonic
-	passphrase).
+	the very first time. This is an interactive command with one required
+	input (the password), and one optional input (the mnemonic passphrase).
 
-	The first argument (the password) is required and MUST be greater than
-	8 characters. This will be used to encrypt the wallet within lnd. This
+	The first input (the password) is required and MUST be greater than 8
+	characters. This will be used to encrypt the wallet within lnd. This
 	MUST be remembered as it will be required to fully start up the daemon.
 
-	The second argument is an optional 24-word mnemonic derived from BIP
-	39. If provided, then the internal wallet will use the seed derived
-	from this mnemonic to generate all keys.
+	The second input is an optional 24-word mnemonic derived from BIP 39.
+	If provided, then the internal wallet will use the seed derived from
+	this mnemonic to generate all keys.
 
 	This command returns a 24-word seed in the scenario that NO mnemonic
 	was provided by the user. This should be written down as it can be used
diff --git a/docs/release-notes/release-notes-0.19.0.md b/docs/release-notes/release-notes-0.19.0.md
index 869e235115..919d25aa49 100644
--- a/docs/release-notes/release-notes-0.19.0.md
+++ b/docs/release-notes/release-notes-0.19.0.md
@@ -55,7 +55,12 @@
 
 ## Tooling and Documentation
 
+* [Improved `lncli create` command help text](https://github.com/lightningnetwork/lnd/pull/9077)
+  by replacing the word `argument` with `input` in the command description,
+  clarifying that the command requires interactive inputs rather than arguments.
+
 # Contributors (Alphabetical Order)
 
+* CharlieZKSmith
 * Pins
 * Ziggie


Test patch: