Line data Source code
1 : /********************************************************************************
2 : * Copyright (c) 2024 Accenture
3 : *
4 : * This program and the accompanying materials are made available under the
5 : * terms of the Apache License Version 2.0 which is available at
6 : * https://www.apache.org/licenses/LICENSE-2.0
7 : *
8 : * SPDX-License-Identifier: Apache-2.0
9 : ********************************************************************************/
10 :
11 : #include "console/SyncCommandWrapper.h"
12 :
13 : #include "console/AsyncConsole.h"
14 :
15 : namespace console
16 : {
17 0 : SyncCommandWrapper::SyncCommandWrapper(::util::command::ICommand& command) : fCommand(command)
18 : {
19 0 : AsyncConsole::addCommand(*this);
20 0 : }
21 :
22 0 : char const* SyncCommandWrapper::getId() const { return fCommand.getId(); }
23 :
24 0 : void SyncCommandWrapper::getHelp(::util::command::ICommand::IHelpCallback& callback) const
25 : {
26 0 : fCommand.getHelp(callback);
27 0 : }
28 :
29 0 : ::util::command::ICommand::ExecuteResult SyncCommandWrapper::execute(
30 : ::util::string::ConstString const& arguments,
31 : ::util::stream::ISharedOutputStream* sharedOutputStream)
32 : {
33 : ::util::command::ICommand::ExecuteResult const result
34 0 : = fCommand.execute(arguments, sharedOutputStream);
35 0 : AsyncConsole::commandExecuted(result);
36 0 : return ::util::command::ICommand::ExecuteResult(::util::command::ICommand::Result::OK);
37 : }
38 :
39 : } /* namespace console */
|