From e72d097009897c659bf94f0bbbbc50f04ed35a45 Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Fri, 29 Jun 2018 13:24:20 +0000 Subject: [PATCH] [clangd] Improve output of --help and --version. NFC. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D48634 llvm-svn: 335972 --- clang-tools-extra/clangd/tool/ClangdMain.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp index 75ad029..f63615c0 100644 --- a/clang-tools-extra/clangd/tool/ClangdMain.cpp +++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp @@ -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 #include #include @@ -153,7 +154,16 @@ static llvm::cl::opt YamlSymbolFile( 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; -- 2.7.4