parent
92ad9bfa6b
commit
3d985edb5a
19
netrun.py
19
netrun.py
|
@ -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.")
|
||||
|
|
Loading…
Reference in New Issue
Block a user