131c39dacSJohnny Chen //===-- CommandObjectVersion.cpp --------------------------------*- C++ -*-===// 231c39dacSJohnny Chen // 3*2946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*2946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 5*2946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 631c39dacSJohnny Chen // 731c39dacSJohnny Chen //===----------------------------------------------------------------------===// 831c39dacSJohnny Chen 931c39dacSJohnny Chen #include "CommandObjectVersion.h" 1031c39dacSJohnny Chen 1131c39dacSJohnny Chen #include "lldb/Interpreter/CommandInterpreter.h" 1231c39dacSJohnny Chen #include "lldb/Interpreter/CommandReturnObject.h" 13b9c1b51eSKate Stone #include "lldb/lldb-private.h" 1431c39dacSJohnny Chen 1531c39dacSJohnny Chen using namespace lldb; 1631c39dacSJohnny Chen using namespace lldb_private; 1731c39dacSJohnny Chen 1831c39dacSJohnny Chen //------------------------------------------------------------------------- 1931c39dacSJohnny Chen // CommandObjectVersion 2031c39dacSJohnny Chen //------------------------------------------------------------------------- 2131c39dacSJohnny Chen 227428a18cSKate Stone CommandObjectVersion::CommandObjectVersion(CommandInterpreter &interpreter) 23b9c1b51eSKate Stone : CommandObjectParsed(interpreter, "version", 24b9c1b51eSKate Stone "Show the LLDB debugger version.", "version") {} 2531c39dacSJohnny Chen 26b9c1b51eSKate Stone CommandObjectVersion::~CommandObjectVersion() {} 2731c39dacSJohnny Chen 28b9c1b51eSKate Stone bool CommandObjectVersion::DoExecute(Args &args, CommandReturnObject &result) { 29b9c1b51eSKate Stone if (args.GetArgumentCount() == 0) { 3085e8b814SJim Ingham result.AppendMessageWithFormat("%s\n", lldb_private::GetVersion()); 3131c39dacSJohnny Chen result.SetStatus(eReturnStatusSuccessFinishResult); 32b9c1b51eSKate Stone } else { 3357ee3067SGreg Clayton result.AppendError("the version command takes no arguments."); 3457ee3067SGreg Clayton result.SetStatus(eReturnStatusFailed); 3557ee3067SGreg Clayton } 3631c39dacSJohnny Chen return true; 3731c39dacSJohnny Chen } 38