Allow selection of interpreter

Closes #5
Closes #7
This commit is contained in:
Samuel Sloniker 2022-04-08 13:25:20 -07:00
parent 92ad9bfa6b
commit 3d985edb5a

View File

@ -2,6 +2,7 @@ import requests
import subprocess
import sys
import argparse
import shlex
def launch(command, data):
@ -38,11 +39,22 @@ parser.add_argument(
action="store_true",
help="Skip pager and confirmation; run script immediately",
)
parser.add_argument(
"-p",
"--pager",
help="Choose pager to use (default: `less`)",
default="less",
)
parser.add_argument(
"-i",
"--interpreter",
help="Choose interpreter to use (default: `bash`)",
default="bash",
)
args = parser.parse_args()
url = args.url
interpreter = ["bash"]
pager = ["less"]
pager = shlex.split(args.pager)
interpreter = shlex.split(args.interpreter)
content = requests.get(url).content
@ -53,6 +65,7 @@ else:
response = yn("Do you want to run this script?")
if response == "y":
print("=" * 20)
launch(interpreter, content)
else:
print("Script not run.")