Remove adding argument to module being mandatory
This commit is contained in:
parent
4e98676a18
commit
a98d91e43d
14
src/main.cpp
14
src/main.cpp
|
@ -54,18 +54,18 @@ int main(int argc, const char* argv[]) {
|
|||
exit(1);
|
||||
}
|
||||
auto module = lmodules[name];
|
||||
auto args = string{""};
|
||||
|
||||
if (vm.count("module-args"))
|
||||
args = vm["module-args"].as<string>();
|
||||
|
||||
if (args != "")
|
||||
module->dispatch(args);
|
||||
|
||||
if (vm.count("module-args")) {
|
||||
auto args = vm["module-args"].as<string>();
|
||||
module->dispatch(args);
|
||||
} else module->dispatch("");
|
||||
}
|
||||
else {
|
||||
std::cout << general << "\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
std::cout << "Hello world";
|
||||
}
|
||||
catch (const error &ex) {
|
||||
cerr << ex.what() << '\n';
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
namespace modules {
|
||||
namespace init {
|
||||
MODFNIMPL(init_create, {
|
||||
std::cout << "CREATE";
|
||||
std::cout << "Creating database in current directory."
|
||||
<< std::endl;
|
||||
});
|
||||
|
||||
MODDISPATCHFNIMPL({
|
||||
std::cout << arguments;
|
||||
init_create(arguments);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue