Extend --print-format with %L
Add format attribute for licenses. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
f5af66f130
commit
c1d4a6198c
2 changed files with 12 additions and 2 deletions
|
@ -239,8 +239,8 @@ Transaction Options (apply to '-S', '-R' and '-U')
|
|||
builddate, "%d" for description, "%e" for pkgbase, "%f" for filename,
|
||||
"%g" for base64 encoded PGP signature, "%h" for sha256sum, "%n" for
|
||||
pkgname, "%p" for packager, "%v" for pkgver, "%l" for location, "%r"
|
||||
for repository, "%s" for size, "%C" for checkdepends, "%D" for depends
|
||||
and "%M" for makedepends.
|
||||
for repository, "%s" for size, "%C" for checkdepends, "%D" for depends,
|
||||
"%L" for licenses, and "%M" for makedepends.
|
||||
Implies '\--print'.
|
||||
|
||||
|
||||
|
|
|
@ -1279,6 +1279,16 @@ void print_packages(const alpm_list_t *packages)
|
|||
free(temp);
|
||||
temp = string;
|
||||
}
|
||||
/* %L : license */
|
||||
if(strstr(temp, "%L")) {
|
||||
alpm_list_t *lst = alpm_pkg_get_licenses(pkg);
|
||||
char *licenses = concat_list(lst, NULL);
|
||||
string = strreplace(temp, "%L", licenses);
|
||||
free(licenses);
|
||||
free(temp);
|
||||
temp = string;
|
||||
}
|
||||
|
||||
printf("%s\n", string);
|
||||
free(string);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue