Refactored, simplified, and removed code; replaced cli header lib

- Reinitialized submodules
- Slightly restructed project
- Added more options to `compile.sh` script
- Added more utility functions
This commit is contained in:
David Allen 2023-06-10 19:22:21 -06:00
parent d34243db74
commit e48c54aa40
27 changed files with 564 additions and 3232 deletions

View file

@ -2,6 +2,7 @@
#include "constants.hpp"
#include "error.hpp"
#include "package.hpp"
#include <rapidjson/document.h>
#include <string>
@ -9,27 +10,40 @@
#include <vector>
#include <unordered_map>
namespace gdpm::package{
struct info;
struct params;
}
namespace gdpm::config{
struct context{
string username;
string password;
string path;
string token;
string godot_version;
string packages_dir;
string tmp_dir;
string_map remote_sources;
size_t threads;
size_t timeout;
bool enable_sync;
size_t jobs = 1;
size_t timeout = 3000;
bool enable_sync = true;
bool enable_cache = true;
bool skip_prompt = false;
bool enable_file_logging;
bool clean_temporary;
int verbose;
package::info info;
rest_api::request_params api_params;
};
string to_json(const context& params);
error load(std::filesystem::path path, context& config, int verbose = 0);
error save(std::filesystem::path path, const context& config, int verbose = 0);
string to_json(const context& config, bool pretty_print = false);
error load(std::filesystem::path path, context& config);
error save(std::filesystem::path path, const context& config);
error handle_config(config::context& config, const args_t& args, const var_opts& opts);
context make_context(const string& username = GDPM_CONFIG_USERNAME, const string& password = GDPM_CONFIG_PASSWORD, const string& path = GDPM_CONFIG_PATH, const string& token = GDPM_CONFIG_TOKEN, const string& godot_version = GDPM_CONFIG_GODOT_VERSION, const string& packages_dir = GDPM_CONFIG_LOCAL_PACKAGES_DIR, const string& tmp_dir = GDPM_CONFIG_LOCAL_TMP_DIR, const string_map& remote_sources = {GDPM_CONFIG_REMOTE_SOURCES}, size_t threads = GDPM_CONFIG_THREADS, size_t timeout = 0, bool enable_sync = GDPM_CONFIG_ENABLE_SYNC, bool enable_file_logging = GDPM_CONFIG_ENABLE_FILE_LOGGING, int verbose = GDPM_CONFIG_VERBOSE);
error validate(const rapidjson::Document& doc);
void print(const context& config);
extern context config;
}