aboutsummaryrefslogtreecommitdiffstats
path: root/src/apk.c
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2018-01-09 02:41:55 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2018-01-09 17:07:22 +0000
commit5da4dec2a23e35153075838c4587c07dd20459f9 (patch)
tree2a4ff512f5ca1b18c9f1fe453d05d33056f32c51 /src/apk.c
parent182bfa0a9f0eb804408dddaf714e6fde1483730d (diff)
apk: make --help --verbose actually work.
Diffstat (limited to 'src/apk.c')
-rw-r--r--src/apk.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/apk.c b/src/apk.c
index 6e5641d..c2c8d64 100644
--- a/src/apk.c
+++ b/src/apk.c
@@ -519,7 +519,7 @@ int main(int argc, char **argv)
struct apk_applet *applet;
char short_options[256], *sopt;
struct option *opt, *all_options;
- int i, p, r, num_options;
+ int i, p, r, num_options, help_requested = 0;
void *ctx = NULL;
struct apk_db_options dbopts;
const struct apk_option_group **optgroups = default_optgroups;
@@ -574,10 +574,19 @@ int main(int argc, char **argv)
for (i = 0; optgroups[i]; i++) {
r = optgroups[i]->parse(ctx, &dbopts, p, optarg);
if (r == 0) break;
+ if (r == -EINVAL) {
+ help_requested = 1;
+ break;
+ }
if (r != -ENOTSUP) goto err_and_usage;
}
}
+ if (help_requested) {
+ r = usage(applet);
+ goto err;
+ }
+
if (applet == NULL) {
if (argc > 1) {
r = 1;