@@ -706,6 +706,57 @@ namespace
706706 return description;
707707 }
708708
709+ std::string get_transfer_usage (bool legacy_ring_ux)
710+ {
711+ if (legacy_ring_ux)
712+ return tr (" transfer [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] (<URI> | <address> <amount>) [subtractfeefrom=<D0>[,<D1>,all,...]] [<payment_id>]" );
713+ return tr (" transfer [index=<N1>[,<N2>,...]] [<priority>] (<URI> | <address> <amount>) [subtractfeefrom=<D0>[,<D1>,all,...]] [<payment_id>]" );
714+ }
715+
716+ std::string get_sweep_all_usage (bool legacy_ring_ux)
717+ {
718+ if (legacy_ring_ux)
719+ return tr (" sweep_all [index=<N1>[,<N2>,...] | index=all] [<priority>] [<ring_size>] [outputs=<N>] <address> [<payment_id (obsolete)>]" );
720+ return tr (" sweep_all [index=<N1>[,<N2>,...] | index=all] [<priority>] [outputs=<N>] <address> [<payment_id (obsolete)>]" );
721+ }
722+
723+ std::string get_sweep_account_usage (bool legacy_ring_ux)
724+ {
725+ if (legacy_ring_ux)
726+ return tr (" sweep_account <account> [index=<N1>[,<N2>,...] | index=all] [<priority>] [<ring_size>] [outputs=<N>] <address> [<payment_id (obsolete)>]" );
727+ return tr (" sweep_account <account> [index=<N1>[,<N2>,...] | index=all] [<priority>] [outputs=<N>] <address> [<payment_id (obsolete)>]" );
728+ }
729+
730+ std::string get_sweep_below_usage (bool legacy_ring_ux)
731+ {
732+ if (legacy_ring_ux)
733+ return tr (" sweep_below <amount_threshold> [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] <address> [<payment_id (obsolete)>]" );
734+ return tr (" sweep_below <amount_threshold> [index=<N1>[,<N2>,...]] [<priority>] <address> [<payment_id (obsolete)>]" );
735+ }
736+
737+ std::string get_sweep_single_usage (bool legacy_ring_ux)
738+ {
739+ if (legacy_ring_ux)
740+ return tr (" sweep_single [<priority>] [<ring_size>] [outputs=<N>] <key_image> <address> [<payment_id (obsolete)>]" );
741+ return tr (" sweep_single [<priority>] [outputs=<N>] <key_image> <address> [<payment_id (obsolete)>]" );
742+ }
743+
744+ std::string get_donate_usage (bool legacy_ring_ux)
745+ {
746+ if (legacy_ring_ux)
747+ return tr (" donate [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] <amount> [<payment_id (obsolete)>]" );
748+ return tr (" donate [index=<N1>[,<N2>,...]] [<priority>] <amount> [<payment_id (obsolete)>]" );
749+ }
750+
751+ std::string get_transfer_description (bool legacy_ring_ux)
752+ {
753+ std::string desc = tr (" Transfer <amount> <address>. If the parameter \" index=<N1>[,<N2>,...]\" is specified, the wallet uses outputs received by addresses of those indices. If omitted, the wallet randomly chooses address indices to be used. In any case, it tries its best not to combine outputs across multiple addresses. <priority> is the priority of the transaction. The higher the priority, the higher the transaction fee. Valid values in priority order (from lowest to highest) are: unimportant, normal, elevated, priority, max. If omitted, the default value (see the command \" set priority\" ) is used. " );
754+ if (legacy_ring_ux)
755+ desc += tr (" <ring_size> is the number of inputs to include for untraceability. " );
756+ desc += tr (" Multiple payments can be made at once by adding URI_2 or <address_2> <amount_2> etcetera (before the payment ID, if it's included). The \" subtractfeefrom=\" list allows you to choose which destinations to fund the tx fee from instead of the change output. The fee will be split across the chosen destinations proportionally equally. For example, to make 3 transfers where the fee is taken from the first and third destinations, one could do: \" transfer <addr1> 3 <addr2> 0.5 <addr3> 1 subtractfeefrom=0,2\" . Let's say the tx fee is 0.1. The balance would drop by exactly 4.5 XMR including fees, and addr1 & addr3 would receive 2.925 & 0.975 XMR, respectively. Use \" subtractfeefrom=all\" to spread the fee across all destinations." );
757+ return desc;
758+ }
759+
709760 bool get_fake_outs_count (const std::unique_ptr<tools::wallet2> &w2, std::vector<std::string> &local_args, size_t &fake_outs_count)
710761 {
711762 const size_t min_ring_size = w2->get_min_ring_size ();
@@ -926,10 +977,14 @@ std::string simple_wallet::get_commands_str()
926977{
927978 std::stringstream ss;
928979 ss << tr (" Commands: " ) << ENDL ;
929- std::string usage = m_cmd_binder.get_usage ();
930- boost::replace_all (usage, " \n " , " \n " );
931- usage.insert (0 , " " );
932- ss << usage << ENDL ;
980+ const std::vector<std::string> all_commands = m_cmd_binder.get_command_list ();
981+ for (const auto &command : all_commands)
982+ {
983+ const std::vector<std::string> cmd{command};
984+ const auto documentation = get_command_documentation (cmd);
985+ if (!documentation.first .empty ())
986+ ss << " " << documentation.first << ENDL ;
987+ }
933988 return ss.str ();
934989}
935990
@@ -939,8 +994,27 @@ std::pair<std::string, std::string> simple_wallet::get_command_documentation(con
939994 if (documentation.first .empty ())
940995 return documentation;
941996
942- if (args.size () == 1 && args.front () == " set" && !uses_legacy_ring_signature_ux (m_wallet.get ()))
943- documentation.second = get_set_variable_description (false );
997+ if (args.size () == 1 && !uses_legacy_ring_signature_ux (m_wallet.get ()))
998+ {
999+ const std::string &cmd = args.front ();
1000+ if (cmd == " set" )
1001+ documentation.second = get_set_variable_description (false );
1002+ else if (cmd == " transfer" )
1003+ {
1004+ documentation.first = get_transfer_usage (false );
1005+ documentation.second = get_transfer_description (false );
1006+ }
1007+ else if (cmd == " sweep_all" )
1008+ documentation.first = get_sweep_all_usage (false );
1009+ else if (cmd == " sweep_account" )
1010+ documentation.first = get_sweep_account_usage (false );
1011+ else if (cmd == " sweep_below" )
1012+ documentation.first = get_sweep_below_usage (false );
1013+ else if (cmd == " sweep_single" )
1014+ documentation.first = get_sweep_single_usage (false );
1015+ else if (cmd == " donate" )
1016+ documentation.first = get_donate_usage (false );
1017+ }
9441018
9451019 return documentation;
9461020}
@@ -6919,7 +6993,7 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
69196993 CHECK_IF_BACKGROUND_SYNCING (" cannot transfer" );
69206994 if (args_.size () < 1 )
69216995 {
6922- PRINT_USAGE (USAGE_TRANSFER );
6996+ PRINT_USAGE (get_transfer_usage ( uses_legacy_ring_signature_ux (m_wallet. get ())). c_str () );
69236997 return true ;
69246998 }
69256999 transfer_main (args_, false );
@@ -7042,17 +7116,18 @@ bool simple_wallet::sweep_main(uint32_t account, uint64_t below, const std::vect
70427116 CHECK_IF_BACKGROUND_SYNCING (" cannot sweep" );
70437117 auto print_usage = [this , account, below]()
70447118 {
7119+ const bool legacy_ring_ux = uses_legacy_ring_signature_ux (m_wallet.get ());
70457120 if (below)
70467121 {
7047- PRINT_USAGE (USAGE_SWEEP_BELOW );
7122+ PRINT_USAGE (get_sweep_below_usage (legacy_ring_ux). c_str () );
70487123 }
70497124 else if (account == m_current_subaddress_account)
70507125 {
7051- PRINT_USAGE (USAGE_SWEEP_ALL );
7126+ PRINT_USAGE (get_sweep_all_usage (legacy_ring_ux). c_str () );
70527127 }
70537128 else
70547129 {
7055- PRINT_USAGE (USAGE_SWEEP_ACCOUNT );
7130+ PRINT_USAGE (get_sweep_account_usage (legacy_ring_ux). c_str () );
70567131 }
70577132 };
70587133 if (args_.size () == 0 )
@@ -7359,7 +7434,7 @@ bool simple_wallet::sweep_single(const std::vector<std::string> &args_)
73597434
73607435 if (local_args.size () != 2 )
73617436 {
7362- PRINT_USAGE (USAGE_SWEEP_SINGLE );
7437+ PRINT_USAGE (get_sweep_single_usage ( uses_legacy_ring_signature_ux (m_wallet. get ())). c_str () );
73637438 return true ;
73647439 }
73657440
@@ -7519,7 +7594,7 @@ bool simple_wallet::sweep_account(const std::vector<std::string> &args_)
75197594 auto local_args = args_;
75207595 if (local_args.empty ())
75217596 {
7522- PRINT_USAGE (USAGE_SWEEP_ACCOUNT );
7597+ PRINT_USAGE (get_sweep_account_usage ( uses_legacy_ring_signature_ux (m_wallet. get ())). c_str () );
75237598 return true ;
75247599 }
75257600 uint32_t account = 0 ;
@@ -7541,7 +7616,7 @@ bool simple_wallet::sweep_below(const std::vector<std::string> &args_)
75417616 if (args_.size () < 1 )
75427617 {
75437618 fail_msg_writer () << tr (" missing threshold amount" );
7544- PRINT_USAGE (USAGE_SWEEP_BELOW );
7619+ PRINT_USAGE (get_sweep_below_usage ( uses_legacy_ring_signature_ux (m_wallet. get ())). c_str () );
75457620 return true ;
75467621 }
75477622 if (!cryptonote::parse_amount (below, args_[0 ]))
@@ -7559,7 +7634,7 @@ bool simple_wallet::donate(const std::vector<std::string> &args_)
75597634 std::vector<std::string> local_args = args_;
75607635 if (local_args.empty () || local_args.size () > 5 )
75617636 {
7562- PRINT_USAGE (USAGE_DONATE );
7637+ PRINT_USAGE (get_donate_usage ( uses_legacy_ring_signature_ux (m_wallet. get ())). c_str () );
75637638 return true ;
75647639 }
75657640 std::string amount_str;
0 commit comments