-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
157 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "Frate/Interface.hpp" | ||
#include <memory> | ||
namespace Frate::Command::Template{ | ||
bool remove(std::shared_ptr<Frate::Command::Interface> inter); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include <Frate/Command/Template.hpp> | ||
|
||
namespace Frate::Command::Template { | ||
bool remove(std::shared_ptr<Frate::Command::Interface> inter) { | ||
std::string template_name; | ||
bool all; | ||
|
||
|
||
if (inter->args->count("args")) { | ||
template_name = inter->args->operator[]("args").as<std::string>(); | ||
} | ||
if (inter->args->count("all")) { | ||
all = inter->args->operator[]("all").as<bool>(); | ||
} | ||
|
||
Utils::info << "Removing template " << template_name << std::endl; | ||
Utils::info << "All: " << all << std::endl; | ||
|
||
if (all) { | ||
try{ | ||
inter->templates->deleteAll(); | ||
return true; | ||
} catch (std::exception &e) { | ||
Utils::error << e.what() << std::endl; | ||
return false; | ||
} | ||
} else { | ||
if(template_name.empty()) { | ||
Utils::error << "No template name given" << std::endl; | ||
return false; | ||
} | ||
try{ | ||
inter->templates->uninstallAll(template_name); | ||
return true; | ||
} catch (std::exception &e) { | ||
Utils::error << e.what() << std::endl; | ||
return false; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
} |
Oops, something went wrong.