printfv and printfq functions in commandline.inc

This commit is contained in:
Evan Prodromou 2010-09-21 14:06:39 -04:00
parent 556a2a8fd8
commit 91a1862510

View File

@ -204,3 +204,43 @@ function getUser()
return $user; return $user;
} }
/** "Printf not quiet" */
function printfnq()
{
if (have_option('q', 'quiet')) {
return null;
}
$cargs = func_num_args();
if ($cargs == 0) {
return 0;
}
$args = func_get_args();
$format = array_shift($args);
return vprintf($format, $args);
}
/** "Print when verbose" */
function printfv()
{
if (!have_option('v', 'verbose')) {
return null;
}
$cargs = func_num_args();
if ($cargs == 0) {
return 0;
}
$args = func_get_args();
$format = array_shift($args);
return vprintf($format, $args);
}