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
This commit is contained in:
parent
e69f393430
commit
8e877d85dc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=332484
@ -1032,6 +1032,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
char pkgpath[MAXPATHLEN];
|
char pkgpath[MAXPATHLEN];
|
||||||
const char *pkgarg;
|
const char *pkgarg;
|
||||||
|
int i;
|
||||||
bool bootstrap_only, force, yes;
|
bool bootstrap_only, force, yes;
|
||||||
|
|
||||||
bootstrap_only = false;
|
bootstrap_only = false;
|
||||||
@ -1083,6 +1084,15 @@ main(int argc, char *argv[])
|
|||||||
* tucked in there already.
|
* tucked in there already.
|
||||||
*/
|
*/
|
||||||
config_bool(ASSUME_ALWAYS_YES, &yes);
|
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 (!yes) {
|
||||||
if (!isatty(fileno(stdin))) {
|
if (!isatty(fileno(stdin))) {
|
||||||
fprintf(stderr, non_interactive_message);
|
fprintf(stderr, non_interactive_message);
|
||||||
|
Loading…
Reference in New Issue
Block a user