26 lines
572 B
C++
26 lines
572 B
C++
#pragma once
|
|
|
|
#include "cmd/cmd_base.hpp"
|
|
#include <stdexcept>
|
|
#include <string>
|
|
|
|
namespace fsh {
|
|
|
|
class CmdRM : public Command {
|
|
|
|
protected:
|
|
virtual void register_flags() override {
|
|
ArgFactory& factory = get_factory();
|
|
factory.add_rule<std::string>(1);
|
|
}
|
|
|
|
virtual void run(std::istream& in, std::ostream& out, ArgManager& args) override {
|
|
|
|
if(std::remove(args.get<std::string>(0).value().c_str())) {
|
|
throw std::runtime_error("Could not delete file");
|
|
}
|
|
|
|
}
|
|
};
|
|
|
|
} |