From 7b436c7e21f9100df21fd7aad1c61d2b54c181bb Mon Sep 17 00:00:00 2001 From: ngn Date: Thu, 15 Aug 2024 03:20:12 +0300 Subject: [PATCH] new: --skip-installed option for install command --- Makefile | 2 +- locale/tr/LC_MESSAGES/matt.po | 48 ++++++++++++++++++----------------- src/cmd/install.c | 10 ++++++-- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 46c9d03..16fe972 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ OBJS = $(patsubst src/%.c,dist/%.o,$(SRCS)) CFLAGS = -O3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection LIBS = -linih -lmp -VERSION = 24.00 +VERSION = 24.01 all: dist dist/matt $(PO_OUTS) diff --git a/locale/tr/LC_MESSAGES/matt.po b/locale/tr/LC_MESSAGES/matt.po index ef524ba..38e2290 100644 --- a/locale/tr/LC_MESSAGES/matt.po +++ b/locale/tr/LC_MESSAGES/matt.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\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" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -135,9 +135,10 @@ 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:43 src/cmd/install.c:44 -#: src/cmd/install.c:45 src/cmd/list.c:24 src/cmd/list.c:25 src/cmd/remove.c:31 -#: src/cmd/remove.c:32 src/cmd/update.c:38 +#: 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/update.c:38 #, c-format msgid " " msgstr " " @@ -162,11 +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: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 " 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 msgid "Unknown argument: " msgstr "" @@ -235,76 +237,76 @@ msgstr "Installed " msgid "Up-to-date " msgstr "Up-to-date " -#: src/cmd/install.c:42 +#: src/cmd/install.c:44 msgid "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?" msgstr "There are no avaliable pools, have you synced yet?" -#: src/cmd/install.c:69 +#: src/cmd/install.c:72 msgid "Specified " msgstr "" -#: src/cmd/install.c:79 +#: src/cmd/install.c:82 #, fuzzy msgid "Failed to load " 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 " msgstr "Failed to find " -#: src/cmd/install.c:104 +#: src/cmd/install.c:110 msgid "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)" 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 msgid "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 " 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 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: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?" 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" 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/update.c:104 msgid "(" 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 " 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 " msgstr "Failed to install " -#: src/cmd/install.c:180 +#: src/cmd/install.c:186 msgid "Installed " msgstr "Installed " -#: src/cmd/install.c:180 +#: src/cmd/install.c:186 msgid "Installed all of the " msgstr "Installed all of the " diff --git a/src/cmd/install.c b/src/cmd/install.c index a0c473d..c69c19c 100644 --- a/src/cmd/install.c +++ b/src/cmd/install.c @@ -26,10 +26,12 @@ 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, "continue"); args_split(args, "yes"); args_register(args, "ignore-depends"); + args_register(args, "skip-installed"); args_register(args, "continue"); 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")){ 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"--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")); return true; @@ -95,8 +98,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)){ - error(_("Package "FG_BOLD"%s"FG_RESET"_"FG_GREEN"%s"FG_RESET" is already installed"), name, pkg->data.version); - goto end; + 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); + goto end; + } + continue; } // resolve the package and depends