acelyc111 commented on code in PR #2165:
URL:
https://github.com/apache/incubator-pegasus/pull/2165#discussion_r1880310765
##########
src/shell/command_helper.h:
##########
@@ -1034,13 +1034,27 @@ class aggregate_stats_calcs
for (const auto &str : strs) {
\
uint32_t v;
\
if (!::dsn::buf2uint32(str, v)) {
\
- fmt::print(stderr, "invalid command, '{}' should be an
unsigned integer\n", str); \
+ SHELL_PRINTLN_ERROR("invalid command, '{}' should be an
unsigned integer", str); \
return false;
\
}
\
container.insert(v);
\
}
\
} while (false)
+// Parse enum value from the parameters of command line.
+#define PARSE_OPT_ENUM(enum_val, invalid_val, ...)
\
+ do {
\
+ const std::string __str(cmd(__VA_ARGS__, "").str());
\
+ if (!__str.empty()) {
\
+ const auto &__val = enum_from_string(__str.c_str(), invalid_val);
\
+ if (__val == invalid_val) {
\
+ SHELL_PRINTLN_ERROR("invalid enum {}", __str);
\
Review Comment:
```suggestion
SHELL_PRINTLN_ERROR("invalid enum: '{}'", __str);
\
```
--
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]