empiredan commented on code in PR #914:
URL: https://github.com/apache/incubator-pegasus/pull/914#discussion_r890790308


##########
src/shell/commands/table_management.cpp:
##########
@@ -886,3 +888,105 @@ bool clear_app_envs(command_executor *e, shell_context 
*sc, arguments args)
     }
     return true;
 }
+
+bool get_max_replica_count(command_executor *e, shell_context *sc, arguments 
args)
+{
+    if (args.argc < 2) {
+        return false;
+    }
+
+    std::string app_name(args.argv[1]);
+
+    auto err_resp = sc->ddl_client->get_max_replica_count(app_name);
+    auto err = err_resp.get_error();
+    const auto &resp = err_resp.get_value();
+
+    if (err.is_ok()) {
+        err = dsn::error_s::make(resp.err);
+    }
+
+    std::string escaped_app_name(pegasus::utils::c_escape_string(app_name));
+    if (err.is_ok()) {
+        fmt::print(stdout,
+                   "the replica count of app({}) is {}\n",
+                   escaped_app_name,
+                   resp.max_replica_count);

Review Comment:
   > It's better to output also in JSON, so we can parse easily in 3rd party 
tools.
   
   OK, I'll add `-j` and `--json` for `get_replica_count`, for example: 
{"max_replica_count": 3}.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to