diff options
author | gbrandl <devnull@localhost> | 2008-09-07 19:55:25 +0200 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2008-09-07 19:55:25 +0200 |
commit | 929a6088c819ccd5a1cf6f8694c3246ef5d0b2fc (patch) | |
tree | b9281ce466546439fe42b10d5196c2c7361ab1ea | |
parent | 4ba95409a3b64075c99d4f7f3c405857578a2670 (diff) | |
download | pygments-929a6088c819ccd5a1cf6f8694c3246ef5d0b2fc.tar.gz |
Raise exception when trying to use -S with the image formatter.
-rw-r--r-- | pygments/cmdline.py | 6 | ||||
-rw-r--r-- | pygments/formatters/img.py | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/pygments/cmdline.py b/pygments/cmdline.py index de10debe..4d485b6e 100644 --- a/pygments/cmdline.py +++ b/pygments/cmdline.py @@ -281,7 +281,11 @@ def main(args=sys.argv): return 1 arg = a_opt or '' - print fmter.get_style_defs(arg) + try: + print fmter.get_style_defs(arg) + except Exception, err: + print >>sys.stderr, 'Error:', err + return 1 return 0 # if no -S is given, -a is not allowed diff --git a/pygments/formatters/img.py b/pygments/formatters/img.py index 59b29008..5bff5d93 100644 --- a/pygments/formatters/img.py +++ b/pygments/formatters/img.py @@ -305,6 +305,10 @@ class ImageFormatter(Formatter): self.line_number_width = 0 self.drawables = [] + def get_style_defs(self, arg=''): + raise NotImplementedError('The -S option is meaningless for the image ' + 'formatter. Use -O style=<stylename> instead.') + def _get_line_height(self): """ Get the height of a line. |