Add read project lists
This commit is contained in:
parent
fe9e887061
commit
a4229edd6f
4 changed files with 118 additions and 4 deletions
|
@ -1,16 +1,25 @@
|
|||
#include <clippy/clippy.hpp>
|
||||
#include <clippy/target.hpp>
|
||||
|
||||
#include <utils/parametres.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
|
||||
void Clippy::Run(const std::vector<std::string>& args) {
|
||||
TryExecuteClippyCommand(args);
|
||||
auto result = TryExecuteClippyCommand(args);
|
||||
if (result) {
|
||||
result->Execute();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool Clippy::TryExecuteClippyCommand(const std::vector<std::string>& args) {
|
||||
Clippy::TargetPtr Clippy::TryExecuteClippyCommand(
|
||||
const std::vector<std::string>& args) {
|
||||
using namespace utils::parametres;
|
||||
using namespace clippy::targets;
|
||||
if (CheckPatternParametres(args, Parameter::Skip, "help",
|
||||
Parameter::Anything)) {
|
||||
std::cout << "Hello I'm clippy" << std::endl;
|
||||
|
@ -19,7 +28,21 @@ bool Clippy::TryExecuteClippyCommand(const std::vector<std::string>& args) {
|
|||
std::cout << args[i] << (i + 1 == args.size() ? "" : ",") << " ";
|
||||
}
|
||||
std::cout << "}" << std::endl;
|
||||
|
||||
return std::make_unique<EmptyTarget>();
|
||||
}
|
||||
|
||||
return false;
|
||||
if (CheckPatternParametres(args, Parameter::Skip, "cfg",
|
||||
Parameter::Anything)) {
|
||||
projects_.LoadFrom("test");
|
||||
auto p = projects_.GetCurrentProject();
|
||||
|
||||
if (p.has_value()) {
|
||||
return std::make_unique<OpenProjectConfig>(p.value().configuration_file);
|
||||
} else {
|
||||
return std::make_unique<CreateProjectConfig>(projects_);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue