util.c: extend --print-format with %b for builddate
Signed-off-by: Jelle van der Waa <jelle@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
7bcc2d9b23
commit
00bc386d5a
2 changed files with 16 additions and 5 deletions
|
@ -235,11 +235,11 @@ Transaction Options (apply to '-S', '-R' and '-U')
|
|||
|
||||
*\--print-format* <format>::
|
||||
Specify a printf-like format to control the output of the '\--print'
|
||||
operation. The possible attributes are: "%a" for arch, "%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, and
|
||||
"%s" for size.
|
||||
operation. The possible attributes are: "%a" for arch, "%b" for
|
||||
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, and "%s" for size.
|
||||
Implies '\--print'.
|
||||
|
||||
|
||||
|
|
|
@ -1163,6 +1163,17 @@ void print_packages(const alpm_list_t *packages)
|
|||
free(temp);
|
||||
temp = string;
|
||||
}
|
||||
/* %b : build date */
|
||||
if(strstr(temp, "%b")) {
|
||||
char bdatestr[50] = "";
|
||||
time_t bdate = (time_t)alpm_pkg_get_builddate(pkg);
|
||||
if(bdate != -1) {
|
||||
strftime(bdatestr, 50, "%c", localtime(&bdate));
|
||||
string = strreplace(temp, "%b", bdatestr);
|
||||
free(temp);
|
||||
temp = string;
|
||||
}
|
||||
}
|
||||
/* %d : description */
|
||||
VAL_FROM_FORMAT_STR(temp, "%d", alpm_pkg_get_desc)
|
||||
/* %e : pkgbase */
|
||||
|
|
Loading…
Add table
Reference in a new issue