diff options
| author | Pavel Janík <[email protected]> | 2014-11-22 19:56:25 +0100 |
|---|---|---|
| committer | Pavel Janík <[email protected]> | 2014-11-22 20:46:11 +0100 |
| commit | 3d0a1ce193a7f94862027de6df24cad7ce659256 (patch) | |
| tree | e60486e11e9fae20c140a1b6169adf8b03ca17b9 /src/bitcoin-cli.cpp | |
| parent | Merge pull request #4727 (diff) | |
| download | discoin-3d0a1ce193a7f94862027de6df24cad7ce659256.tar.xz discoin-3d0a1ce193a7f94862027de6df24cad7ce659256.zip | |
Process help and version arguments before datadir.
Diffstat (limited to 'src/bitcoin-cli.cpp')
| -rw-r--r-- | src/bitcoin-cli.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index a2b95d508..1b638e99e 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -66,6 +66,20 @@ static bool AppInitRPC(int argc, char* argv[]) // Parameters // ParseParameters(argc, argv); + if (argc<2 || mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version")) { + std::string strUsage = _("Bitcoin Core RPC client version") + " " + FormatFullVersion() + "\n"; + if (!mapArgs.count("-version")) { + strUsage += "\n" + _("Usage:") + "\n" + + " bitcoin-cli [options] <command> [params] " + _("Send command to Bitcoin Core") + "\n" + + " bitcoin-cli [options] help " + _("List commands") + "\n" + + " bitcoin-cli [options] help <command> " + _("Get help for a command") + "\n"; + + strUsage += "\n" + HelpMessageCli(); + } + + fprintf(stdout, "%s", strUsage.c_str()); + return false; + } if (!boost::filesystem::is_directory(GetDataDir(false))) { fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str()); return false; @@ -81,20 +95,6 @@ static bool AppInitRPC(int argc, char* argv[]) fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n"); return false; } - if (argc<2 || mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version")) { - std::string strUsage = _("Bitcoin Core RPC client version") + " " + FormatFullVersion() + "\n"; - if (!mapArgs.count("-version")) { - strUsage += "\n" + _("Usage:") + "\n" + - " bitcoin-cli [options] <command> [params] " + _("Send command to Bitcoin Core") + "\n" + - " bitcoin-cli [options] help " + _("List commands") + "\n" + - " bitcoin-cli [options] help <command> " + _("Get help for a command") + "\n"; - - strUsage += "\n" + HelpMessageCli(); - } - - fprintf(stdout, "%s", strUsage.c_str()); - return false; - } return true; } |