1388 {
1391 list_producers->add_option(
"-l,--limit", limit,
localized(
"The maximum number of rows to return"));
1392 list_producers->add_option(
"-L,--lower",
lower,
localized(
"Lower bound value of key, defaults to first"));
1393 list_producers->callback([this] {
1395 (
"json",
true)(
"lower_bound",
lower)(
"limit", limit));
1398 return;
1399 }
1401 if ( result.rows.empty() ) {
1402 std::cout << "No producers found" << std::endl;
1403 return;
1404 }
1405 auto weight = result.total_producer_vote_weight;
1406 if ( !weight )
1407 weight = 1;
1408 printf(
"%-13s %-57s %-59s %s\n",
"Producer",
"Producer key",
"Url",
"Scaled votes");
1409 for ( auto& row : result.rows )
1410 printf(
"%-13.13s %-57.57s %-59.59s %1.4f\n",
1411 row["owner"].as_string().c_str(),
1412 row["producer_key"].as_string().c_str(),
1414 row["total_votes"].as_double() / weight);
1415 if ( !result.more.empty() )
1416 std::cout <<
"-L " <<
clean_output( result.more ) <<
" for more" << std::endl;
1417 });
1418 }
Option * add_flag(std::string flag_name)
Add a flag with no description or variable assignment.
App * add_subcommand(std::string subcommand_name="", std::string subcommand_description="")
Add a subcommand. Inherits INHERITABLE and OptionDefaults, and help flag.
static string to_pretty_string(const variant &v, const yield_function_t &yield, const output_formatting format=output_formatting::stringify_large_ints_and_doubles)
An order-preserving dictionary of variants.
#define localized(str,...)
LOGGING_API void printf(Category category, const char *format,...)
const string get_producers_func
std::string clean_output(std::string str)
fc::variant call(const std::string &url, const std::string &path, const T &v)