mirror of
https://github.com/davidallendj/gdpm.git
synced 2025-12-20 03:27:02 -07:00
Small fixes
Updated CMakeLists.txt Updated README.md Updated bin/gdpm-test.sh Changed some constants defined in constants.hpp Added GDPM_TIMESTAMP_FORMAT configurable macro
This commit is contained in:
parent
1893c7c36b
commit
2b250d9a2d
11 changed files with 288 additions and 120 deletions
|
|
@ -39,7 +39,7 @@ namespace gdpm::constants{
|
|||
#define GDPM_DEFAULT_ASSET_SUPPORT all
|
||||
#define GDPM_DEFAULT_ASSET_FILTER ""
|
||||
#define GDPM_DEFAULT_ASSET_USER ""
|
||||
#define GDPM_DEFAULT_ASSET_GODOT_VERSION ""
|
||||
#define GDPM_DEFAULT_ASSET_GODOT_VERSION "3.4"
|
||||
#define GDPM_DEFAULT_ASSET_MAX_RESULTS 500
|
||||
#define GDPM_DEFAULT_ASSET_PAGE 0
|
||||
#define GDPM_DEFAULT_ASSET_SORT none
|
||||
|
|
@ -71,4 +71,8 @@ namespace gdpm::constants{
|
|||
|
||||
#ifndef GDPM_ENABLE_TIMESTAMPS
|
||||
#define GDPM_ENABLE_TIMESTAMPS 1
|
||||
#endif
|
||||
|
||||
#ifndef GDPM_TIMESTAMP_FORMAT
|
||||
#define GDPM_TIMESTAMP_FORMAT ":%I:%M:%S %p; %Y-%m-%d"
|
||||
#endif
|
||||
|
|
@ -15,7 +15,7 @@ namespace gdpm::package_manager{
|
|||
extern CURL *curl;
|
||||
extern CURLcode res;
|
||||
extern config::config_context config;
|
||||
|
||||
|
||||
struct package_info{
|
||||
size_t asset_id;
|
||||
std::string type;
|
||||
|
|
@ -34,6 +34,7 @@ namespace gdpm::package_manager{
|
|||
std::string download_hash;
|
||||
bool is_installed;
|
||||
std::string install_path;
|
||||
std::vector<package_info> dependencies;
|
||||
};
|
||||
|
||||
struct cxxargs{
|
||||
|
|
@ -64,8 +65,7 @@ namespace gdpm::package_manager{
|
|||
GDPM_DLL_EXPORT void remove_packages(const std::vector<std::string>& package_titles);
|
||||
GDPM_DLL_EXPORT void update_packages(const std::vector<std::string>& package_titles);
|
||||
GDPM_DLL_EXPORT void search_for_packages(const std::vector<std::string>& package_titles);
|
||||
GDPM_DLL_EXPORT void list_installed_packages();
|
||||
GDPM_DLL_EXPORT void read_package_contents(const std::string& package_title);
|
||||
GDPM_DLL_EXPORT void list_information(const std::vector<std::string>& opts);
|
||||
GDPM_DLL_EXPORT void clean_temporary(const std::vector<std::string>& package_titles);
|
||||
GDPM_DLL_EXPORT void link_packages(const std::vector<std::string>& package_titles, const std::vector<std::string>& paths);
|
||||
GDPM_DLL_EXPORT void clone_packages(const std::vector<std::string>& package_titles, const std::vector<std::string>& paths);
|
||||
|
|
@ -78,6 +78,8 @@ namespace gdpm::package_manager{
|
|||
GDPM_DLL_EXPORT void run_command(command_e command, const std::vector<std::string>& package_titles, const std::vector<std::string>& opts);
|
||||
GDPM_DLL_EXPORT void print_package_list(const rapidjson::Document& json);
|
||||
GDPM_DLL_EXPORT void print_package_list(const std::vector<package_info>& packages);
|
||||
GDPM_DLL_EXPORT void print_remote_sources();
|
||||
|
||||
GDPM_DLL_EXPORT std::vector<package_info> synchronize_database(const std::vector<std::string>& package_titles);
|
||||
GDPM_DLL_EXPORT std::vector<std::string> resolve_dependencies(const std::vector<std::string>& package_titles);
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ namespace gdpm::rest_api{
|
|||
enum support_e { all, official, community, testing };
|
||||
enum sort_e { none, rating, cost, name, updated };
|
||||
|
||||
struct asset_list_context{
|
||||
struct rest_api_context{
|
||||
type_e type;
|
||||
int category;
|
||||
support_e support;
|
||||
|
|
@ -47,13 +47,14 @@ namespace gdpm::rest_api{
|
|||
int verbose;
|
||||
};
|
||||
|
||||
asset_list_context make_context(type_e type = GDPM_DEFAULT_ASSET_TYPE, int category = GDPM_DEFAULT_ASSET_CATEGORY, support_e support = GDPM_DEFAULT_ASSET_SUPPORT, const std::string& filter = GDPM_DEFAULT_ASSET_FILTER, const std::string& user = GDPM_DEFAULT_ASSET_USER, const std::string& godot_version = GDPM_DEFAULT_ASSET_GODOT_VERSION, int max_results = GDPM_DEFAULT_ASSET_MAX_RESULTS, int page = GDPM_DEFAULT_ASSET_PAGE, sort_e sort = GDPM_DEFAULT_ASSET_SORT, bool reverse = GDPM_DEFAULT_ASSET_REVERSE, int verbose = GDPM_DEFAULT_ASSET_VERBOSE);
|
||||
rest_api_context make_context(type_e type = GDPM_DEFAULT_ASSET_TYPE, int category = GDPM_DEFAULT_ASSET_CATEGORY, support_e support = GDPM_DEFAULT_ASSET_SUPPORT, const std::string& filter = GDPM_DEFAULT_ASSET_FILTER, const std::string& user = GDPM_DEFAULT_ASSET_USER, const std::string& godot_version = GDPM_DEFAULT_ASSET_GODOT_VERSION, int max_results = GDPM_DEFAULT_ASSET_MAX_RESULTS, int page = GDPM_DEFAULT_ASSET_PAGE, sort_e sort = GDPM_DEFAULT_ASSET_SORT, bool reverse = GDPM_DEFAULT_ASSET_REVERSE, int verbose = GDPM_DEFAULT_ASSET_VERBOSE);
|
||||
|
||||
std::string to_string(type_e type);
|
||||
std::string to_string(support_e support);
|
||||
std::string to_string(sort_e sort);
|
||||
void _print_params(const rest_api_context& params);
|
||||
rapidjson::Document _parse_json(const std::string& r, int verbose = 0);
|
||||
std::string _get_type_string(type_e type);
|
||||
std::string _get_support_string(support_e support);
|
||||
std::string _get_sort_string(sort_e sort);
|
||||
void _print_params(const asset_list_context& params);
|
||||
std::string _prepare_request(const std::string& url, const rest_api_context& context);
|
||||
|
||||
bool register_account(const std::string& username, const std::string& password, const std::string& email);
|
||||
bool login(const std::string& username, const std::string& password);
|
||||
|
|
@ -61,8 +62,8 @@ namespace gdpm::rest_api{
|
|||
|
||||
rapidjson::Document configure(const std::string& url = constants::HostUrl, type_e type = any, int verbose = 0);
|
||||
rapidjson::Document get_assets_list(const std::string& url = constants::HostUrl, type_e type = GDPM_DEFAULT_ASSET_TYPE, int category = GDPM_DEFAULT_ASSET_CATEGORY, support_e support = GDPM_DEFAULT_ASSET_SUPPORT, const std::string& filter = GDPM_DEFAULT_ASSET_FILTER, const std::string& user = GDPM_DEFAULT_ASSET_USER, const std::string& godot_version = GDPM_DEFAULT_ASSET_GODOT_VERSION, int max_results = GDPM_DEFAULT_ASSET_MAX_RESULTS, int page = GDPM_DEFAULT_ASSET_PAGE, sort_e sort = GDPM_DEFAULT_ASSET_SORT, bool reverse = GDPM_DEFAULT_ASSET_REVERSE, int verbose = GDPM_DEFAULT_ASSET_VERBOSE);
|
||||
rapidjson::Document get_assets_list(const std::string& url, const asset_list_context& params);
|
||||
rapidjson::Document get_asset(const std::string& url, int asset_id, int verbose = GDPM_DEFAULT_ASSET_VERBOSE);
|
||||
rapidjson::Document get_assets_list(const std::string& url, const rest_api_context& params = {});
|
||||
rapidjson::Document get_asset(const std::string& url, int asset_id, const rest_api_context& params = {});
|
||||
bool delete_asset(int asset_id); // ...for moderators
|
||||
bool undelete_asset(int asset_id); // ...for moderators
|
||||
bool set_support_level(int asset_id); // ...for moderators
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace gdpm::utils{
|
|||
return fwrite(ptr, size, nmemb, (FILE*)userdata);
|
||||
}
|
||||
|
||||
static inline auto timestamp(const std::string& format = ":%I:%M:%S %p; %Y-%m-%d"){
|
||||
static inline auto timestamp(const std::string& format = GDPM_TIMESTAMP_FORMAT){
|
||||
time_t t = std::time(nullptr);
|
||||
#if GDPM_ENABLE_TIMESTAMPS == 1
|
||||
return fmt::format(fmt::runtime("{"+format+"}"), fmt::localtime(t));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue