base: modify way how platforms are recognized
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
This commit is contained in:
parent
c47488479b
commit
fbe7929b16
@ -25,7 +25,7 @@ int main(int argc, char* argv[]) {
|
||||
extract_value_from_arg(args, ARG_REMOTE));
|
||||
LOG_INFO("Project platforms:");
|
||||
for (size_t i = 0; i < project_platforms->size; i++) {
|
||||
LOG_INFO("%s", SUPPORTED_PLATFORM_NAMES[project_platforms->ids[i]]);
|
||||
printf("%s", SUPPORTED_PLATFORM_NAMES[project_platforms->ids[i]]);
|
||||
}
|
||||
cdo_free((void*)project_path);
|
||||
free_arg_list(args);
|
||||
|
||||
@ -61,13 +61,21 @@ static PlatformIdList* identify_remote_urls(Lines* remote_urls) {
|
||||
}
|
||||
|
||||
PlatformIdList* platforms = cdo_calloc(1, sizeof(PlatformIdList));
|
||||
platforms->size = remote_urls->size;
|
||||
platforms->ids = cdo_malloc(platforms->size * sizeof(PlaformId));
|
||||
|
||||
for(size_t i = 0; i < remote_urls->size; i++) {
|
||||
platforms->ids[i] = get_platfrom_id_from_string(remote_urls->lines[i]->data);
|
||||
if (platforms->ids[i] != PL_UNRECOGNIZED) platforms->size++;
|
||||
}
|
||||
|
||||
if (platforms->size == 0) {
|
||||
LOG_ERROR_EXIT(
|
||||
"No recongnized Git hosting platforms found in the project. "
|
||||
"Supported platforms: [%s, %s]",
|
||||
SUPPORTED_PLATFORM_NAMES[PL_GITHUB], SUPPORTED_PLATFORM_NAMES[PL_GITLAB]
|
||||
);
|
||||
}
|
||||
|
||||
return platforms;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user