From e6f026e5304fa3e36fa007d7c1022003a7b87b90 Mon Sep 17 00:00:00 2001 From: Tadeas Moravec Date: Sat, 24 Nov 2018 10:43:34 +0000 Subject: Simplewallet: Unify usage messages. Help messages describe the commands usage. When users run the command with wrong arguments, it usually helpfully offers the usage, too. Unfortunately, these two usage messages were duplicated in the code and started to get out of sync. Fixing with constant strings. --- src/simplewallet/simplewallet.cpp | 374 +++++++++++++++++++++++--------------- 1 file changed, 230 insertions(+), 144 deletions(-) (limited to 'src/simplewallet/simplewallet.cpp') diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 281702774..a8cc81869 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -111,6 +111,8 @@ typedef cryptonote::simple_wallet sw; #define SCOPED_WALLET_UNLOCK() SCOPED_WALLET_UNLOCK_ON_BAD_PASSWORD(return true;) +#define PRINT_USAGE(usage_help) fail_msg_writer() << boost::format(tr("usage: %s")) % usage_help; + enum TransferType { Transfer, TransferLocked, @@ -141,6 +143,93 @@ namespace const command_line::arg_descriptor< std::vector > arg_command = {"command", ""}; + const char* USAGE_START_MINING("start_mining [] [bg_mining] [ignore_battery]"); + const char* USAGE_SET_DAEMON("set_daemon [:] [trusted|untrusted]"); + const char* USAGE_SHOW_BALANCE("balance [detail]"); + const char* USAGE_INCOMING_TRANSFERS("incoming_transfers [available|unavailable] [verbose] [index=[,[,...]]]"); + const char* USAGE_PAYMENTS("payments [ ... ]"); + const char* USAGE_PAYMENT_ID("payment_id"); + const char* USAGE_TRANSFER("transfer [index=[,,...]] [] [] ( |
) []"); + const char* USAGE_LOCKED_TRANSFER("locked_transfer [index=[,,...]] [] [] ( | ) []"); + const char* USAGE_LOCKED_SWEEP_ALL("locked_sweep_all [index=[,,...]] [] []
[]"); + const char* USAGE_SWEEP_ALL("sweep_all [index=[,,...]] [] [] [outputs=]
[]"); + const char* USAGE_SWEEP_BELOW("sweep_below [index=[,,...]] [] []
[]"); + const char* USAGE_SWEEP_SINGLE("sweep_single [] [] [outputs=]
[]"); + const char* USAGE_DONATE("donate [index=[,,...]] [] [] []"); + const char* USAGE_SIGN_TRANSFER("sign_transfer [export_raw]"); + const char* USAGE_SET_LOG("set_log |{+,-,}"); + const char* USAGE_ACCOUNT("account\n" + " account new