--ctrl, --upper, --lower, --digit flags.

This commit is contained in:
Kelvin Sherlock 2021-09-19 18:49:52 -04:00
parent 9c526bd762
commit d97b32a699

View File

@ -27,6 +27,28 @@ argv = sys.argv[1:]
chars = []
for arg in argv:
if arg == "--ctrl":
for c in range(0,32):
chars.append(chr(c))
continue
if arg == "--upper":
for c in range(ord('A'), ord('Z')+1):
chars.append(chr(c))
continue
if arg == "--lower":
for c in range(ord('a'), ord('z')+1):
chars.append(chr(c))
continue
if arg == "--digit":
for c in range(ord('0'), ord('9')+1):
chars.append(chr(c))
continue
# ^X is a control character
if len(arg) == 2 and arg[0] == '^':
c = chr(ord(arg[1]) & 0x1f)