1 //===-- CommandObjectVersion.cpp --------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "CommandObjectVersion.h" 10 11 #include "lldb/Interpreter/CommandInterpreter.h" 12 #include "lldb/Interpreter/CommandReturnObject.h" 13 #include "lldb/lldb-private.h" 14 15 using namespace lldb; 16 using namespace lldb_private; 17 18 // CommandObjectVersion 19 20 CommandObjectVersion::CommandObjectVersion(CommandInterpreter &interpreter) 21 : CommandObjectParsed(interpreter, "version", 22 "Show the LLDB debugger version.", "version") {} 23 24 CommandObjectVersion::~CommandObjectVersion() {} 25 26 bool CommandObjectVersion::DoExecute(Args &args, CommandReturnObject &result) { 27 if (args.GetArgumentCount() == 0) { 28 result.AppendMessageWithFormat("%s\n", lldb_private::GetVersion()); 29 result.SetStatus(eReturnStatusSuccessFinishResult); 30 } else { 31 result.AppendError("the version command takes no arguments."); 32 result.SetStatus(eReturnStatusFailed); 33 } 34 return true; 35 } 36