aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/command_parser_executor.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-11-06 01:54:48 +0200
committerRiccardo Spagni <ric@spagni.net>2017-11-06 01:54:48 +0200
commit7452359d8fce7dab6a91c4fa630f62be6153cdc9 (patch)
tree24ed9cfbfde909c6c3a7c9ec51936e0f07125bbe /src/daemon/command_parser_executor.cpp
parentMerge pull request #2546 (diff)
parentFix #2559: more flexible print_tx daemon command (diff)
downloadmonero-7452359d8fce7dab6a91c4fa630f62be6153cdc9.tar.xz
Merge pull request #2591
93ad1f87 Fix #2559: more flexible print_tx daemon command (binaryFate)
Diffstat (limited to 'src/daemon/command_parser_executor.cpp')
-rw-r--r--src/daemon/command_parser_executor.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp
index c85e5edb5..5307b2472 100644
--- a/src/daemon/command_parser_executor.cpp
+++ b/src/daemon/command_parser_executor.cpp
@@ -187,9 +187,24 @@ bool t_command_parser_executor::print_block(const std::vector<std::string>& args
bool t_command_parser_executor::print_transaction(const std::vector<std::string>& args)
{
+ bool include_hex = false;
+ bool include_json = false;
+
+ // Assumes that optional flags come after mandatory argument <transaction_hash>
+ for (unsigned int i = 1; i < args.size(); ++i) {
+ if (args[i] == "+hex")
+ include_hex = true;
+ else if (args[i] == "+json")
+ include_json = true;
+ else
+ {
+ std::cout << "unexpected argument: " << args[i] << std::endl;
+ return true;
+ }
+ }
if (args.empty())
{
- std::cout << "expected: print_tx <transaction hash>" << std::endl;
+ std::cout << "expected: print_tx <transaction_hash> [+hex] [+json]" << std::endl;
return true;
}
@@ -197,7 +212,7 @@ bool t_command_parser_executor::print_transaction(const std::vector<std::string>
crypto::hash tx_hash;
if (parse_hash256(str_hash, tx_hash))
{
- m_executor.print_transaction(tx_hash);
+ m_executor.print_transaction(tx_hash, include_hex, include_json);
}
return true;