Date: Fri, 13 Apr 2018 18:25:00 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332484 - head/usr.sbin/pkg Message-ID: <201804131825.w3DIP07v089009@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bapt Date: Fri Apr 13 18:25:00 2018 New Revision: 332484 URL: https://svnweb.freebsd.org/changeset/base/332484 Log: pkg: accept -y and --yes from arguments By popular demand, pkg now walks thought the arguments passed and if it finds -y or --yes it does accept those as equivalent of ASSUME_ALWAYS_YES env var. Requested by: many MFC after: 1 week Modified: head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Fri Apr 13 18:04:51 2018 (r332483) +++ head/usr.sbin/pkg/pkg.c Fri Apr 13 18:25:00 2018 (r332484) @@ -1032,6 +1032,7 @@ main(int argc, char *argv[]) { char pkgpath[MAXPATHLEN]; const char *pkgarg; + int i; bool bootstrap_only, force, yes; bootstrap_only = false; @@ -1083,6 +1084,15 @@ main(int argc, char *argv[]) * tucked in there already. */ config_bool(ASSUME_ALWAYS_YES, &yes); + if (!yes) { + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-y") == 0 || + strcmp(argv[i], "--yes") == 0) { + yes = true; + break; + } + } + } if (!yes) { if (!isatty(fileno(stdin))) { fprintf(stderr, non_interactive_message);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804131825.w3DIP07v089009>