xref: /llvm-project/lldb/source/Commands/CommandObjectVersion.cpp (revision ceff6644bba4d6c5e9c338afe92c453c7597609b)
1 //===-- CommandObjectVersion.cpp --------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "CommandObjectVersion.h"
11 
12 #include "lldb/Interpreter/CommandInterpreter.h"
13 #include "lldb/Interpreter/CommandReturnObject.h"
14 #include "lldb/lldb-private.h"
15 
16 using namespace lldb;
17 using namespace lldb_private;
18 
19 //-------------------------------------------------------------------------
20 // CommandObjectVersion
21 //-------------------------------------------------------------------------
22 
23 CommandObjectVersion::CommandObjectVersion(CommandInterpreter &interpreter)
24     : CommandObjectParsed(interpreter, "version",
25                           "Show the LLDB debugger version.", "version") {}
26 
27 CommandObjectVersion::~CommandObjectVersion() {}
28 
29 bool CommandObjectVersion::DoExecute(Args &args, CommandReturnObject &result) {
30   if (args.GetArgumentCount() == 0) {
31     result.AppendMessageWithFormat("%s\n", lldb_private::GetVersion());
32     result.SetStatus(eReturnStatusSuccessFinishResult);
33   } else {
34     result.AppendError("the version command takes no arguments.");
35     result.SetStatus(eReturnStatusFailed);
36   }
37   return true;
38 }
39