summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-07-23 17:36:08 -0400
committerDave Reisner <dreisner@archlinux.org>2011-07-23 17:36:08 -0400
commitda0fbab34f740b8f180e6608e6667f9ebda96859 (patch)
tree0f1bd3528ecc996809d6e9cd84062c2604eddc7d
parentd818184978270072b5416b008bea272de0a13591 (diff)
downloadexpac-da0fbab34f740b8f180e6608e6667f9ebda96859.tar.xz
add %o for optdepends without descriptions
-rw-r--r--README.pod2
-rw-r--r--expac.c14
2 files changed, 16 insertions, 0 deletions
diff --git a/README.pod b/README.pod
index 8c64540..16052eb 100644
--- a/README.pod
+++ b/README.pod
@@ -90,6 +90,8 @@ The format argument allows the following interpreted sequences:
%O optional deps
+ %o optional deps (no descriptions)
+
%P provides
%R replaces
diff --git a/expac.c b/expac.c
index b261118..a0b8edc 100644
--- a/expac.c
+++ b/expac.c
@@ -88,6 +88,17 @@ static char *strtrim(char *str) {
return str;
}
+char *trim_optdep(char *optdep) {
+ char *colon;
+
+ colon = strchr(optdep, ':');
+ if (colon) {
+ *colon = '\0';
+ }
+
+ return optdep;
+}
+
static int alpm_init(void) {
int ret = 0;
FILE *fp;
@@ -446,6 +457,9 @@ static int print_pkg(pmpkg_t *pkg, const char *format) {
case 'O': /* optdepends */
out += print_list(alpm_pkg_get_optdepends(pkg), NULL, shortdeps);
break;
+ case 'o': /* optdepends (shortdeps) */
+ out += print_list(alpm_pkg_get_optdepends(pkg), (extractfn)trim_optdep, shortdeps);
+ break;
case 'C': /* conflicts */
out += print_list(alpm_pkg_get_conflicts(pkg), NULL, shortdeps);
break;