Massive reformating and cleanup

This commit is contained in:
2024-12-06 21:07:54 +01:00
parent 79390b94b7
commit d2cbdc2910
33 changed files with 1030 additions and 1100 deletions

View File

@ -9,33 +9,30 @@
#include "ast/ast.hpp"
#include "cmd/args/arg.hpp"
namespace fsh{
namespace fsh {
class Command {
class Command {
using FlagNode = std::optional<std::string>&;
using ArgNodes = std::vector<std::shared_ptr<CommandArgumentNode > >;
using FlagNode = std::optional<std::string>&;
using ArgNodes = std::vector<std::shared_ptr<CommandArgumentNode> >;
public:
void execute(FlagNode flag, ArgNodes& vec, std::istream& in, std::ostream& out);
public:
void execute(FlagNode flag, ArgNodes& vec, std::istream& in, std::ostream& out);
template <typename T>
static std::unique_ptr<Command> register_cmd() {
std::unique_ptr<Command> cmd = std::make_unique<T>();
cmd->register_flags();
return cmd;
}
template <typename T>
static std::unique_ptr<Command> register_cmd() {
std::unique_ptr<Command> cmd = std::make_unique<T>();
cmd->register_flags();
return cmd;
}
protected:
virtual void register_flags() {};
virtual void run(std::istream& in, std::ostream& out, ArgManager& args) {};
ArgFactory& get_factory() {return arg_factory;}
private:
ArgFactory arg_factory;
};
protected:
virtual void register_flags() {};
virtual void run(std::istream& in, std::ostream& out, ArgManager& args) {};
ArgFactory& get_factory() { return arg_factory; }
private:
ArgFactory arg_factory;
};
}