tisonkun commented on code in PR #1037:
URL: 
https://github.com/apache/incubator-kvrocks/pull/1037#discussion_r1003248340


##########
src/main.cc:
##########
@@ -112,30 +109,47 @@ void setupSigSegvAction() {
   sigaction(SIGINT, &act, nullptr);
 }
 
-static void usage(const char *program) {
-  std::cout << program << " implements the Redis protocol based on rocksdb\n"
-            << "\t-c config file\n"
-            << "\t-h help\n";
-  exit(0);
+constexpr const char *description =
+    "a distributed key value NoSQL database that uses RocksDB as storage 
engine and is compatible with Redis protocol";
+
+static void printUsage(const char *program) {
+  const int width = 32;
+
+  std::cout << program << description << std::endl
+            << std::left << std::setw(width) << "-c, --config <filename>"
+            << "set config file to <filename>, or `-' for stdin" << std::endl
+            << std::setw(width) << "-v, --version"
+            << "print version information" << std::endl
+            << std::setw(width) << "-h, --help"
+            << "print this help message" << std::endl
+            << std::setw(width) << "--<config-key> <config-value>"
+            << "overwrite specific config option <config-key> to 
<config-value>" << std::endl;
 }

Review Comment:
   You may try to improve this usage section. Currently, it shows:
   
   ```
   ➜  kvrocks git:(cli-options) ./cmake-build-debug/kvrocks -h
   ./cmake-build-debug/kvrocksa distributed key value NoSQL database that uses 
RocksDB as storage engine and is compatible with Redis protocol
   -c, --config <filename>         set config file to <filename>, or `-' for 
stdin
   -v, --version                   print version information
   -h, --help                      print this help message
   --<config-key> <config-value>   overwrite specific config option 
<config-key> to <config-value>
   ➜  kvrocks git:(cli-options) redis-server -h
   Usage: ./redis-server [/path/to/redis.conf] [options] [-]
          ./redis-server - (read config from stdin)
          ./redis-server -v or --version
          ./redis-server -h or --help
          ./redis-server --test-memory <megabytes>
          ./redis-server --check-system
   
   Examples:
          ./redis-server (run the server with default conf)
          echo 'maxmemory 128mb' | ./redis-server -
          ./redis-server /etc/redis/6379.conf
          ./redis-server --port 7777
          ./redis-server --port 7777 --replicaof 127.0.0.1 8888
          ./redis-server /etc/myredis.conf --loglevel verbose -
          ./redis-server /etc/myredis.conf --loglevel verbose
   
   Sentinel mode:
          ./redis-server /etc/sentinel.conf --sentinel
   ```



-- 
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]

Reply via email to