Jelajahi Sumber

added printf helper function

Daniel-Constantin Mierla 8 tahun lalu
induk
melakukan
7f5b254688
1 mengubah file dengan 6 tambahan dan 0 penghapusan
  1. 6 0
      kamcli/cli.py

+ 6 - 0
kamcli/cli.py

@@ -82,6 +82,12 @@ class Context(object):
                 msg %= args
                 msg %= args
             click.echo("(dbg): " + msg, file=sys.stderr)
             click.echo("(dbg): " + msg, file=sys.stderr)
 
 
+    def printf(self, msg, *args):
+        """Print a formated message to stdout."""
+        if args:
+            msg %= args
+        click.echo(msg)
+
     @property
     @property
     def gconfig(self):
     def gconfig(self):
         if self._gconfig is None:
         if self._gconfig is None: