diff options
author | Timo Teräs <timo.teras@iki.fi> | 2022-12-20 15:32:49 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2022-12-20 15:39:21 +0200 |
commit | da9dc320bc148f93c110d423d02026d5f6fa4967 (patch) | |
tree | ce1161c8f2de7ba906e44024ba3b2d64914a3d9e /src | |
parent | f000c8f77eccf60b11d9911f95935da1c8adb287 (diff) | |
download | apk-tools-da9dc320bc148f93c110d423d02026d5f6fa4967.tar.gz apk-tools-da9dc320bc148f93c110d423d02026d5f6fa4967.tar.bz2 apk-tools-da9dc320bc148f93c110d423d02026d5f6fa4967.tar.xz apk-tools-da9dc320bc148f93c110d423d02026d5f6fa4967.zip |
apk: improve interactive mode handling
- implement and document --no-interactive
- improve --interactive documentation
- treat EOF as Y
fixes #10860
Diffstat (limited to 'src')
-rw-r--r-- | src/apk.c | 4 | ||||
-rw-r--r-- | src/commit.c | 2 |
2 files changed, 5 insertions, 1 deletions
@@ -86,6 +86,7 @@ static struct apk_repository_list *apk_repository_new(const char *url) OPT(OPT_GLOBAL_interactive, APK_OPT_SH("i") "interactive") \ OPT(OPT_GLOBAL_keys_dir, APK_OPT_ARG "keys-dir") \ OPT(OPT_GLOBAL_no_cache, "no-cache") \ + OPT(OPT_GLOBAL_no_interactive, "no-interactive") \ OPT(OPT_GLOBAL_no_network, "no-network") \ OPT(OPT_GLOBAL_no_progress, "no-progress") \ OPT(OPT_GLOBAL_print_arch, "print-arch") \ @@ -168,6 +169,9 @@ static int option_parse_global(void *ctx, struct apk_db_options *dbopts, int opt case OPT_GLOBAL_interactive: apk_flags |= APK_INTERACTIVE; break; + case OPT_GLOBAL_no_interactive: + apk_flags &= ~APK_INTERACTIVE; + break; case OPT_GLOBAL_progress: apk_flags |= APK_PROGRESS; break; diff --git a/src/commit.c b/src/commit.c index dacc864..4b4f588 100644 --- a/src/commit.c +++ b/src/commit.c @@ -319,7 +319,7 @@ int apk_solver_commit_changeset(struct apk_database *db, printf("Do you want to continue [Y/n]? "); fflush(stdout); r = fgetc(stdin); - if (r != 'y' && r != 'Y' && r != '\n') + if (r != 'y' && r != 'Y' && r != '\n' && r != EOF) return -1; } } |