瀏覽代碼

Add QubesArgumentParser.print_error()

Bahtiar `kalkin-` Gadimov 8 年之前
父節點
當前提交
a65b0edcd4
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      qubes/tools/__init__.py

+ 8 - 0
qubes/tools/__init__.py

@@ -25,10 +25,13 @@
 '''Qubes' command line tools
 '''
 
+from __future__ import print_function
+
 import argparse
 import importlib
 import logging
 import os
+import sys
 import textwrap
 
 import qubes.log
@@ -282,6 +285,11 @@ class QubesArgumentParser(argparse.ArgumentParser):
         elif verbose >= 1:
             qubes.log.enable()
 
+    # pylint: disable=no-self-use
+    def print_error(self, *args, **kwargs):
+        ''' Print to ``sys.stderr``'''
+        print(*args, file=sys.stderr, **kwargs)
+
 
 def get_parser_for_command(command):
     '''Get parser for given qvm-tool.