// [Command] --backend [Backend module path] --backend-arg ... --backend-arg ...
// --pre [Action module path] --pre-arg ... --pre-arg ...
// --post [Action module path] --post-arg ... --post-arg ...
- // TODO Show usage message on invalid arguments
// Argument sections
//
sections.post.back().append(arg);
};
+ if (argc < 2)
+ {
+ std::cerr << "Usage:" << std::endl
+ << "[Command] --backend [Backend module path] "
+ << "--backend-arg [Backend argument] ..." << std::endl
+ << " --pre [Pre-Action module path] "
+ << "--pre-arg [Pre-Action argument] ..." << std::endl
+ << " --post [Post-Action module path] "
+ << "--post-arg [Post-Action argument] ..." << std::endl;
+ return 255;
+ }
+
for (int n = 1; n < argc; n += 2)
{
const std::string tag{argv[n]};
it->second(arg);
}
-
+
+ // we need a backend
+ if (sections.backend == nullptr)
+ {
+ std::cerr << "Error: Backend is required. Provide with [--backend]" << std::endl;
+ return 255;
+ }
+
// Initialize a backend
auto backend = sections.backend->initialize();