Add Ty applet

This commit is contained in:
Pragmatic Software 2022-04-06 09:09:20 -07:00
parent 1c57e01fad
commit 7b9971294a
1 changed files with 16 additions and 0 deletions

16
applets/ty.py vendored Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env python3
import sys
import subprocess
url = 'https://based.lol/run.ty'
if len(sys.argv) <= 1:
print('Usage: ty` <code> [-stdin=<input>]')
sys.exit(0)
cmd = ' '.join(sys.argv[1:]).replace('\\n', '\n')
[code, *input] = cmd.split('-stdin=')
print(subprocess.run(['curl', url, '-F', f'code={code}', '-F', f'input={"".join(input)}'], text=True, capture_output=True).stdout.rstrip())