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

@ -4,21 +4,20 @@
namespace fsh {
class CmdTouch : public Command {
protected:
virtual void register_flags() override {
ArgFactory& factory = get_factory();
factory.add_rule<std::string>(true);
}
class CmdTouch : public Command {
virtual void run(std::istream& in, std::ostream& out, ArgManager& args) override {
auto name = *(args.get<std::string>(0));
if(std::ifstream(name, std::ios::in).good() || !std::ofstream(name, std::ios::out).is_open()) {
throw std::runtime_error("File exists");
protected:
virtual void register_flags() override {
ArgFactory& factory = get_factory();
factory.add_rule<std::string>(true);
}
}
};
virtual void run(std::istream& in, std::ostream& out, ArgManager& args) override {
auto name = *(args.get<std::string>(0));
if (std::ifstream(name, std::ios::in).good() || !std::ofstream(name, std::ios::out).is_open()) {
throw std::runtime_error("File exists");
}
}
};
}