summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-11-16 17:47:11 -0500
committerDave Reisner <dreisner@archlinux.org>2014-11-16 17:47:11 -0500
commit3857cd02e80e371747005f358701a463b5365b04 (patch)
tree2449f26dfd68a3294963fd935c87f699d94e1a90
parent1f4a917495864544862f28b080a5b9fe6dd8865b (diff)
downloadexpac-3857cd02e80e371747005f358701a463b5365b04.tar.xz
add --config option to point at another pacman.conf
-rw-r--r--README.pod4
-rw-r--r--expac.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/README.pod b/README.pod
index 8e51329..2ac5b79 100644
--- a/README.pod
+++ b/README.pod
@@ -41,6 +41,10 @@ boolean AND query and regex is allowed.
Return packages matching the specified targets as package groups.
+=item B<--config> <file>
+
+Read from I<file> for alpm initialization instead of I</etc/pacman.conf>.
+
=item B<-H, --humansize> <size>
Format package sizes in SI units according to I<size>. Valid options are:
diff --git a/expac.c b/expac.c
index ebbaaa6..0f23c01 100644
--- a/expac.c
+++ b/expac.c
@@ -142,7 +142,8 @@ static void usage(void) {
" -d, --delim <string> separator used between packages (default: \"\\n\")\n"
" -l, --listdelim <string> separator used between list elements (default: \" \")\n"
" -p, --file query local files instead of the DB\n"
- " -t, --timefmt <fmt> date format passed to strftime (default: \"%%c\")\n\n"
+ " -t, --timefmt <fmt> date format passed to strftime (default: \"%%c\")\n"
+ " --config <file> read from <file> for alpm initialization (default: /etc/pacman.conf)\n\n"
" -v, --verbose be more verbose\n\n"
" -h, --help display this help and exit\n\n"
"For more details see expac(1).\n");
@@ -162,6 +163,7 @@ static int parse_options(int argc, char *argv[]) {
{"search", no_argument, 0, 's'},
{"timefmt", required_argument, 0, 't'},
{"verbose", no_argument, 0, 'v'},
+ {"config", required_argument, 0, 128},
{0, 0, 0, 0}
};
@@ -200,7 +202,7 @@ static int parse_options(int argc, char *argv[]) {
break;
case 'h':
usage();
- return 1;
+ exit(0);
case 'p':
opt_corpus = CORPUS_FILE;
break;
@@ -213,6 +215,9 @@ static int parse_options(int argc, char *argv[]) {
case 'v':
opt_verbose = true;
break;
+ case 128:
+ opt_config_file = optarg;
+ break;
case '?':
return -EINVAL;