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,10 +3,10 @@
#include <stdio.h>
#include "cmd.h"
#include "tools/log.h"
#include "tools/alloc_wrappers.h"
#include "platform/operations.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) {
atexit(exit_cmd);
@ -17,11 +17,14 @@ static void __attribute__((constructor)) init_cdo(void) {
int main(int argc, char* argv[]) {
LOG_DEBUG("Entering function %s", __func__);
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);
LOG_INFO("Project full path: %s", full_path);
identify_platfrom_from_project(full_path);
cdo_free((void*)full_path);
const char* project_path = convert_relative_to_full_path(extract_value_from_arg(args, ARG_PROJECT));
LOG_INFO("Project full path: %s", project_path);
PlaformId project_platform_id = identify_platfrom_from_project(
project_path,
extract_value_from_arg(args, ARG_REMOTE));
cdo_free((void*)project_path);
free_arg_list(args);
return 0;
}

View File

@ -14,7 +14,7 @@ const char* SUPPORTED_PLATFORM_NAMES [] = {
"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__);
if (project_path == NULL) {
LOG_ERROR_EXIT("No path supplied for project.");

View File

@ -11,6 +11,6 @@ typedef enum PlaformId {
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__*/