mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-04 19:04:56 +11:00
all: optimize build
This commit is contained in:
parent
1168879d6d
commit
7ffce72b31
51 changed files with 1526 additions and 1277 deletions
103
src/launch/launch_p.hpp
Normal file
103
src/launch/launch_p.hpp
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <CLI/App.hpp>
|
||||
#include <qcoreapplication.h>
|
||||
#include <qstring.h>
|
||||
|
||||
namespace qs::launch {
|
||||
|
||||
extern int DAEMON_PIPE; // NOLINT
|
||||
|
||||
class QStringOption {
|
||||
public:
|
||||
QStringOption() = default;
|
||||
QStringOption& operator=(const std::string& str) {
|
||||
this->str = QString::fromStdString(str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QString& operator*() { return this->str; }
|
||||
QString* operator->() { return &this->str; }
|
||||
|
||||
private:
|
||||
QString str;
|
||||
};
|
||||
|
||||
struct CommandState {
|
||||
struct {
|
||||
int argc = 0;
|
||||
char** argv = nullptr;
|
||||
} exec;
|
||||
|
||||
struct {
|
||||
bool timestamp = false;
|
||||
bool noColor = !qEnvironmentVariableIsEmpty("NO_COLOR");
|
||||
bool sparse = false;
|
||||
size_t verbosity = 0;
|
||||
int tail = 0;
|
||||
bool follow = false;
|
||||
QStringOption rules;
|
||||
QStringOption readoutRules;
|
||||
QStringOption file;
|
||||
} log;
|
||||
|
||||
struct {
|
||||
QStringOption path;
|
||||
QStringOption manifest;
|
||||
QStringOption name;
|
||||
} config;
|
||||
|
||||
struct {
|
||||
int port = -1;
|
||||
bool wait = false;
|
||||
} debug;
|
||||
|
||||
struct {
|
||||
QStringOption id;
|
||||
pid_t pid = -1; // NOLINT (include)
|
||||
bool all = false;
|
||||
} instance;
|
||||
|
||||
struct {
|
||||
bool json = false;
|
||||
} output;
|
||||
|
||||
struct {
|
||||
bool info = false;
|
||||
QStringOption target;
|
||||
QStringOption function;
|
||||
std::vector<QStringOption> arguments;
|
||||
} ipc;
|
||||
|
||||
struct {
|
||||
CLI::App* log = nullptr;
|
||||
CLI::App* list = nullptr;
|
||||
CLI::App* kill = nullptr;
|
||||
CLI::App* msg = nullptr;
|
||||
} subcommand;
|
||||
|
||||
struct {
|
||||
bool checkCompat = false;
|
||||
bool printVersion = false;
|
||||
bool killAll = false;
|
||||
bool noDuplicate = false;
|
||||
bool daemonize = false;
|
||||
} misc;
|
||||
};
|
||||
|
||||
struct LaunchArgs {
|
||||
QString configPath;
|
||||
int debugPort = -1;
|
||||
bool waitForDebug = false;
|
||||
};
|
||||
|
||||
void exitDaemon(int code);
|
||||
|
||||
int parseCommand(int argc, char** argv, CommandState& state);
|
||||
int runCommand(int argc, char** argv, QCoreApplication* coreApplication);
|
||||
|
||||
int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplication);
|
||||
|
||||
} // namespace qs::launch
|
||||
Loading…
Add table
Add a link
Reference in a new issue