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>::
|
*\--print-format* <format>::
|
||||||
Specify a printf-like format to control the output of the '\--print'
|
Specify a printf-like format to control the output of the '\--print'
|
||||||
operation. The possible attributes are: "%a" for arch, "%d" for
|
operation. The possible attributes are: "%a" for arch, "%b" for
|
||||||
description, "%e" for pkgbase, "%f" for filename, "%g" for base64
|
builddate, "%d" for description, "%e" for pkgbase, "%f" for filename,
|
||||||
encoded PGP signature, "%h" for sha256sum, "%n" for pkgname, "%p" for
|
"%g" for base64 encoded PGP signature, "%h" for sha256sum, "%n" for
|
||||||
packager, "%v" for pkgver, "%l" for location, "%r" for repository, and
|
pkgname, "%p" for packager, "%v" for pkgver, "%l" for location, "%r"
|
||||||
"%s" for size.
|
for repository, and "%s" for size.
|
||||||
Implies '\--print'.
|
Implies '\--print'.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1163,6 +1163,17 @@ void print_packages(const alpm_list_t *packages)
|
||||||
free(temp);
|
free(temp);
|
||||||
temp = string;
|
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 */
|
/* %d : description */
|
||||||
VAL_FROM_FORMAT_STR(temp, "%d", alpm_pkg_get_desc)
|
VAL_FROM_FORMAT_STR(temp, "%d", alpm_pkg_get_desc)
|
||||||
/* %e : pkgbase */
|
/* %e : pkgbase */
|
||||||
|
|
Loading…
Add table
Reference in a new issue