• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 TEST_WUKONG_SHELL_COMMAND_H
17 #define TEST_WUKONG_SHELL_COMMAND_H
18 
19 #include <getopt.h>
20 #include <iostream>
21 #include <string>
22 #include <vector>
23 
24 #include "bundle_mgr_interface.h"
25 #include "shell_command.h"
26 #include "wukong_define.h"
27 #include "wukong_util.h"
28 
29 namespace OHOS {
30 namespace WuKong {
31 /**
32  * @brief WuKong command parser.
33  */
34 class WuKongShellCommand : public OHOS::AAFwk::ShellCommand {
35 public:
36     WuKongShellCommand(int argc, char *argv[]);
37     ~WuKongShellCommand() = default;
38     ErrCode init() override;
39 
40     /**
41      * @brief Create a Command Map object
42      * @return Return ERR_OK on success, others on failure.
43      */
44     ErrCode CreateCommandMap() override;
45 
46     /**
47      * @brief Create a Message Map that "error: wukong internal error."
48      * @return Return ERR_OK on success, others on failure.
49      */
50     ErrCode CreateMessageMap() override;
51 
52     /**
53      * @brief Get the Wu Kong Version.
54      * @return Return ERR_OK on success, others on failure.
55      */
56     ErrCode GetWuKongVersion();
57 
58     /**
59      * @brief run stop command.
60      * @return Return ERR_OK on success, others on failure.
61      */
62     ErrCode RunStopCommand();
63 
64     /**
65      * @brief run the test to the command.
66      * @return Return ERR_OK on success, others on failure.
67      */
68     ErrCode RunTestCommand();
69 
70     /**
71      * @brief get WUKONG_HELP_MSG.
72      * @return Return ERR_OK on success, others on failure.
73      */
74     ErrCode RunAsHelpCommand();
75 
76     /**
77      * @brief  get all launch app and ability name.
78      * @return Return ERR_OK on success, others on failure.
79      */
80     ErrCode ShowAllAppInfo();
81 
82     /**
83      * @brief Get command arguments
84      * @return command arguments.
85      */
86     char **GetArgv();
87 
88     /**
89      * @brief Get the command argument count.
90      * @return argument count.
91      */
92     int GetArgc();
93 
94     /**
95      * @brief Set command result information.
96      * @param receiver command result.
97      */
98     void ResultReceiverAppend(const std::string receiver);
99 
100 private:
101 };
102 }  // namespace WuKong
103 }  // namespace OHOS
104 
105 #endif  // TEST_WUKONG_SHELL_COMMAND_H
106