File tree Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -17,12 +17,17 @@ constexpr auto USAGE = R"(Ecsact Config Command
17
17
ecsact config [<keys>...]
18
18
19
19
Options:
20
- --include_dir
21
- Prints the include directory containing Ecsact headers.
22
- --plugin_dir
23
- Prints the directory containing all built-in Ecsact codegen plugins.
24
- --builtin_plugins
25
- Prints a list of built-in Ecsact codegen plugins available.
20
+ <keys>
21
+ Configuration keys. When 1 key is provided the config value for that key is
22
+ printed to stdout. If no keys or more than 1 key is provided then a JSON
23
+ object is printed to stdout.
24
+
25
+ Available config keys:
26
+ install_dir directory Ecsact SDK was installed to
27
+ include_dir directory containing Ecsact headers
28
+ plugin_dir directory containing built-in Ecsact codegen plugins
29
+ builtin_plugins list of built-in Ecsact codegen plugins available.
30
+
26
31
)" ;
27
32
28
33
constexpr auto CANNOT_FIND_INCLUDE_DIR = R"(
@@ -60,6 +65,13 @@ int ecsact::cli::detail::config_command(int argc, char* argv[]) {
60
65
auto output = " {}" _json;
61
66
62
67
std::unordered_map<std::string, std::function<int ()>> key_handlers{
68
+ {
69
+ " install_dir" ,
70
+ [&] {
71
+ output[" install_dir" ] = install_prefix.string ();
72
+ return 0 ;
73
+ },
74
+ },
63
75
{
64
76
" include_dir" ,
65
77
[&] {
@@ -129,6 +141,12 @@ int ecsact::cli::detail::config_command(int argc, char* argv[]) {
129
141
}
130
142
} else {
131
143
for (auto key : keys) {
144
+ if (!key_handlers.contains (key)) {
145
+ std::cerr << " [ERROR] Invalid config key: " << key << " \n\n " ;
146
+ std::cerr << USAGE;
147
+ return 1 ;
148
+ }
149
+
132
150
int exit_code = key_handlers.at (key)();
133
151
if (exit_code != 0 ) {
134
152
return exit_code;
You can’t perform that action at this time.
0 commit comments