new: --skip-installed option for install command

This commit is contained in:
ngn 2024-08-15 03:20:12 +03:00
parent 70ff290c1f
commit 7b436c7e21
3 changed files with 34 additions and 26 deletions

View File

@ -11,7 +11,7 @@ OBJS = $(patsubst src/%.c,dist/%.o,$(SRCS))
CFLAGS = -O3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection CFLAGS = -O3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection
LIBS = -linih -lmp LIBS = -linih -lmp
VERSION = 24.00 VERSION = 24.01
all: dist dist/matt $(PO_OUTS) all: dist dist/matt $(PO_OUTS)

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-12 04:30+0300\n" "POT-Creation-Date: 2024-08-15 03:18+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"
@ -135,9 +135,10 @@ 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:177 src/main.c:178 src/cmd/info.c:54 src/cmd/info.c:55 #: 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:43 src/cmd/install.c:44 #: src/cmd/info.c:56 src/cmd/install.c:45 src/cmd/install.c:46
#: src/cmd/install.c:45 src/cmd/list.c:24 src/cmd/list.c:25 src/cmd/remove.c:31 #: src/cmd/install.c:47 src/cmd/install.c:48 src/cmd/list.c:24
#: src/cmd/remove.c:32 src/cmd/update.c:38 #: src/cmd/list.c:25 src/cmd/remove.c:31 src/cmd/remove.c:32
#: src/cmd/update.c:38
#, c-format #, c-format
msgid " " msgid " "
msgstr " " msgstr " "
@ -162,11 +163,12 @@ 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:98 src/cmd/remove.c:53 #: src/cmd/info.c:19 src/cmd/info.c:29 src/cmd/install.c:102
#: src/cmd/remove.c:53
msgid "Package " msgid "Package "
msgstr "Package " msgstr "Package "
#: src/cmd/info.c:48 src/cmd/install.c:37 src/cmd/list.c:18 src/cmd/remove.c:25 #: src/cmd/info.c:48 src/cmd/install.c:39 src/cmd/list.c:18 src/cmd/remove.c:25
#: src/cmd/sync.c:48 src/cmd/update.c:32 #: src/cmd/sync.c:48 src/cmd/update.c:32
msgid "Unknown argument: " msgid "Unknown argument: "
msgstr "" msgstr ""
@ -235,76 +237,76 @@ msgstr "Installed "
msgid "Up-to-date " msgid "Up-to-date "
msgstr "Up-to-date " msgstr "Up-to-date "
#: src/cmd/install.c:42 #: src/cmd/install.c:44
msgid "Listing options for the install command:" msgid "Listing options for the install command:"
msgstr "Listing options for the install command:" msgstr "Listing options for the install command:"
#: src/cmd/install.c:50 src/cmd/update.c:43 #: src/cmd/install.c:53 src/cmd/update.c:43
msgid "There are no avaliable pools, have you synced yet?" msgid "There are no avaliable pools, have you synced yet?"
msgstr "There are no avaliable pools, have you synced yet?" msgstr "There are no avaliable pools, have you synced yet?"
#: src/cmd/install.c:69 #: src/cmd/install.c:72
msgid "Specified " msgid "Specified "
msgstr "" msgstr ""
#: src/cmd/install.c:79 #: src/cmd/install.c:82
#, fuzzy #, fuzzy
msgid "Failed to load " msgid "Failed to load "
msgstr "Failed to download " msgstr "Failed to download "
#: src/cmd/install.c:89 src/cmd/remove.c:55 #: src/cmd/install.c:92 src/cmd/remove.c:55
msgid "Failed to find " msgid "Failed to find "
msgstr "Failed to find " msgstr "Failed to find "
#: src/cmd/install.c:104 #: src/cmd/install.c:110
msgid "Failed to resolve " msgid "Failed to resolve "
msgstr "Failed to resolve " msgstr "Failed to resolve "
#: src/cmd/install.c:110 #: src/cmd/install.c:116
msgid "Nothing to do (no packages to install)" msgid "Nothing to do (no packages to install)"
msgstr "Nothing to do (no packages to install)" msgstr "Nothing to do (no packages to install)"
#: src/cmd/install.c:119 src/cmd/install.c:121 src/cmd/remove.c:75 #: 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/remove.c:77 src/cmd/update.c:64 src/cmd/update.c:66
msgid "Following " msgid "Following "
msgstr "Following " msgstr "Following "
#: src/cmd/install.c:127 src/cmd/remove.c:84 #: src/cmd/install.c:133 src/cmd/remove.c:84
msgid "Total of " msgid "Total of "
msgstr "Total of " msgstr "Total of "
#: src/cmd/install.c:130 src/cmd/update.c:73 #: src/cmd/install.c:136 src/cmd/update.c:73
#, c-format #, c-format
msgid "Root directory is modified, install scripts will be saved in %s" msgid "Root directory is modified, install scripts will be saved in %s"
msgstr "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:132 src/cmd/remove.c:85 src/cmd/update.c:75 #: src/cmd/install.c:138 src/cmd/remove.c:85 src/cmd/update.c:75
msgid "Continue?" msgid "Continue?"
msgstr "Continue?" msgstr "Continue?"
#: src/cmd/install.c:133 src/cmd/remove.c:86 src/cmd/update.c:76 #: src/cmd/install.c:139 src/cmd/remove.c:86 src/cmd/update.c:76
msgid "Operation cancelled" msgid "Operation cancelled"
msgstr "Operation cancelled" msgstr "Operation cancelled"
#: src/cmd/install.c:149 src/cmd/install.c:153 src/cmd/install.c:168 #: 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/remove.c:93 src/cmd/update.c:86 src/cmd/update.c:95
#: src/cmd/update.c:104 #: src/cmd/update.c:104
msgid "(" msgid "("
msgstr "(" msgstr "("
#: src/cmd/install.c:159 src/cmd/update.c:91 #: src/cmd/install.c:165 src/cmd/update.c:91
msgid "Failed to download " msgid "Failed to download "
msgstr "Failed to download " msgstr "Failed to download "
#: src/cmd/install.c:174 src/cmd/update.c:109 #: src/cmd/install.c:180 src/cmd/update.c:109
msgid "Failed to install " msgid "Failed to install "
msgstr "Failed to install " msgstr "Failed to install "
#: src/cmd/install.c:180 #: src/cmd/install.c:186
msgid "Installed " msgid "Installed "
msgstr "Installed " msgstr "Installed "
#: src/cmd/install.c:180 #: src/cmd/install.c:186
msgid "Installed all of the " msgid "Installed all of the "
msgstr "Installed all of the " msgstr "Installed all of the "

