new: --ignore-none option

This commit is contained in:
ngn 2024-08-15 03:58:05 +03:00
parent 7b436c7e21
commit 04b3e3c8ef
3 changed files with 55 additions and 47 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-15 03:18+0300\n"
"POT-Creation-Date: 2024-08-15 03:57+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -135,9 +135,9 @@ msgid "Here is a list of available global options:"
msgstr "Here is a list of available global options:"
#: src/main.c:177 src/main.c:178 src/cmd/info.c:54 src/cmd/info.c:55
#: src/cmd/info.c:56 src/cmd/install.c:45 src/cmd/install.c:46
#: src/cmd/install.c:47 src/cmd/install.c:48 src/cmd/list.c:24
#: src/cmd/list.c:25 src/cmd/remove.c:31 src/cmd/remove.c:32
#: src/cmd/info.c:56 src/cmd/install.c:47 src/cmd/install.c:48
#: src/cmd/install.c:49 src/cmd/install.c:50 src/cmd/install.c:51
#: src/cmd/list.c:24 src/cmd/list.c:25 src/cmd/remove.c:32 src/cmd/remove.c:33
#: src/cmd/update.c:38
#, c-format
msgid " "
@ -163,12 +163,12 @@ msgstr "Failed to run the editor: %s"
msgid "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:102
#: src/cmd/remove.c:53
#: src/cmd/info.c:19 src/cmd/info.c:29 src/cmd/install.c:104
#: src/cmd/remove.c:56
msgid "Package "
msgstr "Package "
#: src/cmd/info.c:48 src/cmd/install.c:39 src/cmd/list.c:18 src/cmd/remove.c:25
#: src/cmd/info.c:48 src/cmd/install.c:41 src/cmd/list.c:18 src/cmd/remove.c:26
#: src/cmd/sync.c:48 src/cmd/update.c:32
msgid "Unknown argument: "
msgstr ""
@ -237,76 +237,76 @@ msgstr "Installed "
msgid "Up-to-date "
msgstr "Up-to-date "
#: src/cmd/install.c:44
#: src/cmd/install.c:46
msgid "Listing options for the install command:"
msgstr "Listing options for the install command:"
#: src/cmd/install.c:53 src/cmd/update.c:43
#: src/cmd/install.c:56 src/cmd/update.c:43
msgid "There are no avaliable pools, have you synced yet?"
msgstr "There are no avaliable pools, have you synced yet?"
#: src/cmd/install.c:72
#: src/cmd/install.c:75
msgid "Specified "
msgstr ""
#: src/cmd/install.c:82
#: src/cmd/install.c:85
#, fuzzy
msgid "Failed to load "
msgstr "Failed to download "
#: src/cmd/install.c:92 src/cmd/remove.c:55
#: src/cmd/install.c:95 src/cmd/remove.c:58
msgid "Failed to find "
msgstr "Failed to find "
#: src/cmd/install.c:110
#: src/cmd/install.c:113
msgid "Failed to resolve "
msgstr "Failed to resolve "
#: src/cmd/install.c:116
#: src/cmd/install.c:122
msgid "Nothing to do (no packages to install)"
msgstr "Nothing to do (no packages to install)"
#: src/cmd/install.c:125 src/cmd/install.c:127 src/cmd/remove.c:75
#: src/cmd/remove.c:77 src/cmd/update.c:64 src/cmd/update.c:66
#: src/cmd/install.c:131 src/cmd/install.c:133 src/cmd/remove.c:78
#: src/cmd/remove.c:80 src/cmd/update.c:64 src/cmd/update.c:66
msgid "Following "
msgstr "Following "
#: src/cmd/install.c:133 src/cmd/remove.c:84
#: src/cmd/install.c:139 src/cmd/remove.c:87
msgid "Total of "
msgstr "Total of "
#: src/cmd/install.c:136 src/cmd/update.c:73
#: src/cmd/install.c:142 src/cmd/update.c:73
#, c-format
msgid "Root directory is modified, install scripts will be saved in %s"
msgstr "Root directory is modified, install scripts will be saved in %s"
#: src/cmd/install.c:138 src/cmd/remove.c:85 src/cmd/update.c:75
#: src/cmd/install.c:144 src/cmd/remove.c:88 src/cmd/update.c:75
msgid "Continue?"
msgstr "Continue?"
#: src/cmd/install.c:139 src/cmd/remove.c:86 src/cmd/update.c:76
#: src/cmd/install.c:145 src/cmd/remove.c:89 src/cmd/update.c:76
msgid "Operation cancelled"
msgstr "Operation cancelled"
#: src/cmd/install.c:155 src/cmd/install.c:159 src/cmd/install.c:174
#: src/cmd/remove.c:93 src/cmd/update.c:86 src/cmd/update.c:95
#: src/cmd/install.c:161 src/cmd/install.c:165 src/cmd/install.c:180
#: src/cmd/remove.c:96 src/cmd/update.c:86 src/cmd/update.c:95
#: src/cmd/update.c:104
msgid "("
msgstr "("
#: src/cmd/install.c:165 src/cmd/update.c:91
#: src/cmd/install.c:171 src/cmd/update.c:91
msgid "Failed to download "
msgstr "Failed to download "
#: src/cmd/install.c:180 src/cmd/update.c:109
#: src/cmd/install.c:186 src/cmd/update.c:109
msgid "Failed to install "
msgstr "Failed to install "
#: src/cmd/install.c:186
#: src/cmd/install.c:192
msgid "Installed "
msgstr "Installed "
#: src/cmd/install.c:186
#: src/cmd/install.c:192
msgid "Installed all of the "
msgstr "Installed all of the "
@ -318,27 +318,23 @@ msgstr "There no installed packages"
msgid "Listing "
msgstr "Listing "
#: src/cmd/remove.c:30
#: src/cmd/remove.c:31
msgid "Listing options for the remove command:"
msgstr "Listing options for the remove command:"
#: src/cmd/remove.c:60
msgid "Cannot remove "
msgstr "Cannot remove "
#: src/cmd/remove.c:68
msgid "Nothing to do (no packages to remove)"
msgstr "Nothing to do (no packages to remove)"
#: src/cmd/remove.c:99 src/cmd/update.c:100
#: src/cmd/remove.c:63 src/cmd/remove.c:102 src/cmd/update.c:100
msgid "Failed to remove "
msgstr "Failed to remove "
#: src/cmd/remove.c:105
#: src/cmd/remove.c:71
msgid "Nothing to do (no packages to remove)"
msgstr "Nothing to do (no packages to remove)"
#: src/cmd/remove.c:108
msgid "Removed "
msgstr "Removed "
#: src/cmd/remove.c:105
#: src/cmd/remove.c:108
msgid "Removed all of the "
msgstr "Removed all of the "
@ -376,6 +372,9 @@ msgstr "All packages are up-to-date"
msgid "Failed to update "
msgstr "Failed to update "
#~ msgid "Cannot remove "
#~ msgstr "Cannot remove "
#, c-format
#~ msgid "Failed to sync %s: %s"
#~ msgstr "Failed to sync %s: %s"

