[test] Make hb-unicode-prettyname take a --stdin option

This commit is contained in:
Behdad Esfahbod 2012-01-20 13:31:59 -05:00
parent ad8c6446f2
commit 0016d4662d
1 changed files with 9 additions and 6 deletions

View File

@ -27,12 +27,15 @@ def pretty_name (x):
def pretty_names (s): def pretty_names (s):
s = re.sub ("[<+>\\]", "", s) s = re.sub (r"[<+>\\]", "", s)
s = re.sub ("[uU]", " ", s) s = re.sub (r"[uU]", " ", s)
print s s = [unichr (int (x, 16)) for x in re.split ('[, \n]', s) if len (x)]
s = [unichr (int (x, 16)) for x in re.split ('[, ]', s) if len (x)]
return ' + '.join (pretty_name (x) for x in s) return ' + '.join (pretty_name (x) for x in s)
if __name__ == '__main__': if __name__ == '__main__':
if '--stdin' in sys.argv:
sys.argv.remove ('--stdin')
for line in sys.stdin.readlines ():
print pretty_names (line)
else:
print pretty_names (','.join (sys.argv[1:])) print pretty_names (','.join (sys.argv[1:]))