update: add pool name to info command

This commit is contained in:
ngn 2024-08-22 01:07:51 +03:00
parent 48bb4d7bb1
commit a7370423a6
2 changed files with 33 additions and 25 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-17 19:06+0300\n" "POT-Creation-Date: 2024-08-22 01:00+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -167,8 +167,8 @@ msgstr "To list different options, use commands with "
msgid "Here is a list of available global options:" msgid "Here is a list of available global options:"
msgstr "Here is a list of available global options:" msgstr "Here is a list of available global options:"
#: src/main.c:199 src/main.c:200 src/cmd/info.c:54 src/cmd/info.c:55 #: src/main.c:199 src/main.c:200 src/cmd/info.c:52 src/cmd/info.c:53
#: src/cmd/info.c:56 src/cmd/install.c:34 src/cmd/install.c:35 #: src/cmd/info.c:54 src/cmd/install.c:34 src/cmd/install.c:35
#: src/cmd/install.c:36 src/cmd/install.c:37 src/cmd/install.c:38 #: src/cmd/install.c:36 src/cmd/install.c:37 src/cmd/install.c:38
#: src/cmd/list.c:24 src/cmd/list.c:25 src/cmd/remove.c:28 src/cmd/remove.c:29 #: src/cmd/list.c:24 src/cmd/list.c:25 src/cmd/remove.c:28 src/cmd/remove.c:29
#: src/cmd/update.c:23 #: src/cmd/update.c:23
@ -196,75 +196,80 @@ msgstr "Failed to run the editor: %s"
msgid "Failed to open the editor: %s" msgid "Failed to open the editor: %s"
msgstr "Failed to open the editor: %s" msgstr "Failed to open the editor: %s"
#: src/cmd/info.c:19 src/cmd/info.c:29 src/cmd/install.c:91 src/cmd/remove.c:52 #: src/cmd/info.c:17 src/cmd/info.c:27 src/cmd/install.c:91 src/cmd/remove.c:52
msgid "Package " msgid "Package "
msgstr "Package " msgstr "Package "
#: src/cmd/info.c:48 src/cmd/install.c:28 src/cmd/list.c:18 src/cmd/remove.c:22 #: src/cmd/info.c:46 src/cmd/install.c:28 src/cmd/list.c:18 src/cmd/remove.c:22
#: src/cmd/sync.c:15 src/cmd/update.c:17 #: src/cmd/sync.c:15 src/cmd/update.c:17
msgid "Unknown argument: " msgid "Unknown argument: "
msgstr "Unknown argument: " msgstr "Unknown argument: "
#: src/cmd/info.c:53 src/cmd/list.c:23 #: src/cmd/info.c:51 src/cmd/list.c:23
msgid "Listing options for the list command:" msgid "Listing options for the list command:"
msgstr "Listing options for the list command:" msgstr "Listing options for the list command:"
#: src/cmd/info.c:76 #: src/cmd/info.c:75
msgid "Please specify only a single package name" msgid "Please specify only a single package name"
msgstr "Please specify only a single package name" msgstr "Please specify only a single package name"
#: src/cmd/info.c:83 #: src/cmd/info.c:82
msgid "Please specify a single package" msgid "Please specify a single package"
msgstr "Please specify a single package" msgstr "Please specify a single package"
#: src/cmd/info.c:98 #: src/cmd/info.c:97
msgid "Failed to get the changes file for " msgid "Failed to get the changes file for "
msgstr "Failed to get the changes file for " msgstr "Failed to get the changes file for "
#: src/cmd/info.c:104 #: src/cmd/info.c:103
msgid "Failed to access the changes file, is the package installed?" msgid "Failed to access the changes file, is the package installed?"
msgstr "Failed to access the changes file, is the package installed?" msgstr "Failed to access the changes file, is the package installed?"
#: src/cmd/info.c:111 #: src/cmd/info.c:110
msgid "Failed to get the depends list for " msgid "Failed to get the depends list for "
msgstr "Failed to get the depends list for " msgstr "Failed to get the depends list for "
#: src/cmd/info.c:138 #: src/cmd/info.c:137
#, c-format #, c-format
msgid "Name " msgid "Name "
msgstr "Name " msgstr "Name "
#: src/cmd/info.c:139 #: src/cmd/info.c:138
#, c-format #, c-format
msgid "Version " msgid "Version "
msgstr "Version " msgstr "Version "
#: src/cmd/info.c:140 #: src/cmd/info.c:139
#, c-format #, c-format
msgid "Desc " msgid "Desc "
msgstr "Desc " msgstr "Desc "
#: src/cmd/info.c:141 #: src/cmd/info.c:140
#, c-format #, c-format
msgid "Size " msgid "Size "
msgstr "Size " msgstr "Size "
#: src/cmd/info.c:144 #: src/cmd/info.c:143
#, c-format #, c-format
msgid "Depends " msgid "Depends "
msgstr "Depends " msgstr "Depends "
#: src/cmd/info.c:147 #: src/cmd/info.c:146
#, c-format #, c-format
msgid "Changes " msgid "Changes "
msgstr "Changes " msgstr "Changes "
#: src/cmd/info.c:151 src/cmd/info.c:152 #: src/cmd/info.c:149
#, fuzzy, c-format
msgid "Pool "
msgstr " "
#: src/cmd/info.c:152 src/cmd/info.c:153
#, c-format #, c-format
msgid "Installed " msgid "Installed "
msgstr "Installed " msgstr "Installed "
#: src/cmd/info.c:154 src/cmd/info.c:155 #: src/cmd/info.c:156 src/cmd/info.c:157
#, c-format #, c-format
msgid "Up-to-date " msgid "Up-to-date "
msgstr "Up-to-date " msgstr "Up-to-date "