View File

@ -26,13 +26,15 @@ bool cmd_install(lm_ctx_t *ctx, config_t *config, args_t *args){
char *arg = NULL;
args_split(args, "ignore-depends");
args_split(args, "skip-installed");
args_split(args, "ignore-none");
args_split(args, "continue");
args_split(args, "skip");
args_split(args, "yes");
args_register(args, "ignore-depends");
args_register(args, "skip-installed");
args_register(args, "ignore-none");
args_register(args, "continue");
args_register(args, "skip");
args_register(args, "yes");
if((arg = args_register_check(args)) != NULL){
@ -43,8 +45,9 @@ bool cmd_install(lm_ctx_t *ctx, config_t *config, args_t *args){
if(args_get_bool(args, "help")){
info(_("Listing options for the install command:"));
printf(_(" "FG_BOLD"--ignore-depends"FG_RESET":\tignore package dependencies\n"));
printf(_(" "FG_BOLD"--skip-installed"FG_RESET":\tskip if a package is already installed\n"));
printf(_(" "FG_BOLD"--ignore-none"FG_RESET":\tignore if there is nothing do\n"));
printf(_(" "FG_BOLD"--continue"FG_RESET":\t\tcontinue even if package is not found\n"));
printf(_(" "FG_BOLD"--skip"FG_RESET":\t\tskip if a package is already installed\n"));
printf(_(" "FG_BOLD"--yes"FG_RESET":\t\tdon't ask for confirmation\n"));
return true;
}
@ -98,11 +101,11 @@ bool cmd_install(lm_ctx_t *ctx, config_t *config, args_t *args){
resolve:
if(lm_ctx_database_is_installed(ctx, pkg->data.name, pkg->data.version)){
if(!args_get_bool(args, "skip-installed")){
error(_("Package "FG_BOLD"%s"FG_RESET"_"FG_GREEN"%s"FG_RESET" is already installed"), name, pkg->data.version);
error(_("Package "FG_BOLD"%s"FG_RESET"_"FG_GREEN"%s"FG_RESET" is already installed"), name, pkg->data.version);
if(args_get_bool(args, "skip"))
continue;
else
goto end;
}
continue;
}
// resolve the package and depends
@ -113,7 +116,10 @@ bool cmd_install(lm_ctx_t *ctx, config_t *config, args_t *args){
}
if(NULL == list){
error(_("Nothing to do (no packages to install)"));
if(args_get_bool(args, "ignore-none"))
ret = true;
else
error(_("Nothing to do (no packages to install)"));
goto end;
}

View File

@ -1,4 +1,5 @@
#include <libmp/all.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@ -48,6 +49,8 @@ bool cmd_remove(lm_ctx_t *ctx, config_t *config, args_t *args){
else
pkgs = realloc(pkgs, sizeof(lm_pkg_t)*(count+1));
bzero(&pkgs[count], sizeof(lm_pkg_t));
if(!lm_ctx_database_find(ctx, &pkgs[count++], name, NULL)){
if(lm_error() == LM_ERR_DbSqlNotFound)
error(_("Package "FG_BOLD"%s"FG_RESET" is not installed"), name);
@ -57,7 +60,7 @@ bool cmd_remove(lm_ctx_t *ctx, config_t *config, args_t *args){
}
if(!lm_ctx_removeable(ctx, &pkgs[count-1])){
error(_("Cannot remove "FG_BOLD"%s"FG_RESET"_"FG_BOLD FG_GREEN"%s"FG_RESET": %s"), pkgs[count-1].name, pkgs[count-1].version, lm_strerror());
error(_("Failed to remove "FG_BOLD"%s"FG_RESET"_"FG_BOLD FG_GREEN"%s"FG_RESET": %s"), pkgs[count-1].name, pkgs[count-1].version, lm_strerror());
goto end;
}