Introduce CLI
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
Cette révision appartient à :
27
cliconsole.h
Fichier normal
27
cliconsole.h
Fichier normal
@@ -0,0 +1,27 @@
|
||||
#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
|
Référencer dans un nouveau ticket
Bloquer un utilisateur