This repository has been archived by the owner on Apr 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 296
Cache CLI input values #1496
Merged
l4l
merged 10 commits into
hyperledger-iroha:develop
from
uatuko:feature/cache-cli-input-params
Jun 26, 2018
Merged
Cache CLI input values #1496
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8f2e121
(iroha-cli) cache input params
uatuko 897cfe9
(iroha-cli) fix refs for input params
uatuko 0c2eaf3
(iroha-cli) cleanup
uatuko af57b48
(iroha-cli) add missing headers
uatuko bd6c989
(iroha-cli) PR review changes
uatuko 6b28bbd
clang-format
uatuko 634fa81
(iroha-cli) drop shared_ptr usage
uatuko 2856e9c
(iroha-cli) PR review changes (monadic bind operator)
uatuko df53fcd
(iroha-cli) doc comments
uatuko 047f633
(iroha-cli) cleanup
uatuko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,23 +58,24 @@ namespace iroha_cli { | |
const auto role_id = "Requested role name"; | ||
const auto tx_hashes = "Requested tx hashes"; | ||
|
||
query_params_descriptions_ = { | ||
{GET_ACC, {acc_id}}, | ||
{GET_ACC_AST, {acc_id, ast_id}}, | ||
{GET_ACC_AST_TX, {acc_id, ast_id}}, | ||
{GET_ACC_TX, {acc_id}}, | ||
{GET_TX, {tx_hashes}}, | ||
{GET_ACC_SIGN, {acc_id}}, | ||
{GET_ROLES, {}}, | ||
{GET_AST_INFO, {ast_id}}, | ||
{GET_ROLE_PERM, {role_id}} | ||
// query_params_descriptions_ | ||
query_params_map_ = { | ||
{GET_ACC, makeParamsDescription({acc_id})}, | ||
{GET_ACC_AST, makeParamsDescription({acc_id, ast_id})}, | ||
{GET_ACC_AST_TX, makeParamsDescription({acc_id, ast_id})}, | ||
{GET_ACC_TX, makeParamsDescription({acc_id})}, | ||
{GET_TX, makeParamsDescription({tx_hashes})}, | ||
{GET_ACC_SIGN, makeParamsDescription({acc_id})}, | ||
{GET_ROLES, makeParamsDescription({})}, | ||
{GET_AST_INFO, makeParamsDescription({ast_id})}, | ||
{GET_ROLE_PERM, makeParamsDescription({role_id})} | ||
// query_params_map_ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think it can be removed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please clarify, not sure what you meant here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean the line with a comment. But you don't really have to remove it since the PR is about different things There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, this comment is needed for better formatting |
||
}; | ||
|
||
query_handlers_ = { | ||
{GET_ACC, &InteractiveQueryCli::parseGetAccount}, | ||
{GET_ACC_AST, &InteractiveQueryCli::parseGetAccountAssets}, | ||
{GET_ACC_AST_TX, &InteractiveQueryCli::parseGetAccountAssetTransactions}, | ||
{GET_ACC_AST_TX, | ||
&InteractiveQueryCli::parseGetAccountAssetTransactions}, | ||
{GET_ACC_TX, &InteractiveQueryCli::parseGetAccountTransactions}, | ||
{GET_TX, &InteractiveQueryCli::parseGetTransactions}, | ||
{GET_ACC_SIGN, &InteractiveQueryCli::parseGetSignatories}, | ||
|
@@ -84,21 +85,19 @@ namespace iroha_cli { | |
// query_handlers_ | ||
}; | ||
|
||
menu_points_ = formMenu( | ||
query_handlers_, query_params_descriptions_, description_map_); | ||
menu_points_ = | ||
formMenu(query_handlers_, query_params_map_, description_map_); | ||
// Add "go back" option | ||
addBackOption(menu_points_); | ||
} | ||
|
||
void InteractiveQueryCli::create_result_menu() { | ||
result_handlers_ = {{SAVE_CODE, &InteractiveQueryCli::parseSaveFile}, | ||
{SEND_CODE, &InteractiveQueryCli::parseSendToIroha}}; | ||
result_params_descriptions_ = | ||
getCommonParamsMap(default_peer_ip_, default_port_); | ||
result_params_map_ = getCommonParamsMap(default_peer_ip_, default_port_); | ||
|
||
result_points_ = formMenu(result_handlers_, | ||
result_params_descriptions_, | ||
getCommonDescriptionMap()); | ||
result_points_ = formMenu( | ||
result_handlers_, result_params_map_, getCommonDescriptionMap()); | ||
addBackOption(result_points_); | ||
} | ||
|
||
|
@@ -159,7 +158,7 @@ namespace iroha_cli { | |
} | ||
|
||
auto res = handleParse<std::shared_ptr<iroha::model::Query>>( | ||
this, line, query_handlers_, query_params_descriptions_); | ||
this, line, query_handlers_, query_params_map_); | ||
if (not res) { | ||
// Continue parsing | ||
return true; | ||
|
@@ -259,8 +258,8 @@ namespace iroha_cli { | |
return true; | ||
} | ||
|
||
auto res = handleParse<bool>( | ||
this, line, result_handlers_, result_params_descriptions_); | ||
auto res = | ||
handleParse<bool>(this, line, result_handlers_, result_params_map_); | ||
|
||
return res.get_value_or(true); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it should be
const ParamsMap &
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually not, it is intentional it to be not
const ParamsMap &
since it gets updated with user input values.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Missed that