Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
pkg info: long options
Matthew Seaman committed 11 years ago
commit e72110462eef0c3bd6bf8bb3432be728835fec15
parent 4fc3af1
12 files changed +80 -39
modified src/audit.c
@@ -101,6 +101,7 @@ exec_audit(int argc, char **argv)
		{ "fetch",	no_argument,		NULL,	'F' },
		{ "file",	required_argument,	NULL,	'f' },
		{ "quiet",	no_argument,		NULL,	'q' },
+
		{ NULL,		0,			NULL,	0   },
	};

	while ((ch = getopt_long(argc, argv, "Ff:q", longopts, NULL)) != -1) {
modified src/autoremove.c
@@ -59,6 +59,7 @@ exec_autoremove(__unused int argc, __unused char **argv)
		{ "dry-run",	no_argument,	NULL,	'n' },
		{ "quiet",	no_argument,	NULL,	'q' },
		{ "yes",	no_argument,	NULL,	'y' },
+
		{ NULL,		0,		NULL,	0   },
	};

	yes = pkg_object_bool(pkg_config_get("ASSUME_ALWAYS_YES"));
modified src/backup.c
@@ -53,6 +53,7 @@ exec_backup(int argc, char **argv)
	struct option longopts[] = {
		{ "dump",	required_argument,	NULL,	'd' },
		{ "restore",	required_argument,	NULL,	'r' },
+
		{ NULL,		0,			NULL,	0   },
	};

	while ((ch = getopt_long(argc, argv, "d:r:", longopts, NULL)) != -1) {
modified src/check.c
@@ -280,6 +280,7 @@ exec_check(int argc, char **argv)
		{ "verbose",		no_argument,	NULL,	'v' },
		{ "regex",		no_argument,	NULL,	'x' },
		{ "yes",		no_argument,	NULL,	'y' },
+
		{ NULL,			0,		NULL,	0   },
	};

	yes = pkg_object_bool(pkg_config_get("ASSUME_ALWAYS_YES"));
modified src/clean.c
@@ -181,6 +181,7 @@ exec_clean(int argc, char **argv)
		{ "dry-run",	no_argument,	NULL,	'n' },
		{ "quiet",	no_argument,	NULL,	'q' },
		{ "yes",	no_argument,	NULL,	'y' },
+
		{ NULL,		0,		NULL,	0   },
	};

	yes = pkg_object_bool(pkg_config_get("ASSUME_ALWAYS_YES"));
modified src/convert.c
@@ -287,6 +287,7 @@ exec_convert(__unused int argc, __unused char **argv)
		{ "pkg-dbdir",	required_argument,	NULL,	'd' },
		{ "dry-run",	no_argument,		NULL,	'n' },
		{ "revert",	no_argument,		NULL,	'r' },
+
		{ NULL,		0,			NULL,	0   },
	};

	while ((ch = getopt_long(argc, argv, "d:nr", longopts, NULL)) != -1) {
modified src/create.c
@@ -213,6 +213,7 @@ exec_create(int argc, char **argv)
		{ "no-clobber", no_argument,		NULL,	'n' },
		{ "plist",	required_argument,	NULL,	'p' },
		{ "old",	no_argument,		NULL,	'O' },
+
		{ NULL,		0,			NULL,	0   },
	};

	while ((ch = getopt_long(argc, argv, "agxf:r:m:M:o:np:O", longopts, NULL)) != -1) {
modified src/delete.c
@@ -73,6 +73,7 @@ exec_delete(int argc, char **argv)
		{ "recursive",			no_argument,	NULL,	'R' },
		{ "regex",			no_argument,	NULL,	'x' },
		{ "yes",			no_argument,	NULL,	'y' },
+
		{ NULL,				0,		NULL,	0   },
	};

	nbactions = nbdone = 0;
modified src/fetch.c
@@ -77,6 +77,7 @@ exec_fetch(int argc, char **argv)
		{ "no-repo-update",	no_argument,		NULL,	'U' },
		{ "regex",		no_argument,		NULL,	'x' },
		{ "yes",		no_argument,		NULL,	'y' },
+
		{ NULL,			0,			NULL,	0   },
	};

	auto_update = pkg_object_bool(pkg_config_get("REPO_AUTOUPDATE"));
modified src/info.c
@@ -39,6 +39,7 @@
#include <err.h>
#include <errno.h>
#include <fcntl.h>
+
#include <getopt.h>
#include <pkg.h>
#include <stdbool.h>
#include <stdio.h>
@@ -99,12 +100,40 @@ exec_info(int argc, char **argv)
	cap_rights_t rights;
#endif

+
	struct option longopts[] = {
+
		{ "all",		no_argument,		NULL,	'a' },
+
		{ "annotations",	no_argument,		NULL,	'A' },
+
		{ "provided-shlibs",	no_argument,		NULL,	'b' },
+
		{ "required-shlibs",	no_argument,		NULL,	'B' },
+
		{ "case-sensitive",	no_argument,		NULL,	'C' },
+
		{ "dependencies",	no_argument,		NULL,	'd' },
+
		{ "pkg-message",	no_argument,		NULL,	'D' },
+
		{ "exists",		no_argument,		NULL,	'e' },
+
		{ "show-name-only",	no_argument,		NULL,	'E' },
+
		{ "full",		no_argument,		NULL,	'f' },
+
		{ "file",		required_argument,	NULL,	'F' },
+
		{ "glob",		no_argument,		NULL,	'g' },
+
		{ "case-insensitive",	no_argument,		NULL,	'i' },
+
		{ "comment",		no_argument,		NULL,	'I' },
+
		{ "locked",		no_argument,		NULL,	'k' },
+
		{ "list-files",		no_argument,		NULL,	'l' },
+
		{ "origin",		no_argument,		NULL,	'o' },
+
		{ "by-origin",		no_argument,		NULL,	'O' },
+
		{ "prefix",		no_argument,		NULL,	'p' },
+
		{ "guiet",		no_argument,		NULL,	'q' },
+
		{ "requirements",	no_argument,		NULL,	'r' },
+
		{ "raw",		no_argument,		NULL,	'R' },
+
		{ "size",		no_argument,		NULL,	's' },
+
		{ "regex",		no_argument,		NULL,	'x' },
+
		{ NULL,			0,			NULL,	0   },
+
	};
