summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-09-21 14:06:39 -0400
committerEvan Prodromou <evan@status.net>2010-09-21 14:06:39 -0400
commit91a186251047127ad7f1238f47ff761d9127627c (patch)
treeef00c0964de545328597d73d2fdd7ef7545ba4bd
parent556a2a8fd8ce278f5c0b5ced9e762c6f9bac8659 (diff)
printfv and printfq functions in commandline.inc
-rw-r--r--scripts/commandline.inc40
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/commandline.inc b/scripts/commandline.inc
index 6d94a318d..9390890ef 100644
--- a/scripts/commandline.inc
+++ b/scripts/commandline.inc
@@ -204,3 +204,43 @@ function getUser()
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);
+} \ No newline at end of file