180814287SRaphael Isemann //===-- CommandObjectVersion.cpp ------------------------------------------===//
231c39dacSJohnny Chen //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler 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/CommandReturnObject.h"
12b9c1b51eSKate Stone #include "lldb/lldb-private.h"
1331c39dacSJohnny Chen 
1431c39dacSJohnny Chen using namespace lldb;
1531c39dacSJohnny Chen using namespace lldb_private;
1631c39dacSJohnny Chen 
1731c39dacSJohnny Chen // CommandObjectVersion
1831c39dacSJohnny Chen 
197428a18cSKate Stone CommandObjectVersion::CommandObjectVersion(CommandInterpreter &interpreter)
20b9c1b51eSKate Stone     : CommandObjectParsed(interpreter, "version",
21b9c1b51eSKate Stone                           "Show the LLDB debugger version.", "version") {}
2231c39dacSJohnny Chen 
23*fd2433e1SJonas Devlieghere CommandObjectVersion::~CommandObjectVersion() = default;
2431c39dacSJohnny Chen 
25b9c1b51eSKate Stone bool CommandObjectVersion::DoExecute(Args &args, CommandReturnObject &result) {
26b9c1b51eSKate Stone   if (args.GetArgumentCount() == 0) {
2785e8b814SJim Ingham     result.AppendMessageWithFormat("%s\n", lldb_private::GetVersion());
2831c39dacSJohnny Chen     result.SetStatus(eReturnStatusSuccessFinishResult);
29b9c1b51eSKate Stone   } else {
3057ee3067SGreg Clayton     result.AppendError("the version command takes no arguments.");
3157ee3067SGreg Clayton   }
3231c39dacSJohnny Chen   return true;
3331c39dacSJohnny Chen }
34