mirror of
https://github.com/b-ryan/powerline-shell.git
synced 2026-09-10 07:26:28 -04:00
Use print() function in both Python 2 and Python 3
This commit is contained in:
parent
a9b8c9bb39
commit
df43e4fdbd
14
colortest.py
14
colortest.py
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env python2
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
ESCAPE = chr(27)
|
||||
|
|
@ -14,19 +16,19 @@ def reset():
|
|||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 6:
|
||||
print 'Usage: colortest.py fg_start fg_end bg_start bg_end test_string'
|
||||
print('Usage: colortest.py fg_start fg_end bg_start bg_end test_string')
|
||||
sys.exit(1)
|
||||
|
||||
fg_start, fg_end, bg_start, bg_end = map(int, sys.argv[1:5])
|
||||
test_string = sys.argv[5]
|
||||
|
||||
print ' ' * len(str(bg_start)),
|
||||
print(' ' * len(str(bg_start)), end=' ')
|
||||
for fg_color in range(fg_start, fg_end + 1):
|
||||
print ' ' * (len(test_string) - len(str(fg_color))), fg_color,
|
||||
print(' ' * (len(test_string) - len(str(fg_color))), fg_color, end=' ')
|
||||
print
|
||||
|
||||
for bg_color in range(bg_start, bg_end + 1):
|
||||
print bg_color, bg(bg_color),
|
||||
print(bg_color, bg(bg_color), end=' ')
|
||||
for fg_color in range(fg_start, fg_end + 1):
|
||||
print fg(fg_color), test_string,
|
||||
print reset()
|
||||
print(fg(fg_color), test_string, end=' ')
|
||||
print(reset())
|
||||
|
|
|
|||
Loading…
Reference in a new issue