[clang-tools-extra] r335972 - [clangd] Improve output of --help and --version. NFC.

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 29 06:24:20 PDT 2018


Author: sammccall
Date: Fri Jun 29 06:24:20 2018
New Revision: 335972

URL: http://llvm.org/viewvc/llvm-project?rev=335972&view=rev
Log:
[clangd] Improve output of --help and --version. NFC.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, cfe-commits

Differential Revision: https://reviews.llvm.org/D48634

Modified:
    clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp

Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp?rev=335972&r1=335971&r2=335972&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp (original)
+++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp Fri Jun 29 06:24:20 2018
@@ -18,6 +18,7 @@
 #include "llvm/Support/Program.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/raw_ostream.h"
+#include "clang/Basic/Version.h"
 #include <cstdlib>
 #include <iostream>
 #include <memory>
@@ -153,7 +154,16 @@ static llvm::cl::opt<Path> YamlSymbolFil
 
 int main(int argc, char *argv[]) {
   llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
-  llvm::cl::ParseCommandLineOptions(argc, argv, "clangd");
+  llvm::cl::SetVersionPrinter([](llvm::raw_ostream &OS) {
+    OS << clang::getClangToolFullVersion("clangd") << "\n";
+  });
+  llvm::cl::ParseCommandLineOptions(
+      argc, argv,
+      "clangd is a language server that provides IDE-like features to editors. "
+      "\n\nIt should be used via an editor plugin rather than invoked directly."
+      "For more information, see:"
+      "\n\thttps://clang.llvm.org/extra/clangd.html"
+      "\n\thttps://microsoft.github.io/language-server-protocol/");
   if (Test) {
     RunSynchronously = true;
     InputStyle = JSONStreamStyle::Delimited;




More information about the cfe-commits mailing list