diff options
| author | Eugen Wissner <belka@caraus.de> | 2023-04-02 12:46:44 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2023-04-02 12:46:44 +0200 |
| commit | ae0048ef3d03c1511f2e12e0fdb5ae8d28061dab (patch) | |
| tree | 8c6ffc8116b66530b4a42d63cc59d9c479cf3eab /src/command.h | |
| parent | f46a16b4a0d50b6512df2b312f7f800a9a963ca2 (diff) | |
| download | slackbuilder-ae0048ef3d03c1511f2e12e0fdb5ae8d28061dab.tar.gz | |
Add command to clone the source repository
Diffstat (limited to 'src/command.h')
| -rw-r--r-- | src/command.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/command.h b/src/command.h index 8d0679d..f03281f 100644 --- a/src/command.h +++ b/src/command.h @@ -3,6 +3,8 @@ #include <memory> #include <vector> #include "package.h" +#include <boost/process.hpp> +#include <filesystem> namespace katja { @@ -24,6 +26,29 @@ namespace katja void execute() const override; }; + class update final : public command + { + boost::filesystem::path git_binary; + + template<typename... Args> + void git(const std::string& command, const std::filesystem::path& cwd, const Args&... args) const + { + if (cwd.empty()) + { + boost::process::system(git_binary, command, args...); + } + else + { + boost::process::system(git_binary, "-C", cwd.native(), command, args...); + } + } + + public: + explicit update(); + + void execute() const override; + }; + enum class command_exception_t { no_command, |
