2016-08-18 01:24:38 +00:00
|
|
|
import pyperclip
|
|
|
|
|
|
|
|
CLIPBOARD_STRINGS = ['!c', '!clip', '!clipboard']
|
|
|
|
INPUT_STRINGS = ['!i', '!in', '!input', '!stdin']
|
|
|
|
EOF = '\x1a'
|
|
|
|
|
|
|
|
def multi_line_input():
|
|
|
|
userinput = []
|
|
|
|
while True:
|
|
|
|
try:
|
|
|
|
additional = input()
|
|
|
|
except EOFError:
|
|
|
|
# If you enter nothing but ctrl-z
|
|
|
|
additional = EOF
|
2016-09-05 23:37:07 +00:00
|
|
|
else:
|
|
|
|
userinput.append(additional)
|
2016-08-18 01:24:38 +00:00
|
|
|
|
|
|
|
if EOF in additional:
|
|
|
|
break
|
|
|
|
|
|
|
|
userinput = '\n'.join(userinput)
|
|
|
|
userinput = userinput.split(EOF)[0]
|
|
|
|
return userinput.strip()
|
|
|
|
|
|
|
|
def resolve(arg):
|
|
|
|
lowered = arg.lower()
|
|
|
|
if lowered in CLIPBOARD_STRINGS:
|
|
|
|
return pyperclip.paste()
|
|
|
|
if lowered in INPUT_STRINGS:
|
|
|
|
return multi_line_input()
|
|
|
|
return arg
|