aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2018-06-27 20:33:26 +0900
committerstoffu <stoffu@protonmail.ch>2018-06-27 22:54:10 +0900
commit13851b28c72f7b0399be2558424ded721b1e714d (patch)
treeb883c46e55aa695b027edcb7302e438e61f88e58 /src
parentMerge pull request #3784 (diff)
downloadmonero-13851b28c72f7b0399be2558424ded721b1e714d.tar.xz
simplewallet.sweep_all: show usage when parsing fails
Diffstat (limited to 'src')
-rw-r--r--src/simplewallet/simplewallet.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 90c3da6ca..2918313d5 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -4964,10 +4964,14 @@ bool simple_wallet::sweep_unmixable(const std::vector<std::string> &args_)
//----------------------------------------------------------------------------------------------------
bool simple_wallet::sweep_main(uint64_t below, const std::vector<std::string> &args_)
{
- // sweep_all [index=<N1>[,<N2>,...]] [<ring_size>] <address> [<payment_id>]
+ auto print_usage = [below]()
+ {
+ fail_msg_writer() << boost::format(tr("usage: %s [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] <address> [<payment_id>]")) % (below ? "sweep_below" : "sweep_all");
+ };
if (args_.size() == 0)
{
fail_msg_writer() << tr("No address given");
+ print_usage();
return true;
}
@@ -4981,7 +4985,10 @@ bool simple_wallet::sweep_main(uint64_t below, const std::vector<std::string> &a
if (local_args.size() > 0 && local_args[0].substr(0, 6) == "index=")
{
if (!parse_subaddress_indices(local_args[0], subaddr_indices))
+ {
+ print_usage();
return true;
+ }
local_args.erase(local_args.begin());
}
@@ -5049,6 +5056,7 @@ bool simple_wallet::sweep_main(uint64_t below, const std::vector<std::string> &a
if(!r && local_args.size() == 3)
{
fail_msg_writer() << tr("payment id has invalid format, expected 16 or 64 character hex string: ") << payment_id_str;
+ print_usage();
return true;
}
if (payment_id_seen)
@@ -5059,6 +5067,7 @@ bool simple_wallet::sweep_main(uint64_t below, const std::vector<std::string> &a
if (!cryptonote::get_account_address_from_str_or_url(info, m_wallet->nettype(), local_args[0], oa_prompter))
{
fail_msg_writer() << tr("failed to parse address");
+ print_usage();
return true;
}