cdo: use remote from args in platform identification

issue #2
This commit is contained in:
tylen 2024-09-26 19:28:16 +00:00 committed by Vasily Davydov
parent 5172da33ac
commit 000740d5c7
3 changed files with 21 additions and 18 deletions

View File

@ -3,25 +3,28 @@
#include <stdio.h> #include <stdio.h>
#include "cmd.h" #include "cmd.h"
#include "tools/log.h"
#include "tools/alloc_wrappers.h"
#include "platform/operations.h"
#include "platform/base.h" #include "platform/base.h"
#include "platform/operations.h"
#include "tools/alloc_wrappers.h"
#include "tools/log.h"
static void __attribute__((constructor)) init_cdo(void) { static void __attribute__((constructor)) init_cdo(void) {
atexit(exit_cmd); atexit(exit_cmd);
init_log(); init_log();
init_cmd(); init_cmd();
} }
int main (int argc, char *argv[]) { int main(int argc, char* argv[]) {
LOG_DEBUG("Entering function %s", __func__); LOG_DEBUG("Entering function %s", __func__);
struct ArgList* args = parse_args(argc, argv); struct ArgList* args = parse_args(argc, argv);
const char* relative_project_path = extract_value_from_arg(args, ARG_PROJECT);
const char* full_path = convert_relative_to_full_path(relative_project_path); const char* project_path = convert_relative_to_full_path(extract_value_from_arg(args, ARG_PROJECT));
LOG_INFO("Project full path: %s", full_path); LOG_INFO("Project full path: %s", project_path);
identify_platfrom_from_project(full_path); PlaformId project_platform_id = identify_platfrom_from_project(
cdo_free((void*)full_path); project_path,
free_arg_list(args); extract_value_from_arg(args, ARG_REMOTE));
return 0;
cdo_free((void*)project_path);
free_arg_list(args);
return 0;
} }

View File

@ -14,7 +14,7 @@ const char* SUPPORTED_PLATFORM_NAMES [] = {
"gitlab.com" "gitlab.com"
}; };
PlaformId identify_platfrom_from_project(const char* project_path) { PlaformId identify_platfrom_from_project(const char* project_path, const char* remote) {
LOG_DEBUG("Entering function %s", __func__); LOG_DEBUG("Entering function %s", __func__);
if (project_path == NULL) { if (project_path == NULL) {
LOG_ERROR_EXIT("No path supplied for project."); LOG_ERROR_EXIT("No path supplied for project.");

View File

@ -11,6 +11,6 @@ typedef enum PlaformId {
extern const char* SUPPORTED_PLATFORM_NAMES []; extern const char* SUPPORTED_PLATFORM_NAMES [];
PlaformId identify_platfrom_from_project(const char* project_path); PlaformId identify_platfrom_from_project(const char* project_path, const char* remote);
#endif /*__PLATFORM_BASE_H__*/ #endif /*__PLATFORM_BASE_H__*/