Util: Add convenience functions to save external process creation

This commit is contained in:
Riyyi
2021-09-26 00:14:43 +02:00
parent be552db0fb
commit 22082a515b
2 changed files with 83 additions and 2 deletions
+7 -2
View File
@@ -1,7 +1,7 @@
#ifndef SYSTEM_H
#define SYSTEM_H
#include <cstddef> // size_t
#include <cstdint> // int32_t, uint32_t
#include <functional> // function
#include <string>
#include <string_view>
@@ -9,7 +9,7 @@
namespace Util {
using SplitCallback = std::function<void(size_t, char*)>;
using LineCallback = std::function<void(std::vector<std::string>&)>;
class System {
public:
@@ -36,6 +36,11 @@ public:
System operator&&(System rhs);
System operator||(System rhs);
System& cut(uint32_t field);
System& sort(bool unique = false);
System& tail(int32_t number, bool starting = false);
System& apply(LineCallback callback);
void print(const std::vector<std::string>& arguments);
const std::vector<std::string>& arguments() const { return m_arguments; }