mirror of
https://github.com/kennethreitz/clint.git
synced 2026-06-05 23:00:18 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e172a1e282 |
-14
@@ -1,20 +1,6 @@
|
||||
History
|
||||
-------
|
||||
|
||||
0.3.3
|
||||
+++++
|
||||
* Fixed Python 3 build issues
|
||||
* Fixed README and HISTORY being installed to /usr
|
||||
* Support added for bold text
|
||||
|
||||
0.3.2
|
||||
+++++
|
||||
* Unknown
|
||||
|
||||
0.3.1
|
||||
+++++
|
||||
* Unknown
|
||||
|
||||
0.3.0
|
||||
+++++
|
||||
|
||||
|
||||
+2
-2
@@ -26,8 +26,8 @@ from .pipes import piped_in
|
||||
|
||||
|
||||
__title__ = 'clint'
|
||||
__version__ = '0.3.3'
|
||||
__build__ = 0x000303
|
||||
__version__ = '0.3.2'
|
||||
__build__ = 0x000302
|
||||
__author__ = 'Kenneth Reitz'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = 'Copyright 2012 Kenneth Reitz'
|
||||
|
||||
+18
-20
@@ -40,12 +40,11 @@ else:
|
||||
|
||||
class ColoredString(object):
|
||||
"""Enhanced string for __len__ operations on Colored output."""
|
||||
def __init__(self, color, s, always_color=False, bold=False):
|
||||
def __init__(self, color, s, always_color=False):
|
||||
super(ColoredString, self).__init__()
|
||||
self.s = s
|
||||
self.color = color
|
||||
self.always_color = always_color
|
||||
self.bold = bold
|
||||
|
||||
def __getattr__(self, att):
|
||||
def func_help(*args, **kwargs):
|
||||
@@ -60,8 +59,7 @@ class ColoredString(object):
|
||||
|
||||
@property
|
||||
def color_str(self):
|
||||
style = 'BRIGHT' if self.bold else 'NORMAL'
|
||||
c = '%s%s%s%s' % (getattr(colorama.Fore, self.color), getattr(colorama.Style, style), self.s, colorama.Fore.RESET)
|
||||
c = '%s%s%s' % (getattr(colorama.Fore, self.color), self.s, colorama.Fore.RESET)
|
||||
|
||||
if self.always_color:
|
||||
return c
|
||||
@@ -115,29 +113,29 @@ def clean(s):
|
||||
return txt
|
||||
|
||||
|
||||
def black(string, always=False, bold=False):
|
||||
return ColoredString('BLACK', string, always_color=always, bold=bold)
|
||||
def black(string, always=False):
|
||||
return ColoredString('BLACK', string, always_color=always)
|
||||
|
||||
def red(string, always=False, bold=False):
|
||||
return ColoredString('RED', string, always_color=always, bold=bold)
|
||||
def red(string, always=False):
|
||||
return ColoredString('RED', string, always_color=always)
|
||||
|
||||
def green(string, always=False, bold=False):
|
||||
return ColoredString('GREEN', string, always_color=always, bold=bold)
|
||||
def green(string, always=False):
|
||||
return ColoredString('GREEN', string, always_color=always)
|
||||
|
||||
def yellow(string, always=False, bold=False):
|
||||
return ColoredString('YELLOW', string, always_color=always, bold=bold)
|
||||
def yellow(string, always=False):
|
||||
return ColoredString('YELLOW', string, always_color=always)
|
||||
|
||||
def blue(string, always=False, bold=False):
|
||||
return ColoredString('BLUE', string, always_color=always, bold=bold)
|
||||
def blue(string, always=False):
|
||||
return ColoredString('BLUE', string, always_color=always)
|
||||
|
||||
def magenta(string, always=False, bold=False):
|
||||
return ColoredString('MAGENTA', string, always_color=always, bold=bold)
|
||||
def magenta(string, always=False):
|
||||
return ColoredString('MAGENTA', string, always_color=always)
|
||||
|
||||
def cyan(string, always=False, bold=False):
|
||||
return ColoredString('CYAN', string, always_color=always, bold=bold)
|
||||
def cyan(string, always=False):
|
||||
return ColoredString('CYAN', string, always_color=always)
|
||||
|
||||
def white(string, always=False, bold=False):
|
||||
return ColoredString('WHITE', string, always_color=always, bold=bold)
|
||||
def white(string, always=False):
|
||||
return ColoredString('WHITE', string, always_color=always)
|
||||
|
||||
def disable():
|
||||
"""Disables colors."""
|
||||
|
||||
@@ -8,7 +8,7 @@ Module for simple interactive prompts handling
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
from re import match, I
|
||||
|
||||
@@ -30,7 +30,7 @@ def yn(prompt, default='y', batch=False):
|
||||
if not batch:
|
||||
input = raw_input(prompt).strip()
|
||||
else:
|
||||
print(prompt)
|
||||
print prompt
|
||||
input = ''
|
||||
|
||||
# If input is empty default choice is assumed
|
||||
|
||||
@@ -11,6 +11,8 @@ except ImportError:
|
||||
|
||||
import clint
|
||||
|
||||
|
||||
|
||||
def publish():
|
||||
"""Publish to PyPi"""
|
||||
os.system("python setup.py sdist upload")
|
||||
@@ -30,6 +32,10 @@ setup(
|
||||
author='Kenneth Reitz',
|
||||
author_email='me@kennethreitz.com',
|
||||
url='https://github.com/kennethreitz/clint',
|
||||
data_files=[
|
||||
'README.rst',
|
||||
'HISTORY.rst',
|
||||
],
|
||||
packages= [
|
||||
'clint',
|
||||
'clint.textui',
|
||||
|
||||
Reference in New Issue
Block a user