#!/usr/bin/env python3 # http://inamidst.com/saxo/ # Created by Sean B. Palmer import os import re import subprocess import saxo @saxo.pipe def unicode(arg): if not arg: return "Search for a unicode character" digit = re.compile("[0-9]") hexcode = re.compile("(?i)^[0-9A-F]{2,6}$") codepoint = re.compile(r"(?i)^(U\+|\\u)[0-9A-F]{2,6}$") simple = re.compile(r"^[\x20-\x7E]+$") if len(arg) == 1: return saxo.call("unicode-by-character", arg) elif codepoint.match(arg): return saxo.call("unicode-by-codepoint", arg) elif digit.search(arg) and hexcode.match(arg): return saxo.call("unicode-by-codepoint", arg) elif not simple.match(arg): return saxo.call("unicode-by-character", arg) else: return saxo.call("unicode-by-name", arg)