From beebf28aa4477f616b497b869b9ab1a0f6de5dd6 Mon Sep 17 00:00:00 2001 From: ngn Date: Sun, 5 May 2024 20:16:29 +0300 Subject: [PATCH] new: Add support for the desc field --- locale/tr/LC_MESSAGES/mc.po | 22 +++++++++++++--------- src/config.c | 8 ++++++++ src/config.h | 1 + 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/locale/tr/LC_MESSAGES/mc.po b/locale/tr/LC_MESSAGES/mc.po index f9271a7..62148d0 100644 --- a/locale/tr/LC_MESSAGES/mc.po +++ b/locale/tr/LC_MESSAGES/mc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-04 22:36+0300\n" +"POT-Creation-Date: 2024-05-05 20:10+0300\n" "PO-Revision-Date: 2024-05-01 13:34+0300\n" "Last-Translator: \n" "Language-Team: Turkish \n" @@ -29,36 +29,40 @@ msgstr "" msgid "Configuration does not have any targets" msgstr "" -#: src/config.c:92 +#: src/config.c:95 msgid "Configuration contains multiple targets with the same name" msgstr "" -#: src/config.c:119 +#: src/config.c:122 #, c-format msgid "Key %s is unknown" msgstr "" -#: src/config.c:149 +#: src/config.c:154 msgid "Configuration file not found" msgstr "" -#: src/config.c:164 +#: src/config.c:170 msgid "Failed to parse configuration file" msgstr "" -#: src/config.c:180 +#: src/config.c:186 msgid "Configuration details:\n" msgstr "" -#: src/config.c:181 src/target.c:122 +#: src/config.c:187 src/target.c:122 msgid "Name" msgstr "" -#: src/config.c:182 +#: src/config.c:189 +msgid "Desc" +msgstr "" + +#: src/config.c:190 msgid "Author" msgstr "" -#: src/config.c:184 +#: src/config.c:192 msgid "Keywords" msgstr "" diff --git a/src/config.c b/src/config.c index c0b2532..c3ad1a0 100644 --- a/src/config.c +++ b/src/config.c @@ -81,6 +81,9 @@ int config_handler(void *data, const char *section, const char *key, const char } else if (MATCH("details", "keywords")) { clist_from_str(&config->keywords, (char *)value); return 1; + } else if (MATCH("details", "desc")) { + config->desc = strdup(value); + return 1; } else if (eq((char *)section, "details")) { goto UNKNOWN; return 1; @@ -123,6 +126,7 @@ UNKNOWN: void config_free(config_t *config) { free(config->name); + free(config->desc); free(config->author); target_t *cur = config->t_first, *prev = NULL; @@ -137,6 +141,7 @@ void config_free(config_t *config) { clist_free(&config->keywords); config->name = NULL; + config->desc = NULL; config->author = NULL; config->t_first = NULL; config->t_last = NULL; @@ -152,6 +157,7 @@ bool config_load(config_t *config, char *path) { } config->name = NULL; + config->desc = NULL; config->author = NULL; config->t_first = NULL; config->t_last = NULL; @@ -179,6 +185,8 @@ bool config_load(config_t *config, char *path) { void config_print(config_t *config) { info(_("Configuration details:\n")); printf(COLOR_BOLD " %s " COLOR_RESET "=> %s\n", _("Name"), config->name); + if(NULL != config->desc) + printf(COLOR_BOLD " %s " COLOR_RESET "=> %s\n", _("Desc"), config->desc); printf(COLOR_BOLD " %s " COLOR_RESET "=> %s\n", _("Author"), config->author); printf(COLOR_BOLD " %s " COLOR_RESET "=> ", _("Keywords")); diff --git a/src/config.h b/src/config.h index 2b8eaeb..242e78c 100644 --- a/src/config.h +++ b/src/config.h @@ -10,6 +10,7 @@ typedef struct config { size_t t_len; char *name; + char *desc; char *author; clist_t keywords; } config_t;