diff options
| author | tobyrosen@gmail.com <tobyrosen@gmail.com@8ebc04a2-01ca-80aa-3703-73c302266661> | 2011-08-08 14:28:54 +0000 |
|---|---|---|
| committer | tobyrosen@gmail.com <tobyrosen@gmail.com@8ebc04a2-01ca-80aa-3703-73c302266661> | 2011-08-08 14:28:54 +0000 |
| commit | 5deae676b8a82a703a18959c6c07709dd05b5280 (patch) | |
| tree | 9e0ea2e5b9302593e904e9fee10be8edd63ab1a1 | |
| parent | a127e16ca8f1378fe5151d61d7a13e85c190cd9a (diff) | |
fixed mac color issue
git-svn-id: http://pyp.googlecode.com/svn/trunk@103 8ebc04a2-01ca-80aa-3703-73c302266661
| -rw-r--r-- | pyp | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -544,7 +544,7 @@ class Pyp(object): nf = 0 output = '' if power_pipe: - n_index = Colors.MAGENTA + '[%s]' % (self.n - 1) + Colors.OFF + n_index = Colors.MAGENTA + '[%s]' % (self.n - 1) + Colors.GREEN else: n_index = '' #DEALS WITH DIFFERENT TYPES OF INPUTS @@ -553,13 +553,13 @@ class Pyp(object): for field in input: if not nf == len(input): if type(field) in [str, PypStr]: - COLOR = Colors.OFF + COLOR = Colors.GREEN else: COLOR = Colors.MAGENTA - output = str(output) + Colors.BOLD + Colors.BLUE + "[%s]" % nf + Colors.OFF + COLOR + str(field) + Colors.OFF + output = str(output) + Colors.BOLD + Colors.BLUE + "[%s]" % nf + Colors.OFF + COLOR + str(field) + Colors.GREEN nf = nf + 1 - return n_index + Colors.OFF + Colors.BOLD + '[' + Colors.OFF + output + Colors.OFF + Colors.BOLD + ']' + Colors.OFF + return n_index + Colors.GREEN + Colors.BOLD + '[' + Colors.OFF + output + Colors.GREEN + Colors.BOLD + ']' + Colors.OFF elif type(input) in [str, int, PypStr] : @@ -568,8 +568,8 @@ class Pyp(object): elif type(input) is dict: #deals with dictionaries for field in sorted(input,key=lambda x : x.lower()): - output = output + Colors.OFF + Colors.BOLD + Colors.BLUE + "'" + field + "'" + Colors.OFF + ": " + Colors.OFF + Colors.OFF + str(input[field]) + Colors.BOLD + Colors.OFF + ',\n ' - return n_index + Colors.OFF + Colors.BOLD + '{' + output.strip().strip(' ,') + Colors.GREEN + Colors.BOLD + '}' + Colors.OFF + output = output + Colors.OFF + Colors.BOLD + Colors.BLUE + "'" + field + "'" + Colors.GREEN + ": " + Colors.OFF + Colors.GREEN + str(input[field]) + Colors.BOLD + Colors.GREEN + ',\n ' + return n_index + Colors.GREEN + Colors.BOLD + '{' + output.strip().strip(' ,') + Colors.GREEN + Colors.BOLD + '}' + Colors.OFF else: #catches every else return n_index + Colors.MAGENTA + str(input) + Colors.OFF @@ -1367,7 +1367,7 @@ used to enclose any strings. Here is a simple example for splitting the output of "ls" (unix file list) on '.':''' + Colors.YELLOW + ''' ls random_frame.jpg | pyp "p.split('.')" - ==> [''' + Colors.BLUE + '[0]' + Colors.YELLOW + 'random_frame' + Colors.BLUE + '[1]' + Colors.YELLOW + 'jpg] ''' + Colors.OFF + ''' + ==> [''' + Colors.BLUE + '[0]' + Colors.YELLOW + 'random_frame' + Colors.BLUE + '[1]' + Colors.YELLOW + 'jpg] ''' + Colors.GREEN + ''' The variable "p" represents each line piped in from "ls". Notice the output has index numbers, so it's trivial to pick a particular field or range of fields, |
