new: print unknown arguments
This commit is contained in:
parent
ba9d1d4fc2
commit
c7d969395f
@ -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-11 01:49+0300\n"
|
"POT-Creation-Date: 2024-08-12 03:53+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"
|
||||||
@ -73,76 +73,76 @@ msgstr "Please answer with y/n"
|
|||||||
msgid "Received a segfault"
|
msgid "Received a segfault"
|
||||||
msgstr "Received a segfault"
|
msgstr "Received a segfault"
|
||||||
|
|
||||||
#: src/main.c:97
|
#: src/main.c:100
|
||||||
msgid "Failed to access the root directory, are you running as root?"
|
msgid "Failed to access the root directory, are you running as root?"
|
||||||
msgstr "Failed to access the root directory, are you running as root?"
|
msgstr "Failed to access the root directory, are you running as root?"
|
||||||
|
|
||||||
#: src/main.c:101
|
#: src/main.c:104
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "Failed to access the data directory ("
|
msgid "Failed to access the data directory ("
|
||||||
msgstr "Failed to access the configuration file: %s"
|
msgstr "Failed to access the configuration file: %s"
|
||||||
|
|
||||||
#: src/main.c:105
|
#: src/main.c:108
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "Failed to access the temp directory ("
|
msgid "Failed to access the temp directory ("
|
||||||
msgstr "Failed to open the editor: %s"
|
msgstr "Failed to open the editor: %s"
|
||||||
|
|
||||||
#: src/main.c:109
|
#: src/main.c:112
|
||||||
#, fuzzy, c-format
|
#, fuzzy, c-format
|
||||||
msgid "Failed to initialize libmp context: %s"
|
msgid "Failed to initialize libmp context: %s"
|
||||||
msgstr "Failed to install "
|
msgstr "Failed to install "
|
||||||
|
|
||||||
#: src/main.c:120
|
#: src/main.c:123
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "Failed to create the pools directory ("
|
msgid "Failed to create the pools directory ("
|
||||||
msgstr "Failed to open the editor: %s"
|
msgstr "Failed to open the editor: %s"
|
||||||
|
|
||||||
#: src/main.c:130
|
#: src/main.c:133
|
||||||
msgid "Failed to add pool "
|
msgid "Failed to add pool "
|
||||||
msgstr "Failed to add pool "
|
msgstr "Failed to add pool "
|
||||||
|
|
||||||
#: src/main.c:144
|
#: src/main.c:147
|
||||||
msgid "Failed to lock, matt is already running"
|
msgid "Failed to lock, matt is already running"
|
||||||
msgstr "Failed to lock, matt is already running"
|
msgstr "Failed to lock, matt is already running"
|
||||||
|
|
||||||
#: src/main.c:148
|
#: src/main.c:151
|
||||||
msgid "Failed to lock, are you root?"
|
msgid "Failed to lock, are you root?"
|
||||||
msgstr "Failed to lock, are you root?"
|
msgstr "Failed to lock, are you root?"
|
||||||
|
|
||||||
#: src/main.c:159
|
#: src/main.c:162
|
||||||
msgid "Command not found: "
|
msgid "Command not found: "
|
||||||
msgstr "Command not found: "
|
msgstr "Command not found: "
|
||||||
|
|
||||||
#: src/main.c:161
|
#: src/main.c:164
|
||||||
#, fuzzy, c-format
|
#, fuzzy, c-format
|
||||||
msgid "MatterLinux package manager %s (libmp %s)"
|
msgid "MatterLinux package manager %s (libmp %s)"
|
||||||
msgstr "MatterLinux package manager (version %s)"
|
msgstr "MatterLinux package manager (version %s)"
|
||||||
|
|
||||||
#: src/main.c:162
|
#: src/main.c:165
|
||||||
msgid "Usage: "
|
msgid "Usage: "
|
||||||
msgstr "Usage: "
|
msgstr "Usage: "
|
||||||
|
|
||||||
#: src/main.c:164
|
#: src/main.c:167
|
||||||
msgid "Here is a list of available commands:"
|
msgid "Here is a list of available commands:"
|
||||||
msgstr "Here is a list of available commands:"
|
msgstr "Here is a list of available commands:"
|
||||||
|
|
||||||
#: src/main.c:170
|
#: src/main.c:173
|
||||||
msgid "To list different options, use commands with "
|
msgid "To list different options, use commands with "
|
||||||
msgstr "To list different options, use commands with "
|
msgstr "To list different options, use commands with "
|
||||||
|
|
||||||
#: src/main.c:171
|
#: src/main.c:174
|
||||||
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:174 src/main.c:175 src/cmd/info.c:43 src/cmd/info.c:44
|
#: src/main.c:177 src/main.c:178 src/cmd/info.c:54 src/cmd/info.c:55
|
||||||
#: src/cmd/info.c:45 src/cmd/install.c:32 src/cmd/install.c:33
|
#: src/cmd/info.c:56 src/cmd/install.c:43 src/cmd/install.c:44
|
||||||
#: src/cmd/install.c:34 src/cmd/list.c:14 src/cmd/list.c:15 src/cmd/remove.c:21
|
#: src/cmd/install.c:45 src/cmd/list.c:24 src/cmd/list.c:25 src/cmd/remove.c:31
|
||||||
#: src/cmd/remove.c:22 src/cmd/update.c:30
|
#: src/cmd/remove.c:32 src/cmd/update.c:38
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid " "
|
msgid " "
|
||||||
msgstr " "
|
msgstr " "
|
||||||
|
|
||||||
#: src/main.c:177
|
#: src/main.c:180
|
||||||
msgid ""
|
msgid ""
|
||||||
"Licensed under GPLv3, see https://www.gnu.org/licenses/ for more information"
|
"Licensed under GPLv3, see https://www.gnu.org/licenses/ for more information"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -162,176 +162,181 @@ 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:87 src/cmd/remove.c:43
|
#: src/cmd/info.c:19 src/cmd/info.c:29 src/cmd/install.c:98 src/cmd/remove.c:53
|
||||||
msgid "Package "
|
msgid "Package "
|
||||||
msgstr "Package "
|
msgstr "Package "
|
||||||
|
|
||||||
#: src/cmd/info.c:42 src/cmd/list.c:13
|
#: src/cmd/info.c:48 src/cmd/install.c:37 src/cmd/list.c:18 src/cmd/remove.c:25
|
||||||
|
#: src/cmd/sync.c:48 src/cmd/update.c:32
|
||||||
|
msgid "Unknown argument: "
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/cmd/info.c:53 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:65
|
#: src/cmd/info.c:76
|
||||||
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:72
|
#: src/cmd/info.c:83
|
||||||
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:87
|
#: src/cmd/info.c:98
|
||||||
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:93
|
#: src/cmd/info.c:104
|
||||||
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:100
|
#: src/cmd/info.c:111
|
||||||
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:127
|
#: src/cmd/info.c:138
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Name "
|
msgid "Name "
|
||||||
msgstr "Name "
|
msgstr "Name "
|
||||||
|
|
||||||
#: src/cmd/info.c:128
|
#: src/cmd/info.c:139
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Version "
|
msgid "Version "
|
||||||
msgstr "Version "
|
msgstr "Version "
|
||||||
|
|
||||||
#: src/cmd/info.c:129
|
#: src/cmd/info.c:140
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Desc "
|
msgid "Desc "
|
||||||
msgstr "Desc "
|
msgstr "Desc "
|
||||||
|
|
||||||
#: src/cmd/info.c:130
|
#: src/cmd/info.c:141
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Size "
|
msgid "Size "
|
||||||
msgstr "Size "
|
msgstr "Size "
|
||||||
|
|
||||||
#: src/cmd/info.c:133
|
#: src/cmd/info.c:144
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Depends "
|
msgid "Depends "
|
||||||
msgstr "Depends "
|
msgstr "Depends "
|
||||||
|
|
||||||
#: src/cmd/info.c:136
|
#: src/cmd/info.c:147
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Changes "
|
msgid "Changes "
|
||||||
msgstr "Changes "
|
msgstr "Changes "
|
||||||
|
|
||||||
#: src/cmd/info.c:140 src/cmd/info.c:141
|
#: src/cmd/info.c:151 src/cmd/info.c:152
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Installed "
|
msgid "Installed "
|
||||||
msgstr "Installed "
|
msgstr "Installed "
|
||||||
|
|
||||||
#: src/cmd/info.c:143 src/cmd/info.c:144
|
#: src/cmd/info.c:154 src/cmd/info.c:155
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Up-to-date "
|
msgid "Up-to-date "
|
||||||
msgstr "Up-to-date "
|
msgstr "Up-to-date "
|
||||||
|
|
||||||
#: src/cmd/install.c:31
|
#: src/cmd/install.c:42
|
||||||
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:39 src/cmd/update.c:35
|
#: src/cmd/install.c:50 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:58
|
#: src/cmd/install.c:69
|
||||||
msgid "Specified "
|
msgid "Specified "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/cmd/install.c:68
|
#: src/cmd/install.c:79
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "Failed to load "
|
msgid "Failed to load "
|
||||||
msgstr "Failed to download "
|
msgstr "Failed to download "
|
||||||
|
|
||||||
#: src/cmd/install.c:78 src/cmd/remove.c:45
|
#: src/cmd/install.c:89 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:93
|
#: src/cmd/install.c:104
|
||||||
msgid "Failed to resolve "
|
msgid "Failed to resolve "
|
||||||
msgstr "Failed to resolve "
|
msgstr "Failed to resolve "
|
||||||
|
|
||||||
#: src/cmd/install.c:99
|
#: src/cmd/install.c:110
|
||||||
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:108 src/cmd/install.c:110 src/cmd/remove.c:65
|
#: src/cmd/install.c:119 src/cmd/install.c:121 src/cmd/remove.c:75
|
||||||
#: src/cmd/remove.c:67 src/cmd/update.c:56 src/cmd/update.c:58
|
#: 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:116 src/cmd/remove.c:74
|
#: src/cmd/install.c:127 src/cmd/remove.c:84
|
||||||
msgid "Total of "
|
msgid "Total of "
|
||||||
msgstr "Total of "
|
msgstr "Total of "
|
||||||
|
|
||||||
#: src/cmd/install.c:119 src/cmd/update.c:65
|
#: src/cmd/install.c:130 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:121 src/cmd/remove.c:75 src/cmd/update.c:67
|
#: src/cmd/install.c:132 src/cmd/remove.c:85 src/cmd/update.c:75
|
||||||
msgid "Continue?"
|
msgid "Continue?"
|
||||||
msgstr "Continue?"
|
msgstr "Continue?"
|
||||||
|
|
||||||
#: src/cmd/install.c:122 src/cmd/remove.c:76 src/cmd/update.c:68
|
#: src/cmd/install.c:133 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:138 src/cmd/install.c:142 src/cmd/install.c:157
|
#: src/cmd/install.c:149 src/cmd/install.c:153 src/cmd/install.c:168
|
||||||
#: src/cmd/remove.c:83 src/cmd/update.c:78 src/cmd/update.c:87
|
#: src/cmd/remove.c:93 src/cmd/update.c:86 src/cmd/update.c:95
|
||||||
#: src/cmd/update.c:96
|
#: src/cmd/update.c:104
|
||||||
msgid "("
|
msgid "("
|
||||||
msgstr "("
|
msgstr "("
|
||||||
|
|
||||||
#: src/cmd/install.c:148 src/cmd/update.c:83
|
#: src/cmd/install.c:159 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:163 src/cmd/update.c:101
|
#: src/cmd/install.c:174 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:169
|
#: src/cmd/install.c:180
|
||||||
msgid "Installed "
|
msgid "Installed "
|
||||||
msgstr "Installed "
|
msgstr "Installed "
|
||||||
|
|
||||||
#: src/cmd/install.c:169
|
#: src/cmd/install.c:180
|
||||||
msgid "Installed all of the "
|
msgid "Installed all of the "
|
||||||
msgstr "Installed all of the "
|
msgstr "Installed all of the "
|
||||||
|
|
||||||
#: src/cmd/list.c:28
|
#: src/cmd/list.c:38
|
||||||
msgid "There no installed packages"
|
msgid "There no installed packages"
|
||||||
msgstr "There no installed packages"
|
msgstr "There no installed packages"
|
||||||
|
|
||||||
#: src/cmd/list.c:33
|
#: src/cmd/list.c:43
|
||||||
msgid "Listing "
|
msgid "Listing "
|
||||||
msgstr "Listing "
|
msgstr "Listing "
|
||||||
|
|
||||||
#: src/cmd/remove.c:20
|
#: src/cmd/remove.c:30
|
||||||
msgid "Listing options for the remove command:"
|
msgid "Listing options for the remove command:"
|
||||||
msgstr "Listing options for the remove command:"
|
msgstr "Listing options for the remove command:"
|
||||||
|
|
||||||
#: src/cmd/remove.c:50
|
#: src/cmd/remove.c:60
|
||||||
msgid "Cannot remove "
|
msgid "Cannot remove "
|
||||||
msgstr "Cannot remove "
|
msgstr "Cannot remove "
|
||||||
|
|
||||||
#: src/cmd/remove.c:58
|
#: src/cmd/remove.c:68
|
||||||
msgid "Nothing to do (no packages to remove)"
|
msgid "Nothing to do (no packages to remove)"
|
||||||
msgstr "Nothing to do (no packages to remove)"
|
msgstr "Nothing to do (no packages to remove)"
|
||||||
|
|
||||||
#: src/cmd/remove.c:89 src/cmd/update.c:92
|
#: src/cmd/remove.c:99 src/cmd/update.c:100
|
||||||
msgid "Failed to remove "
|
msgid "Failed to remove "
|
||||||
msgstr "Failed to remove "
|
msgstr "Failed to remove "
|
||||||
|
|
||||||
#: src/cmd/remove.c:95
|
#: src/cmd/remove.c:105
|
||||||
msgid "Removed "
|
msgid "Removed "
|
||||||
msgstr "Removed "
|
msgstr "Removed "
|
||||||
|
|
||||||
#: src/cmd/remove.c:95
|
#: src/cmd/remove.c:105
|
||||||
msgid "Removed all of the "
|
msgid "Removed all of the "
|
||||||
msgstr "Removed all of the "
|
msgstr "Removed all of the "
|
||||||
|
|
||||||
@ -339,33 +344,33 @@ msgstr "Removed all of the "
|
|||||||
msgid "Failed to sync "
|
msgid "Failed to sync "
|
||||||
msgstr "Failed to sync "
|
msgstr "Failed to sync "
|
||||||
|
|
||||||
#: src/cmd/sync.c:29 src/cmd/sync.c:59
|
#: src/cmd/sync.c:29 src/cmd/sync.c:65
|
||||||
msgid "Synced "
|
msgid "Synced "
|
||||||
msgstr "Synced "
|
msgstr "Synced "
|
||||||
|
|
||||||
#: src/cmd/sync.c:47
|
#: src/cmd/sync.c:53
|
||||||
msgid "There are no pools specified in the configuration"
|
msgid "There are no pools specified in the configuration"
|
||||||
msgstr "There are no pools specified in the configuration"
|
msgstr "There are no pools specified in the configuration"
|
||||||
|
|
||||||
#: src/cmd/sync.c:55
|
#: src/cmd/sync.c:61
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Failed to sync pools: %s"
|
msgid "Failed to sync pools: %s"
|
||||||
msgstr "Failed to sync pools: %s"
|
msgstr "Failed to sync pools: %s"
|
||||||
|
|
||||||
#: src/cmd/update.c:29
|
#: src/cmd/update.c:37
|
||||||
msgid "Listing options for the update command:"
|
msgid "Listing options for the update command:"
|
||||||
msgstr "Listing options for the update command:"
|
msgstr "Listing options for the update command:"
|
||||||
|
|
||||||
#: src/cmd/update.c:46
|
#: src/cmd/update.c:54
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Failed to get the package update list: %s"
|
msgid "Failed to get the package update list: %s"
|
||||||
msgstr "Failed to get the package update list: %s"
|
msgstr "Failed to get the package update list: %s"
|
||||||
|
|
||||||
#: src/cmd/update.c:51
|
#: src/cmd/update.c:59
|
||||||
msgid "All packages are up-to-date"
|
msgid "All packages are up-to-date"
|
||||||
msgstr "All packages are up-to-date"
|
msgstr "All packages are up-to-date"
|
||||||
|
|
||||||
#: src/cmd/update.c:74
|
#: src/cmd/update.c:82
|
||||||
msgid "Failed to update "
|
msgid "Failed to update "
|
||||||
msgstr "Failed to update "
|
msgstr "Failed to update "
|
||||||
|
|
||||||
|
24
src/args.c
24
src/args.c
@ -7,14 +7,29 @@
|
|||||||
#include "args.h"
|
#include "args.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
void args_register(args_t *args, char *name) {
|
||||||
|
for (int i = 0; i < args->count; i++) {
|
||||||
|
if (args->list[i].name != NULL && eq(args->list[i].name, name))
|
||||||
|
args->list[i].registered = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char *args_register_check(args_t *args) {
|
||||||
|
for (int i = 0; i < args->count; i++)
|
||||||
|
if (!args->list[i].registered)
|
||||||
|
return args->list[i].name;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void args_add_name(args_t *args, char *name) {
|
void args_add_name(args_t *args, char *name) {
|
||||||
if (NULL == args->list)
|
if (NULL == args->list)
|
||||||
args->list = malloc(sizeof(arg_t) * (args->count + 1));
|
args->list = malloc(sizeof(arg_t) * (args->count + 1));
|
||||||
else
|
else
|
||||||
args->list = realloc(args->list, sizeof(arg_t) * (args->count + 1));
|
args->list = realloc(args->list, sizeof(arg_t) * (args->count + 1));
|
||||||
|
|
||||||
args->list[args->count].name = name;
|
args->list[args->count].name = name;
|
||||||
args->list[args->count++].value = NULL;
|
args->list[args->count].registered = false;
|
||||||
|
args->list[args->count++].value = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void args_add_value(args_t *args, char *value) {
|
void args_add_value(args_t *args, char *value) {
|
||||||
@ -23,8 +38,9 @@ void args_add_value(args_t *args, char *value) {
|
|||||||
else
|
else
|
||||||
args->list = realloc(args->list, sizeof(arg_t) * (args->count + 1));
|
args->list = realloc(args->list, sizeof(arg_t) * (args->count + 1));
|
||||||
|
|
||||||
args->list[args->count].name = NULL;
|
args->list[args->count].name = NULL;
|
||||||
args->list[args->count++].value = value;
|
args->list[args->count].registered = true;
|
||||||
|
args->list[args->count++].value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void args_set_value(args_t *args, char *value) {
|
void args_set_value(args_t *args, char *value) {
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
typedef struct arg {
|
typedef struct arg {
|
||||||
char *name;
|
char *name;
|
||||||
char *value;
|
char *value;
|
||||||
|
bool registered;
|
||||||
} arg_t;
|
} arg_t;
|
||||||
|
|
||||||
typedef struct args {
|
typedef struct args {
|
||||||
@ -11,6 +12,8 @@ typedef struct args {
|
|||||||
size_t count;
|
size_t count;
|
||||||
} args_t;
|
} args_t;
|
||||||
|
|
||||||
|
void args_register(args_t *args, char *name);
|
||||||
|
char *args_register_check(args_t *args);
|
||||||
args_t *args_parse(int argc, char *argv[]);
|
args_t *args_parse(int argc, char *argv[]);
|
||||||
char *args_get_string(args_t *args, char *name);
|
char *args_get_string(args_t *args, char *name);
|
||||||
bool args_get_bool(args_t *args, char *name);
|
bool args_get_bool(args_t *args, char *name);
|
||||||
|
@ -34,10 +34,21 @@ lm_pkg_data_t *cmd_info_from_database(lm_ctx_t *ctx, lm_entry_t *entry, args_t *
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cmd_info(lm_ctx_t *ctx, config_t *config, args_t *args){
|
bool cmd_info(lm_ctx_t *ctx, config_t *config, args_t *args){
|
||||||
|
char *arg = NULL;
|
||||||
|
|
||||||
args_split(args, "grep");
|
args_split(args, "grep");
|
||||||
args_split(args, "changes");
|
args_split(args, "changes");
|
||||||
args_split(args, "database");
|
args_split(args, "database");
|
||||||
|
|
||||||
|
args_register(args, "grep");
|
||||||
|
args_register(args, "changes");
|
||||||
|
args_register(args, "database");
|
||||||
|
|
||||||
|
if((arg = args_register_check(args)) != NULL){
|
||||||
|
error(_("Unknown argument: "FG_BOLD"--%s"FG_RESET", run with "FG_BOLD"--help"FG_RESET" to list the avaliable arguments"), arg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(args_get_bool(args, "help")){
|
if(args_get_bool(args, "help")){
|
||||||
info(_("Listing options for the list command:"));
|
info(_("Listing options for the list command:"));
|
||||||
printf(_(" "FG_BOLD"--grep"FG_RESET":\tmakes the output \"grepable\"\n"));
|
printf(_(" "FG_BOLD"--grep"FG_RESET":\tmakes the output \"grepable\"\n"));
|
||||||
|
@ -23,10 +23,21 @@ bool cmd_download_callback(lm_ctx_t *ctx, lm_pkg_t *pkg, bool is_archive, size_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cmd_install(lm_ctx_t *ctx, config_t *config, args_t *args){
|
bool cmd_install(lm_ctx_t *ctx, config_t *config, args_t *args){
|
||||||
|
char *arg = NULL;
|
||||||
|
|
||||||
args_split(args, "ignore-depends");
|
args_split(args, "ignore-depends");
|
||||||
args_split(args, "continue");
|
args_split(args, "continue");
|
||||||
args_split(args, "yes");
|
args_split(args, "yes");
|
||||||
|
|
||||||
|
args_register(args, "ignore-depends");
|
||||||
|
args_register(args, "continue");
|
||||||
|
args_register(args, "yes");
|
||||||
|
|
||||||
|
if((arg = args_register_check(args)) != NULL){
|
||||||
|
error(_("Unknown argument: "FG_BOLD"--%s"FG_RESET", run with "FG_BOLD"--help"FG_RESET" to list the avaliable arguments"), arg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
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"));
|
||||||
|
@ -6,9 +6,19 @@
|
|||||||
#include "../log.h"
|
#include "../log.h"
|
||||||
|
|
||||||
bool cmd_list(lm_ctx_t *ctx, config_t *config, args_t *args){
|
bool cmd_list(lm_ctx_t *ctx, config_t *config, args_t *args){
|
||||||
|
char *arg = NULL;
|
||||||
|
|
||||||
args_split(args, "grep");
|
args_split(args, "grep");
|
||||||
args_split(args, "desc");
|
args_split(args, "desc");
|
||||||
|
|
||||||
|
args_register(args, "grep");
|
||||||
|
args_register(args, "desc");
|
||||||
|
|
||||||
|
if((arg = args_register_check(args)) != NULL){
|
||||||
|
error(_("Unknown argument: "FG_BOLD"--%s"FG_RESET", run with "FG_BOLD"--help"FG_RESET" to list the avaliable arguments"), arg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(args_get_bool(args, "help")){
|
if(args_get_bool(args, "help")){
|
||||||
info(_("Listing options for the list command:"));
|
info(_("Listing options for the list command:"));
|
||||||
printf(_(" "FG_BOLD"--grep"FG_RESET":\tmakes the output \"grepable\"\n"));
|
printf(_(" "FG_BOLD"--grep"FG_RESET":\tmakes the output \"grepable\"\n"));
|
||||||
|
@ -13,9 +13,19 @@ bool cmd_remove_callback(lm_ctx_t *ctx, lm_entry_t *ent, char *file, size_t curr
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cmd_remove(lm_ctx_t *ctx, config_t *config, args_t *args){
|
bool cmd_remove(lm_ctx_t *ctx, config_t *config, args_t *args){
|
||||||
|
char *arg = NULL;
|
||||||
|
|
||||||
args_split(args, "break");
|
args_split(args, "break");
|
||||||
args_split(args, "yes");
|
args_split(args, "yes");
|
||||||
|
|
||||||
|
args_register(args, "break");
|
||||||
|
args_register(args, "yes");
|
||||||
|
|
||||||
|
if((arg = args_register_check(args)) != NULL){
|
||||||
|
error(_("Unknown argument: "FG_BOLD"--%s"FG_RESET", run with "FG_BOLD"--help"FG_RESET" to list the avaliable arguments"), arg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(args_get_bool(args, "help")){
|
if(args_get_bool(args, "help")){
|
||||||
info(_("Listing options for the remove command:"));
|
info(_("Listing options for the remove command:"));
|
||||||
printf(_(" "FG_BOLD"--break"FG_RESET":\tbreak other package depends\n"));
|
printf(_(" "FG_BOLD"--break"FG_RESET":\tbreak other package depends\n"));
|
||||||
|
@ -42,6 +42,12 @@ bool cmd_sync_callback(lm_ctx_t *ctx, lm_pool_t *pool, lm_ctx_sync_state_t state
|
|||||||
bool cmd_sync(lm_ctx_t *ctx, config_t *config, args_t *args){
|
bool cmd_sync(lm_ctx_t *ctx, config_t *config, args_t *args){
|
||||||
size_t sycned = 0;
|
size_t sycned = 0;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
char *arg = NULL;
|
||||||
|
|
||||||
|
if((arg = args_register_check(args)) != NULL){
|
||||||
|
error(_("Unknown argument: "FG_BOLD"--%s"FG_RESET", run with "FG_BOLD"--help"FG_RESET" to list the avaliable arguments"), arg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(config->pool_count == 0){
|
if(config->pool_count == 0){
|
||||||
error(_("There are no pools specified in the configuration"));
|
error(_("There are no pools specified in the configuration"));
|
||||||
|
@ -23,7 +23,15 @@ bool cmd_update_download_callback(lm_ctx_t *ctx, lm_pkg_t *pkg, bool is_archive,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cmd_update(lm_ctx_t *ctx, config_t *config, args_t *args){
|
bool cmd_update(lm_ctx_t *ctx, config_t *config, args_t *args){
|
||||||
|
char *arg = NULL;
|
||||||
|
|
||||||
args_split(args, "yes");
|
args_split(args, "yes");
|
||||||
|
args_register(args, "yes");
|
||||||
|
|
||||||
|
if((arg = args_register_check(args)) != NULL){
|
||||||
|
error(_("Unknown argument: "FG_BOLD"--%s"FG_RESET", run with "FG_BOLD"--help"FG_RESET" to list the avaliable arguments"), arg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(args_get_bool(args, "help")){
|
if(args_get_bool(args, "help")){
|
||||||
info(_("Listing options for the update command:"));
|
info(_("Listing options for the update command:"));
|
||||||
|
@ -75,6 +75,9 @@ int main(int argc, char *argv[], char *envp[]) {
|
|||||||
set_env(envp);
|
set_env(envp);
|
||||||
lm_ctx_init(&ctx);
|
lm_ctx_init(&ctx);
|
||||||
args = args_parse(argc, argv);
|
args = args_parse(argc, argv);
|
||||||
|
args_register(args, "config");
|
||||||
|
args_register(args, "root");
|
||||||
|
args_register(args, "help");
|
||||||
|
|
||||||
if ((config_file = args_get_string(args, "config")) == NULL)
|
if ((config_file = args_get_string(args, "config")) == NULL)
|
||||||
config_file = "/etc/matt/config.ini";
|
config_file = "/etc/matt/config.ini";
|
||||||
|
Loading…
Reference in New Issue
Block a user