Albert S
3d0fce590b
main: Parse args using getopt_long() in main(). Begin implementation of a CLI. It can be launched using ./qswiki config --cli. Allow connecting to another instance using "attach" command. This uses Unix domain sockets, and in the future can be used to drop caches, reload template, etc. Closes: #21
28 líneas
497 B
C++
28 líneas
497 B
C++
#ifndef CLICONSOLE_H
|
|
#define CLICONSOLE_H
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <sys/socket.h>
|
|
#include <sys/un.h>
|
|
#include "cli.h"
|
|
|
|
class CLIConsole
|
|
{
|
|
private:
|
|
struct sockaddr_un server;
|
|
int sock;
|
|
CLIHandler *handler;
|
|
std::string socketPath;
|
|
bool attached = false;
|
|
std::pair<bool, std::string> send(std::string input);
|
|
void attach();
|
|
|
|
public:
|
|
CLIConsole(CLIHandler &cliHandler, std::string socketPath);
|
|
void startInteractive();
|
|
};
|
|
|
|
#endif // CLICONSOLE_H
|