]> git.bitcoin.ninja Git - ldk-sample/commitdiff
Prompt user to provide at least 2 arguments rather than 3
authorFreddieKrugerrand <freddiekrugerrand@protonmail.com>
Wed, 1 Feb 2023 20:23:00 +0000 (15:23 -0500)
committerFreddieKrugerrand <freddiekrugerrand@protonmail.com>
Wed, 1 Feb 2023 20:24:25 +0000 (15:24 -0500)
env::args returns the name of the binary, which isn't something
the end user would think about. So while we require at least 3
arguments, it makes sense to only ask for 2.

src/args.rs

index a9d1729b3af75f9898a7e984c8403937ab5956df..b6ae379afb487452996b311e17b52b8e49e5f1dc 100644 (file)
@@ -10,7 +10,7 @@ use std::str::FromStr;
 
 pub(crate) fn parse_startup_args() -> Result<LdkUserInfo, ()> {
        if env::args().len() < 3 {
-               println!("ldk-tutorial-node requires 3 arguments: `cargo run [<bitcoind-rpc-username>:<bitcoind-rpc-password>@]<bitcoind-rpc-host>:<bitcoind-rpc-port> ldk_storage_directory_path [<ldk-incoming-peer-listening-port>] [bitcoin-network] [announced-node-name announced-listen-addr*]`");
+               println!("ldk-tutorial-node requires at least 2 arguments: `cargo run [<bitcoind-rpc-username>:<bitcoind-rpc-password>@]<bitcoind-rpc-host>:<bitcoind-rpc-port> ldk_storage_directory_path [<ldk-incoming-peer-listening-port>] [bitcoin-network] [announced-node-name announced-listen-addr*]`");
                return Err(());
        }
        let bitcoind_rpc_info = env::args().skip(1).next().unwrap();