From 459c9f1a337ccc7a7aa865b0a80314ce9a7a743e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Roztoc=CC=8Cil?= Date: Sun, 26 Feb 2012 16:22:04 +0100 Subject: [PATCH] Added Solarized color scheme for Pygments by @gthank. --- httpie/httpie.py | 9 +++- httpie/solarized.py | 127 ++++++++++++++++++++++++++++++++++++++++++++ setup.py | 9 ++-- 3 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 httpie/solarized.py diff --git a/httpie/httpie.py b/httpie/httpie.py index 33b98b15..eb21440c 100755 --- a/httpie/httpie.py +++ b/httpie/httpie.py @@ -1,4 +1,8 @@ #!/usr/bin/env python +""" +HTTPie - cURL for humans. + +""" import os import sys import json @@ -10,7 +14,8 @@ from . import pretty __author__ = 'Jakub Roztocil' -__version__ = '0.1.1' +__version__ = '0.1.2' +__licence__ = 'BSD' DEFAULT_UA = 'HTTPie/%s' % __version__ @@ -42,7 +47,7 @@ class KeyValueType(object): parser = argparse.ArgumentParser( - description='HTTPie - cURL for humans.') + description=__doc__.strip()) # Content type. diff --git a/httpie/solarized.py b/httpie/solarized.py new file mode 100644 index 00000000..903f32b6 --- /dev/null +++ b/httpie/solarized.py @@ -0,0 +1,127 @@ +""" +A Pygments_ style based on the dark background variant of Solarized_. + +.. _Pygments: http://pygments.org/ +.. _Solarized: http://ethanschoonover.com/solarized + +Copyright (c) 2011 Hank Gay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +""" +from pygments.style import Style +from pygments.token import Token, Comment, Name, Keyword, Generic, Number, Operator, String + + +BASE03 = '#002B36' +BASE02 = '#073642' +BASE01 = '#586E75' +BASE00 = '#657B83' +BASE0 = '#839496' +BASE1 = '#93A1A1' +BASE2 = '#EEE8D5' +BASE3 = '#FDF6E3' +YELLOW = '#B58900' +ORANGE = '#CB4B16' +RED = '#DC322F' +MAGENTA = '#D33682' +VIOLET = '#6C71C4' +BLUE = '#268BD2' +CYAN = '#2AA198' +GREEN = '#859900' + + +class SolarizedStyle(Style): + background_color = BASE03 + styles = { + Keyword: GREEN, + Keyword.Constant: ORANGE, + Keyword.Declaration: BLUE, + #Keyword.Namespace + #Keyword.Pseudo + Keyword.Reserved: BLUE, + Keyword.Type: RED, + + #Name + Name.Attribute: BASE1, + Name.Builtin: YELLOW, + Name.Builtin.Pseudo: BLUE, + Name.Class: BLUE, + Name.Constant: ORANGE, + Name.Decorator: BLUE, + Name.Entity: ORANGE, + Name.Exception: ORANGE, + Name.Function: BLUE, + #Name.Label + #Name.Namespace + #Name.Other + Name.Tag: BLUE, + Name.Variable: BLUE, + #Name.Variable.Class + #Name.Variable.Global + #Name.Variable.Instance + + #Literal + #Literal.Date + String: CYAN, + String.Backtick: BASE01, + String.Char: CYAN, + String.Doc: BASE1, + #String.Double + String.Escape: ORANGE, + String.Heredoc: BASE1, + #String.Interpol + #String.Other + String.Regex: RED, + #String.Single + #String.Symbol + Number: CYAN, + #Number.Float + #Number.Hex + #Number.Integer + #Number.Integer.Long + #Number.Oct + + Operator: GREEN, + #Operator.Word + + #Punctuation: ORANGE, + + Comment: BASE01, + #Comment.Multiline + Comment.Preproc: GREEN, + #Comment.Single + Comment.Special: GREEN, + + #Generic + Generic.Deleted: CYAN, + Generic.Emph: 'italic', + Generic.Error: RED, + Generic.Heading: ORANGE, + Generic.Inserted: GREEN, + #Generic.Output + #Generic.Prompt + Generic.Strong: 'bold', + Generic.Subheading: ORANGE, + #Generic.Traceback + + Token: BASE1, + Token.Other: ORANGE, + } diff --git a/setup.py b/setup.py index debf950e..43826cdd 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,12 @@ from setuptools import setup +from httpie import httpie -setup(name='httpie',version='0.1.1', - description='cURL for humans', +setup(name='httpie',version=httpie.__version__, + description=httpie.__doc__.strip(), url='https://github.com/jkbr/httpie', - author='Jakub Roztocil', - license='BSD', + author=httpie.__author__, + license=httpie.__licence__, packages=['httpie'], entry_points={'console_scripts': ['httpie = httpie.httpie:main']}, install_requires=['requests>=0.10.4', 'Pygments>=1.4'])