7#include "../help/help.hpp"
20int main(
int argc,
char* argv[]) {
22 cfg.setDefaultConfig();
23 cfg.program_name =
"arkanjo-preprocessor";
28 ctx.
command_name = (argc > 1) ? argv[1] : OrchestratorHelper::DEFAULT_COMMAND;
34 {{
"build"}, [&]() {
return std::make_unique<PreprocessorBuild>(); }},
35 {{
"list",
"ls"}, [&]() {
return std::make_unique<PreprocessorList>(); }},
36 {{
"clean"}, [&]() {
return std::make_unique<PreprocessorClean>(); }},
37 {{
"path"}, [&]() {
return std::make_unique<PreprocessorPath>(); }},
40 std::unique_ptr<ICommand> command;
57 orchestrator.
add_step([&orchestrator, &command, &collector](
Context& ctx) {
74 std::cerr << e.what() <<
"\n";
76 }
catch (
const std::exception& e) {
77 std::cerr <<
"Unexpected error: " << e.what() <<
"\n";
Base class for CLI-related errors.
An error is thrown when an unknown command is passed.
static Config & config()
Gets the singleton configuration instance.
void add_options(const CliOption *long_opts)
Step make_parse_step(int argc, char *argv[])
Main command orchestrator.
void run_pipeline(Context &ctx)
std::function< std::unique_ptr< ICommand >()> CommandFactory
Step setup_command_step(std::unique_ptr< ICommand > &command, const std::vector< std::pair< std::vector< std::string >, CommandsRegistry::CommandFactory > > &commands)
constexpr CliOption global_long_opts[]
bool formatter_step(Context &ctx)
Step command_run_step(std::shared_ptr< ICommand > command, const OptionsCollector &collector)
Main command orchestration interface.
Codebase preprocessing interface.
Remove cached application data.
Interface for listing preprocessors in the system.
int main(int argc, char *argv[])
Interface for displaying the cache directory path.
bool has(const std::string &name) const
Checks whether an option exists.
std::optional< std::string_view > get(const std::string &name) const
Returns the value of an option.
std::string program_name
Name of the program.
std::filesystem::path name_container
Name of the cache container.