1 | // SPDX-License-Identifier: GPL-3.0-or-later |
2 | |
3 | #pragma once |
4 | |
5 | #include <filesystem> |
6 | #include <map> |
7 | #include <stddef.h> |
8 | #include <vector> |
9 | |
10 | using namespace std::string_literals; |
11 | |
12 | void do_help(int argc, const char *argv[]); |
13 | void do_version(int argc, const char *argv[]); |
14 | void do_exit(int argc, const char *argv[]); |
15 | void do_clear(int argc, const char *argv[]); |
16 | |
17 | typedef struct |
18 | { |
19 | const char *command; |
20 | void (*action)(const std::vector<std::string> &argv); |
21 | const char *description; |
22 | } command_t; |
23 | |
24 | extern const std::vector<command_t> builtin_commands; |
25 | extern bool verbose; |
26 | extern std::map<std::string, std::string> aliases; |
27 | |
28 | bool execute_line(const std::string &in); |
29 | bool do_interpret_script(const std::filesystem::path &path); |
30 | |
31 | // jsonrpc.cpp |
32 | int do_jsonrpc(); |
33 | |
34 | // utils.cpp |
35 | const std::vector<std::filesystem::path> &get_paths(bool force = false); |
36 | std::string string_trim(const std::string &in); |
37 | std::pair<int, int> wait_for_pid(pid_t pid, int flags = 0); |
38 | |