1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef OHOS_ABILITY_RUNTIME_ABILITY_TOOL_COMMAND_H
17#define OHOS_ABILITY_RUNTIME_ABILITY_TOOL_COMMAND_H
18
19#include "ability_command.h"
20#include "shell_command.h"
21#include "start_options.h"
22#include "want.h"
23
24namespace OHOS {
25namespace AAFwk {
26class AbilityToolCommand : public ShellCommand {
27public:
28    AbilityToolCommand(int argc, char* argv[]);
29    ~AbilityToolCommand() override {}
30
31private:
32    ErrCode CreateCommandMap() override;
33    ErrCode CreateMessageMap() override;
34    ErrCode init() override;
35
36    ErrCode RunAsHelpCommand();
37    ErrCode RunAsStartAbility();
38    ErrCode RunAsStopService();
39    ErrCode RunAsForceStop();
40    ErrCode RunAsTestCommand();
41
42    ErrCode ParseStartAbilityArgsFromCmd(Want& want, StartOptions& startOptions);
43    ErrCode ParseStopServiceArgsFromCmd(Want& want);
44    ErrCode ParseTestArgsFromCmd(std::map<std::string, std::string>& params);
45    bool GetKeyAndValueByOpt(int optind, std::string& key, std::string& value);
46
47    std::shared_ptr<AbilityManagerShellCommand> aaShellCmd_;
48};
49} // namespace AAFwk
50} // namespace OHOS
51
52#endif // OHOS_ABILITY_RUNTIME_ABILITY_TOOL_COMMAND_H
53