View File

@ -26,10 +26,12 @@ bool cmd_install(lm_ctx_t *ctx, config_t *config, args_t *args){
char *arg = NULL; char *arg = NULL;
args_split(args, "ignore-depends"); args_split(args, "ignore-depends");
args_split(args, "skip-installed");
args_split(args, "continue"); args_split(args, "continue");
args_split(args, "yes"); args_split(args, "yes");
args_register(args, "ignore-depends"); args_register(args, "ignore-depends");
args_register(args, "skip-installed");
args_register(args, "continue"); args_register(args, "continue");
args_register(args, "yes"); args_register(args, "yes");
@ -41,6 +43,7 @@ bool cmd_install(lm_ctx_t *ctx, config_t *config, args_t *args){
if(args_get_bool(args, "help")){ if(args_get_bool(args, "help")){
info(_("Listing options for the install command:")); info(_("Listing options for the install command:"));
printf(_(" "FG_BOLD"--ignore-depends"FG_RESET":\tignore package dependencies\n")); 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"--continue"FG_RESET":\t\tcontinue even if package is not found\n")); printf(_(" "FG_BOLD"--continue"FG_RESET":\t\tcontinue even if package is not found\n"));
printf(_(" "FG_BOLD"--yes"FG_RESET":\t\tdon't ask for confirmation\n")); printf(_(" "FG_BOLD"--yes"FG_RESET":\t\tdon't ask for confirmation\n"));
return true; return true;
@ -95,8 +98,11 @@ bool cmd_install(lm_ctx_t *ctx, config_t *config, args_t *args){
resolve: resolve:
if(lm_ctx_database_is_installed(ctx, pkg->data.name, pkg->data.version)){ if(lm_ctx_database_is_installed(ctx, pkg->data.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-installed")){
goto end; error(_("Package "FG_BOLD"%s"FG_RESET"_"FG_GREEN"%s"FG_RESET" is already installed"), name, pkg->data.version);
goto end;
}
continue;
} }
// resolve the package and depends // resolve the package and depends