]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
printfv and printfq functions in commandline.inc
authorEvan Prodromou <evan@status.net>
Tue, 21 Sep 2010 18:06:39 +0000 (14:06 -0400)
committerEvan Prodromou <evan@status.net>
Tue, 21 Sep 2010 18:06:39 +0000 (14:06 -0400)
scripts/commandline.inc

index 6d94a318d65a550d717b6d4030b479dbe6341244..9390890ef33c0f7379c38d58fee4325aefdd935e 100644 (file)
@@ -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