Arkanjo 0.2
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
orchestrator.hpp
Go to the documentation of this file.
1
13#pragma once
14
16#include <arkanjo/base/path.hpp>
17
20
22
23struct Context {
24 std::string command_name;
26 std::vector<std::string> extra_args;
27
28 int argc;
29 char** argv;
30};
31
32using Step = std::function<bool(Context&)>;
39 private:
40 std::vector<Step> steps;
41 size_t current_step = 0;
42
43 public:
44 void add_step(Step step) { steps.push_back(step); }
45
46 void skip() {
47 current_step = steps.size();
48 }
49
50 void run_pipeline(Context& ctx) {
51 for (current_step = 0; current_step < steps.size(); ++current_step) {
52 if (!steps[current_step] || !steps[current_step](ctx)) {
53 std::cerr << "Pipeline aborted (" << current_step << ")\n";
54 break;
55 }
56 }
57 }
58};
Main command orchestrator.
void run_pipeline(Context &ctx)
void add_step(Step step)
Function abstraction for temporary codebase.
std::function< bool(Context &)> Step
Path abstraction for temporary codebase.
Similarity relationships storage and analysis.
char ** argv
ParsedOptions options
std::string command_name
std::vector< std::string > extra_args
Defines utility functions used across all files.