View File

@ -11,16 +11,14 @@
#include "../cmd.h" #include "../cmd.h"
#include "../log.h" #include "../log.h"
lm_pkg_data_t *cmd_info_from_pool(lm_ctx_t *ctx, args_t *args, char *name){ lm_pkg_data_t *cmd_info_from_pool(lm_ctx_t *ctx, lm_pkg_t **pkgp, args_t *args, char *name){
lm_pkg_t *pkg = NULL; if((*pkgp = lm_ctx_pool_find(ctx, name, NULL)) == NULL){
if((pkg = lm_ctx_pool_find(ctx, name, NULL)) == NULL){
if(!args_get_bool(args, "grep") && LM_ERR_PkgNotFound == lm_error()) if(!args_get_bool(args, "grep") && LM_ERR_PkgNotFound == lm_error())
error(_("Package "FG_BOLD"%s"FG_RESET" not found"), name); error(_("Package "FG_BOLD"%s"FG_RESET" not found"), name);
return NULL; return NULL;
} }
return &pkg->data; return &(*pkgp)->data;
} }
lm_pkg_data_t *cmd_info_from_database(lm_ctx_t *ctx, lm_entry_t *entry, args_t *args, char *name){ lm_pkg_data_t *cmd_info_from_database(lm_ctx_t *ctx, lm_entry_t *entry, args_t *args, char *name){
@ -62,6 +60,7 @@ bool cmd_info(lm_ctx_t *ctx, config_t *config, args_t *args){
char *name = NULL, *depends = NULL, *changes = NULL; char *name = NULL, *depends = NULL, *changes = NULL;
lm_pkg_data_t *data = NULL; lm_pkg_data_t *data = NULL;
lm_pkg_t *pkg = NULL;
lm_entry_t ent; lm_entry_t ent;
for(size_t i = 1; i < args->count; i++){ for(size_t i = 1; i < args->count; i++){
@ -90,7 +89,7 @@ bool cmd_info(lm_ctx_t *ctx, config_t *config, args_t *args){
} }
else if(!args_get_bool(args, "database")){ else if(!args_get_bool(args, "database")){
if((data = cmd_info_from_pool(ctx, args, name)) == NULL) if((data = cmd_info_from_pool(ctx, &pkg, args, name)) == NULL)
return false; return false;
} }
@ -125,6 +124,7 @@ bool cmd_info(lm_ctx_t *ctx, config_t *config, args_t *args){
printf("CHANGES:%s\n", changes); printf("CHANGES:%s\n", changes);
if(!args_get_bool(args, "database")){ if(!args_get_bool(args, "database")){
printf("POOL:%s\n", pkg->pool->name);
printf("INSTALLED:%d\n", lm_ctx_database_is_installed(ctx, data->name, NULL)); printf("INSTALLED:%d\n", lm_ctx_database_is_installed(ctx, data->name, NULL));
printf("UPTODATE:%d\n", lm_ctx_database_is_installed(ctx, data->name, data->version)); printf("UPTODATE:%d\n", lm_ctx_database_is_installed(ctx, data->name, data->version));
} }
@ -147,9 +147,12 @@ bool cmd_info(lm_ctx_t *ctx, config_t *config, args_t *args){
printf(_(FG_BOLD"Changes "FG_BLUE"=>"FG_RESET" %s\n"), changes); printf(_(FG_BOLD"Changes "FG_BLUE"=>"FG_RESET" %s\n"), changes);
if(!args_get_bool(args, "database")){ if(!args_get_bool(args, "database")){
printf(_(FG_BOLD"Pool "FG_BLUE"=>"FG_RESET" %s\n"), pkg->pool->name);
printf(lm_ctx_database_is_installed(ctx, data->name, NULL) ? printf(lm_ctx_database_is_installed(ctx, data->name, NULL) ?
_(FG_BOLD"Installed "FG_BLUE"=>"FG_RESET" "FG_GREEN"yes"FG_RESET"\n") : _(FG_BOLD"Installed "FG_BLUE"=>"FG_RESET" "FG_GREEN"yes"FG_RESET"\n") :
_(FG_BOLD"Installed "FG_BLUE"=>"FG_RESET" "FG_RED"no"FG_RESET"\n")); _(FG_BOLD"Installed "FG_BLUE"=>"FG_RESET" "FG_RED"no"FG_RESET"\n"));
printf(lm_ctx_database_is_installed(ctx, data->name, data->version) ? printf(lm_ctx_database_is_installed(ctx, data->name, data->version) ?
_(FG_BOLD"Up-to-date "FG_BLUE"=>"FG_RESET" "FG_GREEN"yes"FG_RESET"\n") : _(FG_BOLD"Up-to-date "FG_BLUE"=>"FG_RESET" "FG_GREEN"yes"FG_RESET"\n") :
_(FG_BOLD"Up-to-date "FG_BLUE"=>"FG_RESET" "FG_RED"no"FG_RESET"\n")); _(FG_BOLD"Up-to-date "FG_BLUE"=>"FG_RESET" "FG_RED"no"FG_RESET"\n"));