update: finish up the pull command

This commit is contained in:
ngn 2024-05-02 23:20:33 +03:00
parent d7e347175f
commit 9e8f57c175
10 changed files with 98 additions and 41 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-02 23:10+0300\n"
"POT-Creation-Date: 2024-05-02 23:20+0300\n"
"PO-Revision-Date: 2024-05-01 13:34+0300\n"
"Last-Translator: <ngn@ngn.tf>\n"
"Language-Team: Turkish <gnome-turk@gnome.org>\n"
@ -50,7 +50,7 @@ msgstr ""
msgid "Configuration details:\n"
msgstr ""
#: src/config.c:178
#: src/config.c:178 src/target.c:119
msgid "Name"
msgstr ""
@ -82,11 +82,11 @@ msgstr ""
msgid "Failed to load the configuration file (mc.cfg):"
msgstr ""
#: src/gen.c:42
#: src/gen.c:42 src/pull.c:109
msgid "Copying all the targets"
msgstr ""
#: src/gen.c:48
#: src/gen.c:48 src/pull.c:121
msgid "Failed to copy the target:"
msgstr ""
@ -184,43 +184,59 @@ msgstr ""
msgid "Do you want to continue?"
msgstr ""
#: src/pull.c:88
#: src/pull.c:91
msgid "Checking all the targets"
msgstr ""
#: src/pull.c:92
#: src/pull.c:97
#, c-format
msgid "Failed to access the source for the target \"%s\""
msgstr ""
#: src/pull.c:98
msgid "All the targets are OK"
#: src/pull.c:106
msgid "All the target checks were successful"
msgstr ""
#: src/target.c:13
#: src/pull.c:114
msgid "Install the target?"
msgstr ""
#: src/pull.c:115
msgid "Skipping target"
msgstr ""
#: src/target.c:15
msgid "Configuration target is missing a name"
msgstr ""
#: src/target.c:18
#: src/target.c:20
#, c-format
msgid "Configuration target \"%s\" does not have \"dst\" field"
msgstr ""
#: src/target.c:23
#: src/target.c:25
#, c-format
msgid "Configuration target \"%s\" does not have \"src\" field"
msgstr ""
#: src/target.c:38
#: src/target.c:40
#, c-format
msgid "Failed to open the directory: %s"
msgstr ""
#: src/target.c:79
#: src/target.c:81
#, c-format
msgid "Source directory \"%s\" does not exist"
msgstr ""
#: src/target.c:118
msgid "Target details:\n"
msgstr ""
#: src/target.c:120
msgid "Description"
msgstr ""
#: src/util.c:115 src/util.c:126
#, c-format
msgid "Failed to create directory: %s"

View File

@ -2,11 +2,11 @@
#include <stdlib.h>
#include <string.h>
#include "paths.h"
#include "config.h"
#include "error.h"
#include "intl.h"
#include "log.h"
#include "paths.h"
#include "util.h"
bool config_contains_target(config_t *config, char *name) {

View File

@ -85,17 +85,48 @@ COPY:
if (!yesno(_("Do you want to continue?")))
goto END;
info(_("Checking all the targets"));
target_t *cur = repo_cfg.t_first;
while (NULL != cur) {
int counter = 0;
info(_("Checking all the targets"));
bar_init();
while (NULL != cur && ++counter > 0) {
if (!exists(cur->src)) {
bar_free();
error(_("Failed to access the source for the target \"%s\""), cur->name);
goto END;
}
cur = cur->next;
bar(counter, repo_cfg.t_len);
}
bar_free();
success(_("All the target checks were successful"));
cur = repo_cfg.t_first;
info(_("Copying all the targets"));
while (cur && ++counter > 0) {
target_print(cur);
if (!yesno(_("Install the target?"))) {
info(_("Skipping target"));
cur = cur->next;
continue;
}
if (!target_copy(cur, false)) {
error(_("Failed to copy the target:"));
details(errch);
goto END;
}
cur = cur->next;
}
success(_("All the targets are OK"));
ret = true;
END:
if (repo_cfg.name != NULL)

View File

@ -1,10 +1,12 @@
#include "target.h"
#include "error.h"
#include "intl.h"
#include "log.h"
#include "util.h"
#include <libgen.h>
#include <dirent.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -111,3 +113,10 @@ void target_free(target_t *t) {
free(t->src);
clist_free(&t->requires);
}
void target_print(target_t *t) {
info(_("Target details:\n"));
printf(COLOR_BOLD " %s " COLOR_RESET "=> %s\n", _("Name"), t->name);
printf(COLOR_BOLD " %s " COLOR_RESET "=> %s\n", _("Description"), t->desc);
printf("\n");
}

View File

@ -15,3 +15,4 @@ bool target_is_valid(target_t *);
void target_init(target_t *);
void target_free(target_t *);
bool target_copy(target_t *, bool);
void target_print(target_t *);