$darkmode
main_commands.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2023 Robert Bosch GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  */
23 #include <optional>
24 #include <string>
25 #include <vector>
26 
27 #include "lua_setup.hpp"
28 #include "stack_factory.hpp"
29 
30 namespace engine {
31 
32 struct CheckOptions {
33  cloe::StackOptions stack_options;
34  cloe::LuaOptions lua_options;
35 
36  std::ostream* output = &std::cout;
37  std::ostream* error = &std::cerr;
38  std::string delimiter = ",";
39 
40  // Flags:
41  bool summarize = false;
42  bool output_json = false;
43  int json_indent = 2;
44 };
45 
46 int check(const CheckOptions& opt, const std::vector<std::string>& filepaths);
47 
48 struct DumpOptions {
49  cloe::StackOptions stack_options;
50  cloe::LuaOptions lua_options;
51 
52  std::ostream* output = &std::cout;
53  std::ostream* error = &std::cerr;
54 
55  // Flags:
56  int json_indent = 2;
57 };
58 
59 int dump(const DumpOptions& opt, const std::vector<std::string>& filepaths);
60 
61 struct RunOptions {
62  cloe::StackOptions stack_options;
63  cloe::LuaOptions lua_options;
64 
65  std::ostream* output = &std::cout;
66  std::ostream* error = &std::cerr;
67 
68  // Options
69  std::string uuid;
70 
71  // Flags:
72  int json_indent = 2;
73  bool allow_empty = false;
74  bool write_output = true;
75  bool require_success = false;
76  bool report_progress = true;
77 
78  bool debug_lua = false;
79  int debug_lua_port = 21110;
80 };
81 
82 int run(const RunOptions& opt, const std::vector<std::string>& filepaths);
83 
84 struct ShellOptions {
85  cloe::StackOptions stack_options;
86  cloe::LuaOptions lua_options;
87 
88  std::ostream* output = &std::cout;
89  std::ostream* error = &std::cerr;
90 
91  // Options:
92  std::vector<std::string> commands;
93 
94  // Flags:
95  std::optional<bool> interactive;
96  bool ignore_errors;
97 };
98 
99 int shell(const ShellOptions& opt, const std::vector<std::string>& filepaths);
100 
101 struct UsageOptions {
102  cloe::StackOptions stack_options;
103  cloe::LuaOptions lua_options;
104 
105  std::ostream* output = &std::cout;
106  std::ostream* error = &std::cerr;
107 
108  // Flags:
109  bool plugin_usage = false;
110  bool output_json = false;
111  int json_indent = 2;
112 };
113 
114 int usage(const UsageOptions& opt, const std::string& argument);
115 
117  std::ostream* output = &std::cout;
118  std::ostream* error = &std::cerr;
119 
120  // Flags:
121  bool output_json = false;
122  int json_indent = 2;
123 };
124 
125 int version(const VersionOptions& opt);
126 
127 } // namespace engine
Definition: lua_setup.hpp:42
Definition: stack_factory.hpp:51
Definition: main_commands.hpp:32
Definition: main_commands.hpp:48
Definition: main_commands.hpp:61
Definition: main_commands.hpp:84
Definition: main_commands.hpp:101
Definition: main_commands.hpp:116