Skip to content

Commit

Permalink
added update template-index command
Browse files Browse the repository at this point in the history
  • Loading branch information
DeaSTL committed Feb 8, 2024
1 parent eb0813f commit aca32b8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/Frate/Command/TemplateIndex.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "Frate/Interface.hpp"
namespace Frate::Command::TemplateIndex {
bool update(std::shared_ptr<Frate::Command::Interface> inter);
}
6 changes: 6 additions & 0 deletions src/Command/Actions/Update.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <Frate/Command.hpp>
#include <Frate/Command/Actions/Update.hpp>
#include <Frate/Command/TemplateIndex.hpp>

namespace Frate::Command::Update {

Expand All @@ -26,6 +27,11 @@ namespace Frate::Command::Update {
(void)inter;
return updateIndex();
}
},
Handler{
.aliases = {"template-index", "tindex"},
.docs = "Update template index",
.callback = &TemplateIndex::update,
}
};
}
Expand Down
15 changes: 15 additions & 0 deletions src/Command/TemplateIndex/Update.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <Frate/Command/TemplateIndex.hpp>


namespace Frate::Command::TemplateIndex {

bool update(std::shared_ptr<Frate::Command::Interface> inter) {
try{
inter->templates->updateIndex();
} catch (std::exception &e) {
Utils::error << e.what() << std::endl;
return false;
}
return true;
}
}

0 comments on commit aca32b8

Please sign in to comment.