mirror of
https://github.com/kennethreitz/clint.git
synced 2026-06-05 23:00:18 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fc463f16c3 | |||
| 9324af95b2 | |||
| 50294ea2dc | |||
| 56fe6138b6 | |||
| d22847fb95 | |||
| ce25cea7e8 |
+14
@@ -1,6 +1,20 @@
|
||||
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.1'
|
||||
__build__ = 0x000301
|
||||
__version__ = '0.3.3'
|
||||
__build__ = 0x000303
|
||||
__author__ = 'Kenneth Reitz'
|
||||
__license__ = 'ISC'
|
||||
__copyright__ = 'Copyright 2012 Kenneth Reitz'
|
||||
|
||||
+20
-18
@@ -40,11 +40,12 @@ else:
|
||||
|
||||
class ColoredString(object):
|
||||
"""Enhanced string for __len__ operations on Colored output."""
|
||||
def __init__(self, color, s, always_color=False):
|
||||
def __init__(self, color, s, always_color=False, bold=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):
|
||||
@@ -59,7 +60,8 @@ class ColoredString(object):
|
||||
|
||||
@property
|
||||
def color_str(self):
|
||||
c = '%s%s%s' % (getattr(colorama.Fore, self.color), self.s, colorama.Fore.RESET)
|
||||
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)
|
||||
|
||||
if self.always_color:
|
||||
return c
|
||||
@@ -113,29 +115,29 @@ def clean(s):
|
||||
return txt
|
||||
|
||||
|
||||
def black(string, always=False):
|
||||
return ColoredString('BLACK', string, always_color=always)
|
||||
def black(string, always=False, bold=False):
|
||||
return ColoredString('BLACK', string, always_color=always, bold=bold)
|
||||
|
||||
def red(string, always=False):
|
||||
return ColoredString('RED', string, always_color=always)
|
||||
def red(string, always=False, bold=False):
|
||||
return ColoredString('RED', string, always_color=always, bold=bold)
|
||||
|
||||
def green(string, always=False):
|
||||
return ColoredString('GREEN', string, always_color=always)
|
||||
def green(string, always=False, bold=False):
|
||||
return ColoredString('GREEN', string, always_color=always, bold=bold)
|
||||
|
||||
def yellow(string, always=False):
|
||||
return ColoredString('YELLOW', string, always_color=always)
|
||||
def yellow(string, always=False, bold=False):
|
||||
return ColoredString('YELLOW', string, always_color=always, bold=bold)
|
||||
|
||||
def blue(string, always=False):
|
||||
return ColoredString('BLUE', string, always_color=always)
|
||||
def blue(string, always=False, bold=False):
|
||||
return ColoredString('BLUE', string, always_color=always, bold=bold)
|
||||
|
||||
def magenta(string, always=False):
|
||||
return ColoredString('MAGENTA', string, always_color=always)
|
||||
def magenta(string, always=False, bold=False):
|
||||
return ColoredString('MAGENTA', string, always_color=always, bold=bold)
|
||||
|
||||
def cyan(string, always=False):
|
||||
return ColoredString('CYAN', string, always_color=always)
|
||||
def cyan(string, always=False, bold=False):
|
||||
return ColoredString('CYAN', string, always_color=always, bold=bold)
|
||||
|
||||
def white(string, always=False):
|
||||
return ColoredString('WHITE', string, always_color=always)
|
||||
def white(string, always=False, bold=False):
|
||||
return ColoredString('WHITE', string, always_color=always, bold=bold)
|
||||
|
||||
def disable():
|
||||
"""Disables colors."""
|
||||
|
||||
@@ -8,7 +8,7 @@ Module for simple interactive prompts handling
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, print_function
|
||||
|
||||
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,8 +11,6 @@ except ImportError:
|
||||
|
||||
import clint
|
||||
|
||||
|
||||
|
||||
def publish():
|
||||
"""Publish to PyPi"""
|
||||
os.system("python setup.py sdist upload")
|
||||
@@ -32,10 +30,6 @@ 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