Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
pkg-set: Rename -a to -A and add -a for all packages
Bryan Drewery committed 13 years ago
commit 10eda77b95a35cabcfe737a54ffef5171807b665
parent 12addcf
2 files changed +14 -8
modified pkg/pkg-set.8
@@ -15,7 +15,7 @@
.\"     @(#)pkg.8
.\" $FreeBSD$
.\"
-
.Dd March 2, 2012
+
.Dd May 12, 2012
.Dt PKG-SET 8
.Os
.Sh NAME
@@ -23,7 +23,8 @@
.Nd modify information in the installed database
.Sh SYNOPSIS
.Nm
-
.Op Fl a Op Ar 01
+
.Op Fl a
+
.Op Fl A Op Ar 01
.Op Fl o Ar <oldorigin>:<neworigin>
.Op Fl y
.Op Fl xXg
@@ -38,7 +39,9 @@ The following options are supported by
.Bl -tag -width F1
.It Fl y
Assume yes when asked for confirmation before package autoremoval.
-
.It Fl a Op 01
+
.It Fl a
+
Match on all installed packages.
+
.It Fl A Op 01
Set automatic flag to the package: 0 is not automatic, 1 is automatic
.It Fl o Op <oldorigin>:<neworigin>
Change the dependency origin of a given dependency
modified pkg/set.c
@@ -41,7 +41,7 @@
void
usage_set(void)
{
-
	fprintf(stderr, "usage pkg set -a [01] -yxXg <pattern>\n\n");
+
	fprintf(stderr, "usage pkg set [-a] [-A [01]] -yxXg <pattern>\n\n");
	fprintf(stderr, "For more information see 'pkg help set'. \n");
}

@@ -65,11 +65,14 @@ exec_set(int argc, char **argv)
	unsigned int loads = PKG_LOAD_BASIC;
	unsigned int sets = 0;

-
	while ((ch = getopt(argc, argv, "ya:kxXgo:")) != -1) {
+
	while ((ch = getopt(argc, argv, "ayA:kxXgo:")) != -1) {
		switch (ch) {
			case 'y':
				yes_flag = true;
				break;
+
			case 'a':
+
				match = MATCH_ALL;
+
				break;
			case 'x':
				match = MATCH_REGEX;
				break;
@@ -79,11 +82,11 @@ exec_set(int argc, char **argv)
			case 'g':
				match = MATCH_GLOB;
				break;
-
			case 'a':
+
			case 'A':
				sets |= AUTOMATIC;
				newautomatic = strtonum(optarg, 0, 1, &errstr);
				if (errstr)
-
					errx(EX_USAGE, "Wrong value for -a expecting 0 or 1, got: %s (%s)", optarg, errstr);
+
					errx(EX_USAGE, "Wrong value for -A expecting 0 or 1, got: %s (%s)", optarg, errstr);
				break;
			case 'o':
				sets |= ORIGIN;
@@ -110,7 +113,7 @@ exec_set(int argc, char **argv)
	argc -= optind;
	argv += optind;

-
	if (argc < 1 || (newautomatic == -1 && neworigin == NULL)) {
+
	if ((argc < 1 && match != MATCH_ALL) || (newautomatic == -1 && neworigin == NULL)) {
		usage_set();
		return (EX_USAGE);
	}