+

	/* Set default case sensitivity for searching */
	pkgdb_set_case_sensitivity(
	    pkg_object_bool(pkg_config_get("CASE_SENSITIVE_MATCH")));

	/* TODO: exclusive opts ? */
-
	while ((ch = getopt(argc, argv, "aACDegixEIdrklbBsqopOfF:R")) != -1) {
+
	while ((ch = getopt_long(argc, argv, "aAbBCdDeEfF:giIkloOpqrRsx", longopts, NULL)) != -1) {
		switch (ch) {
		case 'a':
			match = MATCH_ALL;
@@ -112,73 +141,73 @@ exec_info(int argc, char **argv)
		case 'A':
			opt |= INFO_ANNOTATIONS;
			break;
+
		case 'b':
+
			opt |= INFO_SHLIBS_PROVIDED;
+
			break;
+
		case 'B':
+
			opt |= INFO_SHLIBS_REQUIRED;
+
			break;
		case 'C':
			pkgdb_set_case_sensitivity(true);
			break;
-
		case 'O':
-
			origin_search = true;  /* only for ports compat */
+
		case 'd':
+
			opt |= INFO_DEPS;
+
			break;
+
		case 'D':
+
			opt |= INFO_MESSAGE;
			break;
		case 'e':
			pkg_exists = true;;
			retcode = 1;
			break;
+
		case 'E': /* ports compatibility */
+
			e_flag = true;
+
			break;
+
		case 'f':
+
			opt |= INFO_FULL;
+
			break;
+
		case 'F':
+
			file = optarg;
+
			break;
		case 'g':
			match = MATCH_GLOB;
			break;
		case 'i':
			pkgdb_set_case_sensitivity(false);
			break;
-
		case 'x':
-
			match = MATCH_REGEX;
-
			break;
-
		case 'D':
-
			opt |= INFO_MESSAGE;
-
			break;
-
		case 'd':
-
			opt |= INFO_DEPS;
-
			break;
		case 'I':
			opt |= INFO_COMMENT;
			break;
-
		case 'r':
-
			opt |= INFO_RDEPS;
-
			break;
		case 'k':
			opt |= INFO_LOCKED;
			break;
		case 'l':
			opt |= INFO_FILES;
			break;
-
		case 'b':
-
			opt |= INFO_SHLIBS_PROVIDED;
-
			break;
-
		case 'B':
-
			opt |= INFO_SHLIBS_REQUIRED;
-
			break;
-
		case 's':
-
			opt |= INFO_FLATSIZE;
-
			break;
-
		case 'E': /* ports compatibility */
-
			e_flag = true;
-
			break;
-
		case 'q':
-
			quiet = true;
-
			break;
		case 'o':
			opt |= INFO_ORIGIN;
			break;
+
		case 'O':
+
			origin_search = true;  /* only for ports compat */
+
			break;
		case 'p':
			opt |= INFO_PREFIX;
			break;
-
		case 'f':
-
			opt |= INFO_FULL;
+
		case 'q':
+
			quiet = true;
			break;
-
		case 'F':
-
			file = optarg;
+
		case 'r':
+
			opt |= INFO_RDEPS;
			break;
		case 'R':
			opt |= INFO_RAW;
			break;
+
		case 's':
+
			opt |= INFO_FLATSIZE;
+
			break;
+
		case 'x':
+
			match = MATCH_REGEX;
+
			break;
		default:
			usage_info();
			return(EX_USAGE);
@@ -377,16 +406,18 @@ exec_info(int argc, char **argv)

		/* this is place for compatibility hacks */

-
		/* ports infrastructure expects pkg info -q -O to always return 0 even
-
		 * if the ports doesn't exists */
+
		/* ports infrastructure expects pkg info -q -O to
+
		 * always return 0 even if the ports doesn't exists */
+

		if (origin_search)
			gotone = true;

		/* end of compatibility hacks */

		/*
-
		 * only show full version in case of match glob with a single argument specified
-
		 * which does not contains any glob pattern
+
		 * only show full version in case of match glob with a
+
		 * single argument specified which does not contains
+
		 * any glob pattern
		 */
		if (argc == 1 && !origin_search && !quiet && !e_flag &&
		    match == MATCH_GLOB &&
modified src/main.c
@@ -662,6 +662,7 @@ main(int argc, char **argv)
		{ "check-activation",	no_argument,		NULL,	'N' },
		{ "version",		no_argument,		NULL,	'v' },
		{ "option",		required_argument,	NULL,	'o' },
+
		{ NULL,			0,			NULL,	0   },
	};

	/* Set stdout unbuffered */
modified src/register.c
@@ -2,7 +2,7 @@
 * Copyright (c) 2011-2014 Baptiste Daroussin <bapt@FreeBSD.org>
 * Copyright (c) 2011-2012 Julien Laffaye <jlaffaye@FreeBSD.org>
 * Copyright (c) 2011-2012 Marin Atanasov Nikolov <dnaeon@gmail.com>
-
 * Copyright (c) 2013 Matthew Seaman <matthew@FreeBSD.org>
+
 * Copyright (c) 2013-2014 Matthew Seaman <matthew@FreeBSD.org>
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without